var currentMenu = -1;
var menuTimeout = -1;
var navOn = -1;

function openUrl(l)
{
	var s = document.getElementsByTagName("base")[0].href + l;
	window.location.href = s.replace(/\/.\//, "/")
}

function setNavRoll(o)
{
	o.className = "menuRoll";
	showDropDownMenu(o.id.substring(4));
}
		
function setNavOff()
{
	if (document.getElementById("menu"+currentMenu+"dropdown"))
		menuTimeout = setTimeout("hideDropDownMenu()", 200);
	else
		hideDropDownMenu();
}

function setNavOn(i)
{
	document.getElementById("menu"+i).className = "menuOn";
	navOn = i;
}

function showDropDownMenu(i)
{
	var o;
			
	clearClose();
	if (i == currentMenu)
		return;

	hideDropDownMenu(currentMenu);

	currentMenu = i;
	o = document.getElementById("menu"+i+"dropdown");
	if (o)
		o.style.display = "inline";
}

function hideDropDownMenu()
{
	var o;
			
	if (currentMenu == -1)
		return;

	clearClose();
	
	if(currentMenu != navOn)
		document.getElementById("menu"+currentMenu).className = "menu";
	else
		document.getElementById("menu"+currentMenu).className = "menuOn";

	o = document.getElementById("menu"+currentMenu+"dropdown");
	if(o)
		o.style.display = "none";

	currentMenu = -1;
}
		
function clearClose()
{
	if (menuTimeout == -1)
		return;
	clearTimeout(menuTimeout);
	menuTimeout = -1;
}

function subnavRoll(o)
{
	if(o.className != "subnavOn")
	{
		o.oldClassName = o.className;
		o.className = "subnavRoll";
	}
}

function subnavReset(o)
{
	if(o.oldClassName)
		o.className = o.oldClassName;
}