Compare and contrast an electromagnet and a permanent magnet.