// JavaScript Document
	function PopUp(theURL,winName,features)
		{	window.open(theURL,winName,features);}



//---------------------------------------------------------
//		Cookie Functions
//---------------------------------------------------------
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}
//---------------------------------------------------------

//---------------------------------------------------------
//   Left Category Menu 
//---------------------------------------------------------
function Menu_ExpandCollapse(sBranchID, button, state)
{
	//alert(sBranchID);
	var branch = document.getElementById(sBranchID);

	if (state == undefined)
		{
			if (branch.style.visibility != 'hidden') {
				branch.style.visibility = 'hidden';
				branch.style.display = 'none';
				button.src = "images/EC/expandbtn2.gif";
				createCookie('branch'+sBranchID,'hide',360);
			} else {
				branch.style.visibility = 'visible';
				branch.style.display = '';
				button.src = "images/EC/collapsebtn2.gif";
				createCookie('branch'+sBranchID,'show',360);
			}
		} else {
			if (state == 0) {
				branch.style.visibility = 'hidden';
				branch.style.display = 'none';
				button.src = "images/EC/expandbtn2.gif";
				//createCookie('branch'+sBranchID,'hide',360);
			} else if(state == 1) {
				branch.style.visibility = 'visible';
				branch.style.display = '';
				button.src = "images/EC/collapsebtn2.gif";
				//createCookie('branch'+sBranchID,'show',360);
			}
		}
}

function fixMenu()
{
	myBody = document.getElementsByTagName("body")[0];
	myMenu = document.getElementById("CategoryMenu")
	myUL = myMenu.getElementsByTagName("ul");
	
	for (var i = 0; i < myUL.length; i++)
	{
		if (myUL[i].id != '')
		{
			var brID = myUL[i].id;
			if (readCookie('branch'+brID) == 'show' )
			{
				Menu_ExpandCollapse(brID, document.getElementById('i'+brID),1)
			} else if (readCookie('branch'+brID) == 'hide') {
				Menu_ExpandCollapse(brID, document.getElementById('i'+brID),0)
			}
		}
	}
}

//---------------------------------------------------------




