

function popupWindow(filename, hlpwidth, hlpheight){
	var winL=120, winT=50;
	if (parseInt(navigator.appVersion)>3) {
/*		if (navigator.appName=="Netscape") {
			winL = window.screenLeft + ((window.innerWidth - hlpwidth) / 2);
			winT = window.screenTop + ((window.innerHeight - hlpheight) / 2);
	}*/
		if (navigator.appName.indexOf("Microsoft")!=-1) {
			winL = window.screenLeft + ((document.body.offsetWidth - hlpwidth) / 2);
			winT = window.screenTop + ((document.body.offsetHeight - hlpheight) / 2);
		}
	}
	help_window = window.open( filename, "_blank", "left=" + winL + ",top=" + winT + ",width=" + hlpwidth + ",height=" + hlpheight + ",resizable=0,scrollbars=0,toolbar=0,status=0,location=0,directories=0,menubar=0");
	help_window.focus();
	return false;
}

function popupWindowScroll(filename, hlpwidth, hlpheight){
	var winL=120, winT=100;
	if (parseInt(navigator.appVersion)>3) {
/*		if (navigator.appName=="Netscape") {
			winL = window.screenLeft + ((window.innerWidth - hlpwidth) / 2);
			winT = window.screenTop + ((window.innerHeight - hlpheight) / 2);
	}*/
		if (navigator.appName.indexOf("Microsoft")!=-1) {
			winL = window.screenLeft + ((document.body.offsetWidth - hlpwidth) / 2);
			winT = window.screenTop + ((document.body.offsetHeight - hlpheight) / 2) - 25;
		}
	}
	help_window = window.open( filename, "_blank", "left=" + winL + ",top=" + winT + ",width=" + hlpwidth + ",height=" + hlpheight + ",resizable=1,scrollbars=1,toolbar=0,status=0,location=0,directories=0,menubar=0");
	help_window.focus();
	return false;
}

function openHelp(filename, hlpwidth, hlpheight){
	help_window = window.open( filename, "help_window", "left=120,top=50,width=" + hlpwidth + ",height=" + hlpheight + ",resizable=0,scrollbars=1,toolbar=0,status=0,location=0,directories=0,menubar=0");
	help_window.focus();
}

function deleteChrs(s){
	var i;
	var sDone = "";
	for (i = 0; i < s.length; i++){
		var c = s.charAt(i);
		if ((c >= "0") && (c <= "9")) sDone += c;
	}
	return sDone;
}

function checkUSPhone(txtPhone){
	if (txtPhone.value!=''){  
		var phone = deleteChrs(txtPhone.value)
		var phonelen = phone.length
		if(phonelen < 10){
			txtPhone.value = "";
			return;
		}
		if(phone.substring(0,1)=='1'){phone = phone.substring(1,15); phonelen = phone.length;}
		txtPhone.value = "(" + phone.substring(0,3) + ") " + phone.substring(3,6) + "-" + phone.substring(6,10)
		if(phonelen>10){ txtPhone.value += " x " + phone.substring(10,14); }
	}
	return;
}

function checkSS(txtSS){
	if (txtSS.value!=''){  
		var ss = deleteChrs(txtSS.value)
		var sslen = ss.length
		if(sslen < 9){
			txtSS.value = "";
			return;
		}
		txtSS.value = ss.substring(0,3) + "-" + ss.substring(3,5) + "-" + ss.substring(5,9)
	}
	return;
}

function textToCapital(txtObj) {
	var str = txtObj.value, chrprev=' ', strf='';
	for(var i=0; i<str.length; i++){
		var c=str.charAt(i);
		if((chrprev==' ') || (chrprev=='.') || (chrprev=='-') || (chrprev=='/')){
			if((c!=' ') || (chrprev!=' ')){strf+=c.toUpperCase();}
		}else{
			strf+=c.toLowerCase();
		}
		chrprev=c;
	}
	txtObj.value=strf;
}

function textToSentence(txtObj) {
	var str = txtObj.value, chrprev='', strf='';
	for(var i=0; i<str.length; i++){
		var c=str.charAt(i);
		if((chrprev=='') || (chrprev=='.') || (chrprev=='!') || 
			(chrprev=='?') || (chrprev=='\n')){strf+=c.toUpperCase();}else{strf+=c;}
		if(c!=' '){chrprev=c;}
	}
	txtObj.value=strf;
}

function textToAllCapital(txtObj) {
	var str = txtObj.value;
	txtObj.value = str.toUpperCase();
}

function helpFlip(imgobj, action){
	imgobj.src=document["help_" + action].src;
}

function menuClick(mnuID, isDown){
	menuClicked=isDown;
	menuHighlight(mnuID, 1);
}

function menuHighlight(mnuID, inRow){
	if(inRow==0){menuClicked=0;}
	document.getElementById('menu_' + mnuID).style.backgroundColor = (inRow) ? (menuClicked) ? "#99CCFF" : "E5E5E5" : "#FAFAFA";
}

function menuFlip(mnuID, mnuState){
	document["menu_" + mnuID].src = document["menu_" + mnuID + "_" + mnuState].src;
}

function tabHighlight(objID, inRow){
	var row = document.getElementById('tab_' + objID);
	row.style.backgroundColor = (inRow) ? "#D5D5D5" : "#E5E5E5";
	//"#E5E5E5" : "#FAFAFA";
}

function zipcode_onChange(){
	document.frmdata.actID.value="zip";
	document.frmdata.submit();
}

function getBrowser(){
  if (document.layers) return "NS";
  if (document.all) {
		var agt=navigator.userAgent.toLowerCase();
		var is_opera = (agt.indexOf("opera") != -1);
		if(is_opera) { return "OPR"; } else { return "IE"; }
  }
  if (document.getElementById) return "MOZ";
  return "OTHER";
}

function main_mnu_hl(mnutype,tabid,htyesno){
	var nm;
	if (htyesno=='1'){nm="over";}else{nm="norm";}
	document.getElementById("main_" + mnutype + "_left_" + tabid).src = document["main_" + mnutype + "_left_" + nm].src
	document.getElementById("main_" + mnutype + "_right_" + tabid).src = document["main_" + mnutype + "_right_" + nm].src
	document.getElementById("main_" + mnutype + "_cntr_" + tabid).background = document["main_" + mnutype + "_cntr_" + nm].src	
}
