
/*****************************************************
functions used for left nav menu processing
*****************************************************/


function SwitchMenu(obj, link)
{
	if(document.getElementById)
	{
		var el = document.getElementById(obj);
	
		//postpone the linking for these sub items until the end of the function
		if (el.id != "sub2" && el.id != "sub3" && el.id != "sub7" && link != "")
		{
			//location.href = link;
		}
		else
		{
			var ar = document.getElementById("masterdiv").getElementsByTagName("span");  
			if(el.style.display != "block")
			{  
				for (var i=0; i<ar.length; i++)
				{
					if (ar[i].className.indexOf("childmenu") != -1)   
					{
						ar[i].style.display = "none";
					}
				}
				el.style.display = "block";
			}
			else
			{
				el.style.display = "none";
			}
		}
		
	}
	
	if (link != "")
	{
		//location.href = link;
	}
}

function goToURL(link)
{
	location.href = link;

}

function ShowMenu(obj)
{
	var arMenu = document.getElementById("masterdiv").getElementsByTagName("span");  

	
		var menuNum = (obj).charAt(3);
		
		for (var i=0; i<arMenu.length; i++)
		{
			if (arMenu[i].id.charAt(3) == menuNum || arMenu[i].id == obj)
			{
				arMenu[i].style.display = "block";
					
			}
		}
		
		// highlight the menu item for this page
		
		if (obj != "")
		{
			if (obj.indexOf("menu") != -1 || (obj.indexOf("sub") != -1 && obj.length == 4) )
		
			{
				var newObj = obj.replace("sub", "menu");
				MouseOverDiv(newObj);	
			}
			else
				MouseOverSpan(obj);
		}
}

function MouseOverDiv(obj)
{
	var el = document.getElementById(obj);
	var ar = document.getElementById("masterdiv").getElementsByTagName("div"); 
	var strMenuCode = getMenuCode();
	strMenuCode = strMenuCode.replace("sub", "menu");
	for (var i=0; i<ar.length; i++)
	{
		if (ar[i].id == el.id)
		{

			//don't change to hover class if this is the page we're on
			if ((el.id).toString() != strMenuCode)
			{
				ar[i].className = "menutitlehover";
			}
			else
			{
				ar[i].className = "menutitleOn";
			
			}
		}
	}
	
}

function MouseOutDiv(obj)
{
	var el = document.getElementById(obj);
	var ar = document.getElementById("masterdiv").getElementsByTagName("div"); 
	var strMenuCode = getMenuCode();
	strMenuCode = strMenuCode.replace("sub", "menu");

	for (var i=0; i<ar.length; i++)
	{
		if (ar[i].id == el.id)
		{
			//don't change to menutitle class if this is the page we're on
			if ((el.id).toString() != strMenuCode)
			{
				ar[i].className = "menutitle";
			}
			else
			{
				ar[i].className = "menutitleOn";
			}
		}
	}
	
}

function MouseOverSpan(obj)
{
	var el = document.getElementById(obj);
	var ar = document.getElementById("masterdiv").getElementsByTagName("a"); 
	var strMenuCode = getMenuCode();

	for (var i=0; i<ar.length; i++)
	{
		if (ar[i].id == el.id)
		{
			//don't change to hover class if this is the page we're on
			if ((el.id).substr(3,2) != strMenuCode.substr(3,2))
			{
				ar[i].className = "childmenuitemhover";
			}
			else
				ar[i].className = "childmenuitemOn";
			
		}
	}
	
}

function MouseOutSpan(obj)
{
	var el = document.getElementById(obj);
	var ar = document.getElementById("masterdiv").getElementsByTagName("a");
	var strMenuCode = getMenuCode();
 
	for (var i=0; i<ar.length; i++)
	{
		
		if (ar[i].id == el.id)
		{
			//don't change to menutitle class if this is the page we're on
			if ((el.id).substr(3,2) != strMenuCode.substr(3,2))
			{
				ar[i].className = "childmenuitem";
			}
			else
				ar[i].className = "childmenuitemOn";
		}
	}	
	
}


		
