
function extractPageName(hrefString)
{
	var arr = hrefString.split('/');
	return  (arr.length < 2) ? hrefString : arr[arr.length-2].toLowerCase() + arr[arr.length-1].toLowerCase();
}
 
function setActiveMenu(arr, crtPage)
{
	for (var i=0; i < arr.length; i++)
	{
		var current = arr[i]
		/*this makes every li that contains a list a higher z-index than any other li */
		if(current.parentNode.parentNode.parentNode.parentNode.tagName =="UL"){
			current.parentNode.parentNode.parentNode.style.zIndex= "200"-i;
		}
		if(extractPageName(current.href) == crtPage)
		{
			//this catchs any parent heading should there be duplicates 
			if(i < arr.length-1 && extractPageName(arr[i+1].href) == crtPage){
				continue;
			}
			if (current.parentNode.tagName != "DIV")
			{
	current.className = "current"; 
	current.parentNode.className = "current";
				//make sure it's the subNavMenu that you're changing (otherwise you kill the css on the outter one)
				//expression is anchor tag.li.ul.li.ul
				if(current.parentNode.parentNode.parentNode.parentNode.tagName =="UL"){
					current.parentNode.parentNode.parentNode.style.position="static";
					current.parentNode.parentNode.className = "currentSubMenu";
					break;
				}
			}
		}
	}
}
  
function highlightNav()
{

	hrefString = document.location.href ? document.location.href : document.location;
	if (document.getElementById("Navigation") !=null ){
			setActiveMenu(document.getElementById("Navigation").getElementsByTagName("a"), extractPageName(hrefString));
	}
}
