Electronic structure and magnetic properties of graphite intercalated with 3d-metals