//common javascript functions : 04/04/2003 Leslie Lee
//dependencies: validate.js

//PRIVATE global variable to represent display block
var iBlock = 1;
var menuSub;
var menuSide;

//PUBLIC submit form with validation
function validateSubmitForm(frm){
	if(validateForm(frm)) frm.submit();
}

//PUBLIC submit form without validation
function submitForm(frm){
	frm.submit();
}

//PRIVATE display passed id
function show(id){
	if(document.all) {
		document.all[id].style.display = 'block';
	}else{
		var oDiv=document.getElementById(id);
		oDiv.style.display = 'block';
	}
}

//PRIVATE hide passed id
function hide(id){
	if(document.all) {
		document.all[id].style.display = 'none';
	}else{
		var oDiv=document.getElementById(id);
		oDiv.style.display = 'none';	
	}
}

//PRIVATE hide all ids
function hideAll(id,iLength){
var sID
var s = id.charAt(0);
	for(var i=1;i<iLength+1;i++){
		sID = s+i;
		hide(sID);
	}
}

//PUBLIC display selected block and hide all others
function displayBlock(id,iMax){
	iBlock = parseInt(id.substr(1));
	hideAll(id,iMax);
	show(id);
}

//PUBLIC show previous section
function showPrev(s,iMax){		
var sID
	if(iBlock > 1){
		sID = s+(iBlock-1);
		displayBlock(sID,iMax);
	}
}

//PUBLIC show next section
function showNext(s,iMax){
var sID
	if(iBlock < iMax){
		sID = s+(iBlock+1);
		displayBlock(sID,iMax);
	}
}

//PUBLIC resets client logo
function resetClient(strHTML){
var oDiv=document.getElementById('headerLeft');
	if(oDiv){
		oDiv.innerHTML = strHTML;	
	}
}

//PUBLIC launches generic window
function launchWindow(strURL,intX,intY,intH,intW){
	var win = window.open(strURL,null,"height="+intH+",width="+intW+",top="+intY+",left="+intX+",status=no,toolbar=no,menubar=yes,location=no,resizable=yes,scrollbars=yes");
		win.focus(); 

}

//PUBLIC launches generic window with an alert to print in landscape
function launchLandscapeWindow(strURL,intX,intY,intH,intW){
	var win = window.open(strURL,null,"height="+intH+",width="+intW+",top="+intY+",left="+intX+",status=no,toolbar=no,menubar=yes,location=no,resizable=yes,scrollbars=yes");
		alert("for best results change your printer settings to landscape before printing");
		win.focus(); 
}

//PUBLIC launches print window
function launchPrint(strURL){
	var win = window.open(strURL,null,'height=400,width=600,top=200,left=200,status=no,toolbar=yes,menubar=yes,location=no,resizable=yes,scrollbars=yes');
}

//PUBLIC launches calendar window
function launchCalendar(strURL,intX,intY){
	var winCalendar = window.open(strURL,null,"height=120,width=180,top="+intY+",left="+intX+",status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no");
		winCalendar.focus();
}

//--added as part of www site redesign and dynamic menus--//
//PUBLIC clears all timeouts for hiding divs on the page
function stay(){
	clearTimeout(menuSub);
	clearTimeout(menuSide);
}

//PUBLIC sets timeouts to hide all open menus on the page
function leave(maxSub,maxSide){
	menuSub = setTimeout("hideAll('z',"+maxSub+")",1000);
	menuSide = setTimeout("hideAll('x',"+maxSide+")",1000);
}

//PUBLIC sets element style class
function setClass(id,sClass){
	if(document.all) {
		document.all[id].className = sClass;
	}else{
		var oDiv=document.getElementById(id);
		oDiv.className = sClass;	
	}
}

//PUBLIC gets element style class
function getClass(id){
var sClass;
	if(document.all) {
		sClass = document.all[id].className;
	}else{
		var oDiv=document.getElementById(id);
		sClass = oDiv.className;	
	}
	alert(sClass);
}

