var menuStayTimer;

var winW = 0;
var winH = 0;

var mobgcolor = "#dfdfdf";

function calcWindowWidth(){
if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName=="Netscape") {
  winW = window.innerWidth;
  winH = window.innerHeight;
 }
 if (navigator.appName.indexOf("Microsoft")!=-1) {
  winW = document.body.offsetWidth;
  winH = document.body.offsetHeight;
 }
}
}

function hideMenu(){
	menuStayTimer = setTimeout("hideMenuDiv();",1000);
}

function hideMenuDiv(){
	var myDiv = document.getElementsByTagName("div");
	for(var x=1; x<myDiv.length; x++){
		if(myDiv[x].id.substring(0,9)=="menuItems"){
			myDiv[x].style.display = "none";		
		}
	}
}

function showDropDownMenu(control){

	control = document.getElementById(control.id.substring(0,control.id.length-1) + "b");
	var divName = control.id.substring(0,control.id.length-1);
	if(control.id.substring(0,4) != "home"){
		var el = document.getElementById("menuItems_"+divName);
		clearTimeout(menuStayTimer);
		hideMenuDiv();
		el.style.left = findXPos(control) - 5; 
		el.style.top = findYPos(control) + control.offsetHeight - 1;
		el.style.display = "block";
		calcWindowWidth();
		if((findXPos(control) + el.offsetWidth) > winW){
			el.style.left = findXPos(control) - el.offsetWidth + control.offsetWidth + 5;
		}
		
		if(el.style.left < 0){
			el.style.left = 0;
		}
		
	}
}

function menuOver(){
	clearTimeout(menuStayTimer);
}





	
