// This is the Toggle Toolbar Script
//Global Vars

cookie_name = "dataCookie";
var search_selection;


//Global Functions
function PageLoad()
{	
	getSettings();

	if(search_selection == "undefined")
	{
		search_content.style.display = "block";
	}
	else
	{
		if(search_selection == "Closed")
		{
			search_content.style.display = "none";
		}
		else
		{
			search_content.style.display = "block";
		}
	}
}

function getSettings() 
{
	if(document.cookie)
	{
		index = document.cookie.indexOf(cookie_name);
		if (index != -1)
		{
			namestart = (document.cookie.indexOf("=", index) + 1);
			nameend = document.cookie.indexOf(";", index);
			if (nameend == -1) 
			{
				nameend = document.cookie.length;
			}
			search_selection = document.cookie.substring(namestart, nameend);
			return search_selection;
		}
	}
}

function toggle(targetID)
{
	if(document.getElementById)
	target = document.getElementById(targetID)
	if(target.style.display == "block")
	{
		target.style.display = "none";
		search_selection = "Closed"	;
		putCookie();
	}
	else
	{
		target.style.display = "block";
		search_selection = "Open";
		putCookie();
	}
}

function putCookie() 
{
	if(document.cookie != document.cookie) 
	{
		index = document.cookie.indexOf(cookie_name);
	}
	else 
	{ 
		index = -1;
	}
	if (index == -1)
	{
		document.cookie=cookie_name+"="+search_selection+"; expires=Monday, 07-Jul-2020 05:00:00 GMT; path=/";
	}
}


// This is an IE hack that makes the dropdown menu work right
over = function() {
	var nav_check=document.getElementById("nav")
	if(nav_check!=undefined)
	{
		var sfEls = document.getElementById("nav").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" over";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" over\\b"), "");
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", over);


// This is the Toggle Button
//function toggle( targetId ){
//  if (document.getElementById){
//		target = document.getElementById( targetId );
//		   if (target.style.display == "none"){
//			  target.style.display = "";
//		   } else {
//			  target.style.display = "none";
//		   }
//	 }
//}

