var set_id='';
var closetimer	= 0;
var timeout_time=10000;

function changeButton(set_button,set_action) {
if (set_action=='over') {
set_button.className='submit_over';
} else {
set_button.className='submit';
}
}
function goToLink(set_url,sub_nav_id) {
//alert(document.getElementById(sub_nav_id).className);
if (document.getElementById(sub_nav_id).className=='show') {
location.href=set_url;
}


}

function toggleMenu(objID) {
if (!document.getElementById) return;
var ob = document.getElementById(objID).style;
ob.display = (ob.display == 'block')?'none': 'block';
}

function hideAllMenus (total_items) {
	for (i=1;i<=total_items;i++) {
	var menu_item='menu_'+i;
	 var each_div=eval("document.getElementById(menu_item)");
	 each_div.className = 'hide';
	 
	}
	return false;
}

function showHideMenu(theid,total_items,timeout_time){
	set_id=document.getElementById(theid);

//window.setTimeout ("set_id.style.visibility='hidden'", timeout_time);
	if (document.getElementById) {
		if (document.getElementById(theid)) {
	    	var switch_id = document.getElementById(theid);
		}

		for (i=1;i<=total_items;i++) {
			if ('menu_'+i!=theid) {
			//alert('menu_'+i+'|'+theid);
			//eval("document.getElementById(i)")
			//var field_var_name=eval("xmlDoc.documentElement.childNodes("+start_num+").text");
			var menu_item='menu_'+i;
			 var each_div=eval("document.getElementById(menu_item)");
			 each_div.className = 'hide';
			} else {
			//setInvisible(theid);
			}
			//return true;
		}


			if (switch_id) {
			
           		switch_id.className = 'show';
				//window.setTimeout ("set_id.className = 'hide_alt'", timeout_time);
				//return Start();
				
				
		   	} else {
			//window.setTimeout ("set_id.className = 'hide_alt'", timeout_time);
			}
			
			

		return true;
    }
	
}

function showITBS(theid,total_items) {
if (document.getElementById(theid)) {
	    	var switch_id = document.getElementById(theid);
		}

for (i=1;i<=total_items;i++) {
	if ('grade_'+i!=theid) {
	var grade_item='grade_'+i;
	 var each_div=eval("document.getElementById(grade_item)");
	 each_div.className = 'hide';
	}
	//return true;
		}
}

function setInvisible(hide_id) {
window.setTimeout ("document.getElementById('menu_1').className = 'hide'", timeout_time);
return true;
}

function hideMenu(theid){

	if (document.getElementById) {
		if (document.getElementById(theid)) {
	    	var switch_id = document.getElementById(theid);
		}

		if (switch_id) {
           switch_id.className = 'hide';
		 }
    }
	
}

function mcancelclosetime() {
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

function mclosetime(set_id) {
	closetimer = window.setTimeout("set_id.className = 'hide'", 30000);
}

function showHide(theid){

    if (document.getElementById) {
		if (document.getElementById(theid)) {
	    	var switch_id = document.getElementById(theid);
		}
//alert(switch_id.className);
	if(switch_id.className != 'show') {
			if (switch_id) {
           		switch_id.className = 'show';
				
		   	}

		   
        } else {
			if (switch_id) {
           switch_id.className = 'hide';
		   }

        }
		return false;
    }
	
}
function showHideTR(theid){

    if (document.getElementById) {
		if (document.getElementById(theid)) {
	    	var switch_id = document.getElementById(theid);
		}
//alert(switch_id.className);
	if(switch_id.className != 'show_tr') {
			if (switch_id) {
           		switch_id.className = 'show_tr';
				
		   	}

		   
        } else {
			if (switch_id) {
           switch_id.className = 'hide_tr';
		   }

        }
		return false;
    }
	
}
function resizeFont(font_action) {
if (font_action=='decrease') {
document.body.style.fontSize='smaller';
} else if (font_action=='increase') {
document.body.style.fontSize='larger';
} else if (font_action=='largest') {
document.body.style.fontSize='1.5em';
} else {
document.body.style.fontSize='1em';
}
}

function PopUpWindow(url,width,height,resize,tool,menu)
{
var newwindow;
newwindow=window.open(url,'','scrollbars=yes,height='+height+',width='+width+',resizable=yes,toolbar='+tool+',location=no,status=no,menubar='+menu+'');

	if (window.focus) {
	newwindow.focus();
	}
	return false;
}

function changeContact(field_val) {
//alert(field_val);
document.contact_list.id.value=field_val;
}


var timerID = 0;
var tStart  = null;

function UpdateTimer() {
   if(timerID) {
      clearTimeout(timerID);
      clockID  = 0;
   }

   if(!tStart)
      tStart   = new Date();

   var   tDate = new Date();
   var   tDiff = tDate.getTime() - tStart.getTime();

   tDate.setTime(tDiff);

   document.theTimer.theTime.value = "" 
                                   + tDate.getMinutes() + ":" 
                                   + tDate.getSeconds();
   
   timerID = setTimeout("UpdateTimer()", 1000);
}

function Start() {
   tStart   = new Date();

   document.theTimer.theTime.value = "00:00";

   timerID  = setTimeout("UpdateTimer()", 1000);
}

function Stop() {
   if(timerID) {
      clearTimeout(timerID);
      timerID  = 0;
   }

   tStart = null;
}

function Reset() {
   tStart = null;

   document.theTimer.theTime.value = "00:00";
}
