/*
This JS code does 2 things: first it looks to see if there is an existing cookie that is set for the 
css style the user wants to use, and if there is then the css style is changed to that style.
If there is no cookie set for the style then the function looks at the URL to see if there is a style
appended to the URL, then change the css to use that style and set the cookie for thats style to keep it persistent
If the style being used is the default style (mkid_css1.css) then any existing cookies are cleared and no 
cookies are set to make the site accessible to those that do not want cookies left on their machines.
the process:
1. look for cookie
2. if there is no cookie assume using default style
3. if there is a cookie get the value for the css file
4. check to see if there is a new style appended to the url
5. if there is a style appended to the url then it supercedes the style in the cookie
6. set the page to the current style
7. if the current style is the default style then clear the cookie
8. if the current style is different style then set the style in the cookie
------------------------
css= the css file name from the URL
defaultCSS = the default CSS style
currCSS= the current style (from the cookie)
*/

/*
Step 1 - look for the cookie
*/
if (location.search.length > 0) { 
launchString = location.search.substring(1, location.search.length); 
var launchStringArray = launchString.split("&"); 
for (var i = 0; i <= launchStringArray.length - 1; i++) { 
	var left = launchStringArray[i].substring(0, launchStringArray[i].indexOf("=")); 
	var right = launchStringArray[i].substring(launchStringArray[i].indexOf("=") + 1, launchString.length); 
	 if (isNaN(right)) { 
		right = '"' + right + '"'; 
	}else if(!right){
		right = '" "';
	}
	eval("var " + left + " = " + right); 
	} 
}else{//if there is nothing passed
	var css="";
}
//if the css variable is not the default (mkid_css1) or null then change the path to the css file
if((css=="") || (css=="1")){
	var thePath="mkid_css"+css;
}else{
	var thePath="mkid_css"+css;
	var theNewURL="styles/mkid_css"+css+".css";
	document.getElementById("theCSSlink").href=theNewURL;
}
