Photoinduced and Thermal Reactions of Functional Molecules at Surfaces