// JavaScript Document
// Author : don mclean, onlineone
// Copyright: online one
//
// Script runs onload within the browser and detects the page on the check out and then does DOM manipulation
// based on the user/customer requirement.

// Put the script into NetSuite document library, then refer to it in the theme header
// and be sure to add an onload="onLoadReg();" call in the browser ..

// this script runs on the 
			// add the main picture
			function onLoadReg()
			{
				// get the title of the page loaded
				var title = document.title;
				var t = title.split(' ');
				//alert(t[0]);
				
				// get the url of the page eg https://checkout.netsuite.com/app/center/nlvisitor.nl?c=920706&sc=6&n=1
				var xurl = document.URL;
				var isapp = xurl.match("app");
				var ischeckout = xurl.match("checkout");
				//alert(isapp+' '+ischeckout);
				if (isapp == "app" || ischeckout == "checkout" || t[0] == "Shopping")
				{
					// we are onlogged on to the customer cntre
					
					// replace the normal layout with blank sheet
					var xbody = document.getElementById('div__body');
					if (xbody != null)
					{
						xbody.style.backgroundColor="#FFFFFF";
						xbody.style.backgroundImage="none";
					}

					var xfooter = document.getElementById('footer-container');
					if (xfooter!= null)
					{					
						xfooter.style.backgroundColor="#FFFFFF";
						xfooter.style.backgroundImage="none";	
					}
					
					var crumbs= document.getElementById('top-header');
					if (crumbs!= null)
					{					
						crumbs.style.width="946px";
						crumbs.style.marginLeft ="0px";
					}
					
					var crumbs= document.getElementById('background-paperclip-top');
					if (crumbs!= null)
					{					
						crumbs.style.width="946px";
						crumbs.style.backgroundImage="url(/site/images/ok-my-account-header2.jpg)";
					}

					
					var the_footer = document.getElementById('div__footer');
					if (the_footer!= null)
					{					
						the_footer.style.backgroundColor = "#FFF";
					}
					var staple= document.getElementById('staple');
					if (staple!= null)
					{					
						staple.style.backgroundImage="none";
					}
					var thesearch= document.getElementById('searchdiv');
					if (thesearch!= null)
					{					
						thesearch.innerHTML ='<a href="http://www.officeking.com.au">Back to shopping</a>';
					}
				}
				switch ( t[0] ) 
				{
		// STEP 1 - The shopping basket is being viewed			
				case ('Shopping') : 

	
					
				break;
		// STEP 2 - The "Buy Now" button has been pressed and now viewing the registration page					
				case ('Checkout') :  
				
				

		
				break;
				
				case ('Billing') : 
	
				break;
				
				case ('Payment') : 

					break;
				
		
				case ('Review') : 



				break;
				}
				
				
	
			}
	
