Electrochemistry and photoelectrochemistry of transition metal complexes in well-ordered surface layers