Theoretical studies of molecules adsorbed on solid surfaces: I. Electronic spectra