﻿// JScript File
window.isIE = true;
window.isKHTML = false;
window.isMac = false;

if (navigator.appName.indexOf('Microsoft') == -1)
{
	window.isIE = false;
}

if(navigator.userAgent.indexOf('Safari')  > -1)
{
   window.isMac = true;   
}
// non-Safari KHTML browser 
else if (navigator.userAgent.indexOf('KHTML') > -1)
{
	window.isKHTML = true;
}

window.contentId = null;
window.activeTop = null;
window.activeSub = null;
window.activeLi = null;
window.hideTimeout = null;
window.currentTopNav = null;
window.hoverTimeout = 300;
	function showMenuNav(parentId, childId, force , posX , posY)
	{		
		if(force == 1)
		{			
			hideMenuNav();
		}
		else if(window.activeTop != null) return;
		window.clearInterval(window.hideTimeout);
		window.hideTimeout = null;
		
		var subNav = document.getElementById(childId);
		var parent = document.getElementById(parentId);

		//parent.className = "topNav_on";		
		//window.activeTop = parent;
		if(!posX) posX = 0;
		if(!posY) posY = 0;
		
		if(subNav != null)
		{
			var parent_bottom = findPosYY(parent) + parent.offsetHeight;
			var parent_x_position = findPosXX(parent);
			if(isIE)
			{
				subNav.style.left = (parent_x_position + (posX)) + 0 + "px";
				subNav.style.top = (parent_bottom + (posY) + -5) + "px";
			}
			else
			{									
				subNav.style.left = (parent_x_position + (posX)) + 0 + "px";
				subNav.style.top = (parent_bottom + (posY) - 5) +  "px";				
			}
			subNav.style.visibility="visible";
			window.activeSub = subNav;
		}
		
	}
	
	function hideMenuNav()
	{
		window.clearInterval(window.hideTimeout);
		window.hideTimeout = null;
		
		if (window.activeTop != null)
		{
			window.activeTop.className = "topNav";
			window.activeTop = null;
		}
		if (window.activeSub != null)
		{
			window.activeSub.style.visibility="hidden";
			window.activeSub = null;
		}
		
		// return to current page highlight if one is specified
		if(window.currentTopNav != null)
		{
			window.currentTopNav.className = "topNav_on";
			window.activeTop = window.currentTopNav;
		}
	}
    function startHideTimeout()
    {
	    window.clearInterval(window.hideTimeout);
	    window.hideTimeout = null;
	    window.hideTimeout = window.setInterval("hideMenuNav()", window.hoverTimeout);
    }
    function findPosXX(obj)
	{
		var curleft = 0;
		if (obj.offsetParent)
		{
			while (obj.offsetParent)
			{
				curleft += obj.offsetLeft
				obj = obj.offsetParent;
			}
		}
		else if (obj.x)
			curleft += obj.x;
		return curleft;
	}
	
	function findPosYY(obj)
	{
		var curtop = 0;
		if (obj.offsetParent)
		{
			while (obj.offsetParent)
			{
				curtop += obj.offsetTop
				obj = obj.offsetParent;
			}
		}
		else if (obj.y)
			curtop += obj.y;
		return curtop;
	}

