var openNav = null;
var theDiv = null;
var cont = null;
var topBar = null;
var navCont = null;
var menuInt = null;

function swapImg(img,name,state){
	
	theDiv = document.getElementById(name + "Drop");
	cont = document.getElementById("visitorNav");
	topBar = document.getElementById("TopBar");
	navCont = document.getElementById("GlobalNavigationWrapper");
	
	if(openNav && state == "On"){
		hideDiv();
	}

	if(theDiv && state == "On"){
		showDiv(img, 0, name);
	} else if(theDiv && state == "Off"){
		openNav = theDiv;
		startTO();
	}
}

function showDiv(img, paddingTop, buttonName){
	if(buttonName == "ourProducts"){
		theDiv.style.left = topBar.offsetLeft + img.offsetLeft +"px";
	}
	else{
		theDiv.style.left = (topBar.offsetLeft + img.offsetLeft)+1 +"px";
	}
	theDiv.style.top = paddingTop + topBar.offsetTop + cont.offsetTop + img.offsetTop + img.offsetHeight +"px";
	theDiv.style.display = "block";
}

function hideDiv(){
	if(openNav){
		openNav.style.display = "none";
		window.clearTimeout(menuInt);
		openNav = null;
	}
}

function clearTO(){
	window.clearTimeout(menuInt);
}

function startTO(){
	window.clearTimeout(menuInt);
	menuInt = window.setTimeout("hideDiv()",1000);
}