  First principles FLMTO-GGA electronic structure calculations of the new
medium-$T_C$ superconductor (MTSC) $MgB_2$ and related diborides indicate that
superconductivity in these compounds is related to the the existence of
$p_{x,y}$-band holes at the $\Gamma$ point. Based on these calculations, we
explain the absence of medium-$T_C$ superconductivity for $BeB_2$, $AlB_2$
$ScB_2$ and $YB_2$. The simulation of a number of $MgB_2$-based ternary systems
using a supercell approach demonstrates that (i) the electron doping of $MgB_2$
(i.e., $MgB_{2-y}X_y$ with X=Be, C, N, O) and the creation of isoelectronic
defects in the boron sublattice (nonstoichiometric $MgB_{y<2}$) are not
favorable for superconductivity, and (ii) a possible way of searching for
similar MTSC should be via hole doping of $MgB_2$ (i.e., $Mg_{1-x}M_xB_2$ with
M=Be, Ca, Li, Na, Cu, Zn) or $CaB_2$ or via creating layered superstructures of
the $MgB_2/CaB_2$ type. A recent report of superconductivity in Cu doped
$MgB_2$ supports this view.
