var timesover=0;
var timerID = null;
//var boolFirstMenuFlag = true;
var boolTimerOn = false;
var intTimecount = 450;
var intRunCount = 0;
var intTabActive = 999;
var intNumTabs = 7;
var asTabs = new Array();
	asTabs[0] = "jero";
    asTabs[1] = "jero01";
	asTabs[2] = "jero02";
	asTabs[3] = "jero03";
	asTabs[4] = "jero04";
	asTabs[5] = "jero05";
	asTabs[6] = "jero06";
	

function doInitializeMenu() {
	for (i=0; i<intNumTabs; i++)
	{
			if(document.getElementById("menuitem-" + asTabs[i]).className=="mainmenuitem active")
				intTabActive = i;
	}
}
function settimeover(){
timesover=1;
}
function doMenuOn(id) {
	/* initialize the menu to figure out which tab is set to active */
	if (intRunCount < 1)
	{
		doInitializeMenu();
		intRunCount++;
	}

	
	//if (boolFirstMenuFlag == true)
	//{

		/*hide any menus that might be open*/
		if (document.getElementById("menuitem-" + id).className == "mainmenuitem active" && timesover==0)
		{
		//alert("active");
		timesover=1;
		}
		else
		{
		timesover=1;
		doHideAll();
		/* if statement to check if the submenu acutally exists, because the home menu doesn't have one */
		if(document.getElementById("submenu-" + id))
			document.getElementById("submenu-" + id).style.display = "block"; /*turn on the submenu*/
		
		/*change the style of the tab to the hover style*/	
		document.getElementById("menuitem-" + id).className = "mainmenuitem hover"; 
	
		/* stop the timer */
		doStopTime(); 
		}
	//}
}
function doMenuOff(id) {
for (i=0; i<intNumTabs; i++)
	{
			if(document.getElementById("menuitem-" + asTabs[i]).className=="mainmenuitem active")
				timesover=1;
	}


	/*start the timer */
	doStartTime(); 
}
function doSubMenuOn(){
	/* stop the timer */
	doStopTime(); 
}
function doSubMenuOff(){
	 /* start the timer */
	 doStartTime();
}
function doHideAll(){
	
	for (i=0; i<intNumTabs; i++)
	{
		/* if statement to check if the submenu exists before we try to hide it */
		if(document.getElementById("submenu-" + asTabs[i]))
			document.getElementById("submenu-" + asTabs[i]).style.display = "none"; /* hide the submenu */
		/*set all tabs to the inactive style */
		document.getElementById("menuitem-" + asTabs[i]).className="mainmenuitem inactive";
	}
	/*set the active tab to the active style*/
	if (intTabActive < 999)
	{
		document.getElementById("menuitem-" + asTabs[intTabActive]).className="mainmenuitem active";
	}
}
function doStopTime(){
	if (boolTimerOn){
		clearTimeout(timerID);
        timerID = null;
        boolTimerOn = false;
	}

}
function doStartTime(){
	if (boolTimerOn == false) {
		timerID=setTimeout( "doHideAll()" , intTimecount);
		boolTimerOn = true;
	}
}
function setcoords(){

if (document.newaccount.dropdowncountry.value=="Canada" || document.newaccount.dropdowncountry.value=="United States" || document.newaccount.txtpostalcode || document.newaccount.txtzipcode){
    var myPageX;
    var myPageY;
    if (document.all){
        myPageX = document.body.scrollLeft;
        myPageY = document.body.scrollTop;
        }
    else{
        myPageX = window.pageXOffset;
        myPageY = window.pageYOffset;
        }
    document.newaccount.PageX.value = myPageX;
    document.newaccount.PageY.value = myPageY;
    //alert(myPageX);
    //alert(myPageY);
    document.newaccount.submit();
    }
    }
    
 