How did the Enigma Machine work?

More here and here .