
//* --> DHTML variables for MAIN Nav
var layerRef, layerStyle, visible, invisible, width, height, imageOn = "", menuName = "";

//* --> LAYER SWITCHING CODE
if (document.all) {
	document.onmousemove = mouseMove;
	layerRef= "document.all['";
	layerStyle = "'].style";
	visible = "visible";
	invisible = "hidden"; 
	width = ".width";
	height = ".height";
} else if (document.getElementById) {
	document.body.onmousemove = mouseMove;
	layerRef = "document.getElementById('";
	layerStyle = "').style";
	visible = "visible";
	invisible = "hidden"; 
	width = ".width";
	height = ".height";
}
	
function mouseMove(e) {
	if (document.all) {
		menuOff(event.x, event.y);
	} else if (document.getElementById) {
		menuOff(e.pageX, e.pageY);
	}
}

function hide(layerName) {
	eval(layerRef + layerName + layerStyle + ".visibility='" + invisible + "'");
}

function show(layerName) {
	eval(layerRef + layerName + layerStyle + ".visibility='" + visible + "'");
}

function menuOn(lName){
	if (document.all || document.getElementById) {
		if (menuName.length) {
			hide(menuName);
		}
		menuName = lName;
		show(menuName);
	}
}

function menuOff(xcoord, ycoord) {
	var left, right, top, bottom;
	if (menuName.length) {
		left = parseInt(eval(layerRef + menuName + layerStyle + ".left"));
		right = left + parseInt(eval(layerRef + menuName + layerStyle + width));
		top = parseInt(eval(layerRef + menuName + layerStyle + ".top"));
		bottom = top + parseInt(eval(layerRef + menuName + layerStyle + height));
		if ((xcoord <= left) || 
			(xcoord >= right) || 
			(ycoord <= top - 20) || 
			(ycoord >= (1.25 * bottom))) {
			hide(menuName);
			menuName = "";
		}
	}
}
