Ferromagnetism and antiferromagnetism of 3d-metal overlayers on metals