
function setCookie(c_name,value) {
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+365);
	document.cookie=c_name+ "=" +escape(value)+ ((365==null) ? "" : ";expires="+exdate.toGMTString())
	} 


function getCookie(c_name) {

	if (document.cookie.length>0) {
		c_start=document.cookie.indexOf(c_name + "=")
		if (c_start!=-1) { 
			c_start=c_start + c_name.length+1 
  			c_end=document.cookie.indexOf(";",c_start)
			if (c_end==-1) c_end=document.cookie.length
    		return unescape(document.cookie.substring(c_start,c_end))
    	} 
  	}

	return ""

}




function toggleMenu(m,w) {

	var theElement =	document.getElementById(m);
	var theList = 		theElement.getElementsByTagName("ul");
	var theSpan =		theElement.getElementsByTagName("span");
	var theLinks = 	theSpan[0].getElementsByTagName("a");

	var theStyle;
	
	if(w==1) {	theStyle = "block";
					theLinks[0].style.display = "inline";
					theLinks[1].style.display = "none"; }
	else {		theStyle = "none"; 							
					theLinks[0].style.display = "none";
					theLinks[1].style.display = "inline"; }

	theList[0].style.display = theStyle;
	


	setCookie(m,w);


	}





function checkCookie(m) {
	var theCookie 	= getCookie(m);
	if (theCookie==null || theCookie=="") {	toggleMenu(m,0); }
	else {												toggleMenu(m,theCookie); }
	} 


function checkCookies() {
	checkCookie("subList01");
	checkCookie("subList02");
	checkCookie("subList03");
	checkCookie("subList04");
	checkCookie("subList05");
	checkCookie("subList06");
	checkCookie("subList07");
	checkCookie("subList08");
	}