var currentNav = null;
var navFrom = null;
var mainNavTimeOut = null;
var subNavTimeOut = null;

function setCurrent() {
	currentNav = null;
}

function hide(layerToShow,origin) {
	var layer = document.getElementById(layerToShow);
	layer.style.visibility = "hidden";	  
}

function show(layerToShow) {
	var layer = document.getElementById(layerToShow);
	layer.style.visibility = "visible";	  
}

function on_main_nav(layerToShow) {
	clearTimeout(subNavTimeOut);	
	clearTimeout(mainNavTimeOut);
	show (layerToShow);	
	if ((currentNav != null) && (currentNav != layerToShow)) {
		hide(currentNav);		
	}
	if ((navFrom != null) && (navFrom != layerToShow)) {
		hide(navFrom);
	}
	currentNav = layerToShow;
}

function off_main_nav(layerToShow) {
	mainNavTimeOut = setTimeout("hide('" + layerToShow + "','main'); currentNav = null", 200);
}

function on_fly_nav(layerToShow) {
	show(layerToShow);	
	clearTimeout(subNavTimeOut);	
	clearTimeout(mainNavTimeOut);
	navFrom = null;	
}

function off_fly_nav(layerToShow) {
	subNavTimeOut = setTimeout("hide('" + layerToShow + "')",200);
	currentNav = null;
	navFrom = layerToShow;
}
