

// This script hides all the sub menus when move is moved out of the menu area or clicked on the area out of the menu area.
var upperY;
var lowerY;
// Check for browser 
if (document.all) {
	n=0;ie=1;ns6=0;
	}
if (document.getElementById&&!document.all){
	n=0;ie=0;ns6=1;
	}
if (document.layers){
	n=1;ie=0;ns6=0;
	}
// Traps mouse events and movements	
if (ie||ns6)
{ 
	document.onclick = allOff;
	document.onscroll=allOff;
	document.onmousemove=updateIt;
}
if (document.layers)
{
	window.captureEvents(Event.MOUSEMOVE);
	//window.captureEvents(Event.CLICK);
	window.onmousemove= updateIt;
	window.onclick=allOff
}

// Function checks for x and y co-ordinates and hides sub menus.
function updateIt(e)
{ 
	//upperY = 0;
	//lowerY = upperY + 600;
	
	if (ie)
	{
		var x = window.event.clientX;
		var y = window.event.clientY;

		if (x > 1200 || x < 1) {  allOff();}
		else if (y > lowerY  || y < upperY ) allOff();
	}
	if (n||ns6)
	{
		var x = e.pageX;
		var y = e.pageY;

		if (x > 1200 || x < 1) allOff();
		else if (y > lowerY   || y < upperY) allOff();
	}
}

// This function assigns upper and lower y positions.
function setUpperY( )
{ 
	
	if (ie)
	{
		upperY = window.event.clientY;
		upperY = upperY - 20;
		lowerY = upperY + 150;
	}
	
	if (n||ns6)
	{
		//upperY = window.Event.pageY;
		upperY = 30
		lowerY = 520;
	}
}

