This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
you CAN NOT use document.write AFTER the page loads.
Do a view source on the page. You will see that document.write REPLACES the ENTIRE document.
If you want to switch, you need to either have the content on the page already, you need to just show it with css [display: block/none] or you need to use DOM methods [createElement/appendChild/removeChild] OR you use innerHTML.