Electronic structure and magnetism of transition metal-metalloid glasses