// determining the browser
isNS4 = (document.layers) ? true : false;
isIE4 = (document.all && !document.getElementById) ? true : false;
isIE5 = (document.all && document.getElementById) ? true : false;
isNS6 = (!document.all && document.getElementById) ? true : false;

var callAgain = 1;
var bottom = 230;

// checks to see if the mouse has moved and then calls a function
if (isIE4 || isIE5)
{
	document.body.onmousemove = ieHide;   
}
else if (isNS4 || isNS6) 
{
	document.captureEvents(Event.MOUSEMOVE);
	document.onmousemove = nnHide;
}
// end cursor check

function ShowSub(divnum)
{
	// getting the old div id
	if(document.all)
	{
		OldDivId = document.all.hidDivId.value;
	}
	else
	{
		OldDivId = document.form1.hidDivId.value;
	}
	
	// this sets the bottom variable depending on which menu
	// item mouseover event has called
	if(divnum == 1)
	{
		bottom = 170;
	}
	else if(divnum == 2)
	{
		bottom = 140;
	}
	else if(divnum == 3)
	{
		bottom = 145;
	}

	// setting a var to the div currently being shown(if there is one) 
	// and hiding it to show the next one that has been chosen
	if(OldDivId != 0)
	{
		if (isIE4)
		{
			OldDivName = eval("document.all.DivSub" + OldDivId + ".style");   
		}
		else if (isNS4) 
		{
			OldDivName = eval("document.DivSub" + OldDivId);
		}
		else if (isIE5 || isNS6) 
		{
		   OldDivName = document.getElementById("DivSub" + OldDivId);
		   OldDivName = OldDivName.style;
		}
		OldDivName.visibility = "hidden";
	}
	
	if(divnum != 0)
	{
		// setting vars to the div
		if (isIE4)
		{
			CurrentDivName = eval("document.all.DivSub" + divnum + ".style");   
		}
		else if (isNS4) 
		{
			CurrentDivName = eval("document.DivSub" + divnum);
		}
		else if (isIE5 || isNS6) 
		{
			CurrentDivName = document.getElementById("DivSub" + divnum);
			CurrentDivName = CurrentDivName.style;
		}

		// this is the code it hide/unhide the div's
		if(CurrentDivName.visibility == "hidden" || CurrentDivName.visibility == "hide")
		{
			CurrentDivName.visibility = "visible";
		}
		else
		{
			CurrentDivName.visibility = "hidden";
		}
	
		// set the hidden field to the current div number
		if(document.all)
		{
			document.all.hidDivId.value = divnum;
		}
		else
		{
			document.forms[0].hidDivId.value = divnum;
		}
	}
}

// functions to call on the onmousemove functions
function ieHide() //Internet Explorer Code
{
	if (event.clientY >= bottom)
	{
		if (callAgain)
		{
			callAgain = 0;
			OldDivId = document.all.hidDivId.value;
			if(OldDivId != 0)
			{
				if (isIE4)
				{
					CurrentDivName = eval("document.all.DivSub" + OldDivId + ".style");   
				}
				else if (isNS4) 
				{
					CurrentDivName = eval("document.DivSub" + OldDivId);
				}
				else if (isIE5 || isNS6) 
				{
					CurrentDivName = document.getElementById("DivSub" + OldDivId);
					CurrentDivName = CurrentDivName.style;
				}

				CurrentDivName.visibility = "hidden";
			}
		}
	}
	else
	{
		callAgain = 1;
	}
}

function nnHide(evt) //Internet Explorer Code
{
	if (evt.pageY >= bottom)
	{
		if (callAgain)
		{
			callAgain = 0;
			OldDivId = document.forms[0].hidDivId.value;
			if(OldDivId != 0)
			{
				if (isIE4)
				{
					CurrentDivName = eval("document.all.DivSub" + OldDivId + ".style");   
				}
				else if (isNS4) 
				{
					CurrentDivName = eval("document.DivSub" + OldDivId);
				}
				else if (isIE5 || isNS6) 
				{
					CurrentDivName = document.getElementById("DivSub" + OldDivId);
					CurrentDivName = CurrentDivName.style;
				}
				CurrentDivName.visibility = "hidden";
			}
		}
	}
	else
	{
		callAgain = 1;
	}
}

function ShowText(divnum)
{
	// getting the old div id
	if(document.all)
	{
		OldDivId = document.all.hidTextId.value;
	}
	else
	{
		OldDivId = document.forms[0].hidTextId.value;
	}
	
	// setting a var to the div currently being shown(if there is one) 
	// and hiding it to show the next one that has been chosen
	if(OldDivId != 0)
	{
		if (isIE4)
		{
			OldDivName = eval("document.all.BodyMenu" + OldDivId + ".style");   
		}
		else if (isNS4) 
		{
			OldDivName = eval("document.BodyMenu" + OldDivId);
		}
		else if (isIE5 || isNS6) 
		{
		   OldDivName = document.getElementById("BodyMenu" + OldDivId);
		   OldDivName = OldDivName.style;
		}
		OldDivName.visibility = "hidden";
	}
	
	if(divnum != 0)
	{
		// setting vars to the div
		if (isIE4)
		{
			CurrentDivName = eval("document.all.BodyMenu" + divnum + ".style");   
		}
		else if (isNS4) 
		{
			CurrentDivName = eval("document.BodyMenu" + divnum);
		}
		else if (isIE5 || isNS6) 
		{
			CurrentDivName = document.getElementById("BodyMenu" + divnum);
			CurrentDivName = CurrentDivName.style;
		}

		// this is the code it hide/unhide the div's
		if(CurrentDivName.visibility == "hidden" || CurrentDivName.visibility == "hide")
		{
			CurrentDivName.visibility = "visible";
		}
		else
		{
			CurrentDivName.visibility = "hidden";
		}
	
		// set the hidden field to the current div number
		if(document.all)
		{
			document.all.hidTextId.value = divnum;
		}
		else
		{
			document.forms[0].hidTextId.value = divnum;
		}
	}
}
		
	
