var lastMenu;
var lastSubMenu;
var imgObj;
var timerID;
var lastHighlight;
window.onresize = hideMenu;

function startTimer(){
	if(timerID==null){
		timerID = window.setTimeout('hideMenu()',1000);
	}
}

function stopTimer(){
	if(timerID!=null){
		window.clearTimeout(timerID);
		timerID = null;
	}
}

function showMenu(imgNum){
	imgObj = document.images["button"+imgNum];
	xPos = getRealLeft(imgObj);
	yPos = getRealTop(imgObj);

	hideMenu();

	if(imgNum != null){
		var menu = "dhtml"+imgNum
		yPos = yPos + (parseInt(imgObj.height));

		if(imgNum <= 3){
			//xPos = xPos + (40);
		}else{
			//xPos = xPos - (160);
		}

		if(is_ie){
			eval(menu).style.left = xPos+"px";
			eval(menu).style.top = yPos+"px";
			eval(menu).style.visibility = 'visible';
		}else{
			document.getElementById(menu).style.left = xPos+"px";
			document.getElementById(menu).style.top = yPos+"px";
			document.getElementById(menu).style.visibility = 'visible';
		}
		lastMenu = imgNum;
	}
}

function showSubMenu(imgNum){
	if(imgNum != null){
		imgObj = document.images["button"+imgNum];
		xPos = getRealLeft(imgObj);
		yPos = getRealTop(imgObj);
	}

	hideSubMenu();

	if(imgNum != null){
		var menu = "dhtml"+imgNum
		yPos = yPos + (parseInt(imgObj.height));

		if(is_ie){
			eval(menu).style.left = xPos+"px";
			eval(menu).style.top = yPos+"px";
			eval(menu).style.visibility = 'visible';
		}else{
			document.getElementById(menu).style.left = xPos+"px";
			document.getElementById(menu).style.top = yPos+"px";
			document.getElementById(menu).style.visibility = 'visible';
		}
		lastSubMenu = imgNum;
	}
}

function hideMenu(){
	if(lastMenu != null){
		var menu = "dhtml"+lastMenu;
		if(is_ie){
			eval(menu).style.visibility = 'hidden';
		}else{
			document.getElementById(menu).style.visibility = 'hidden';
		}
	}
	hideSubMenu();
}

function hideSubMenu(){
	if(lastSubMenu != null){
		var menu = "dhtml"+lastSubMenu;
		if(is_ie){
			eval(menu).style.visibility = 'hidden';
		}else{
			document.getElementById(menu).style.visibility = 'hidden';
		}
	}
}

// LINK ROLLOVERS
function rollover(menuID, bkgColor, textColor){
	stopTimer();
	if(is_ie){
		eval(menuID).className = "menuLinksOver";
	}else{
		document.getElementById(menuID).className = "menuLinksOver";
		
		// NETSCAPE FIX
		if(lastHighlight != null && lastHighlight != menuID){
			document.getElementById(lastHighlight).className = "menuLinks";
		}
		lastHighlight = menuID;
	}
}

function rollout(menuID){
	if(is_ie){
		eval(menuID).className = "menuLinks";
	}else{
		document.getElementById(menuID).className = "menuLinks";
	}
	startTimer();
}
