There are two types of stepping motor and those two examples are for different types.
For a fuller discussion see:-
http://www.thebox.myzen.co.uk/Workshop/Motors_3.html
for the 5 wire type and for the 4 wire type see:-
http://www.thebox.myzen.co.uk/Workshop/Motors_4.html