  We report a detailed study of the electronic and structural properties of the
39K superconductor \mgbtwo and of several related systems of the same family,
namely \mgalbtwo, \bebtwo, \casitwo and \cabesi. Our calculations, which
include zone-center phonon frequencies and transport properties, are performed
within the local density approximation to the density functional theory, using
the full-potential linearized augmented plane wave (FLAPW) and the
norm-conserving pseudopotential methods. Our results indicate essentially
three-dimensional properties for these compounds; however, strongly
two-dimensional $\sigma$-bonding bands contribute significantly at the Fermi
level. Similarities and differences between \mgbtwo and \bebtwo (whose
superconducting properties have not been yet investigated) are analyzed in
detail. Our calculations for \mgalbtwo show that metal substitution cannot be
fully described in a rigid band model. \casitwo is studied as a function of
pressure, and Be substitution in the Si planes leads to a stable compound
similar in many aspects to diborides.
