Cmd-tab switches between Applications.
Cmd-` switches between document windows inside an Application.
For both, the OS implements a "most recently used" ordering. So, the queue changes each time you switch. This allows you to switch back and forth between the most currently used windows.
On a US keyboard, ` is left of the 1. If you are using another language keyboard, you'll have to determine where that key is.
Also, using Mission Control, you can arrange multiple "Desktops" where you can keep the windows specific to a task. See this Article: http://support.apple.com/kb/HT4689
The OS, by default, arranges the Desktops by frequency of use. If you always want them in the same order, you can set that in the Mission Control System Preferences.
You can use ctrl-arrow left/right to switch desktops. You can set function keys to enable the different Mission Control displays, and they are built in on the Function keys of Apple keyboards.