Ionization of magnesium atoms in femtosecond 400-nm laser fields