Geometric and electronic structure of a magnesium overlayer on the GaAs(110) surface