// JavaScript Document

			// Common regular expressions
		var anyChk = new RegExp();
		var currencyChk = new RegExp("^[\\d]*[\\.]{1}[\\d]{2}$");
		var dateChk = new RegExp("^[01]?\\d/[0123]?\\d/[\\d]{2}$");         //simple date function: will accept 0/0/00 through 19/39/99
		var emailChk = new RegExp("^[^@]+[\\@]{1}([-\\w]+\\.)+[a-zA-Z]{2,4}$");
		var id9Chk = new RegExp("^\\w{3}-?\\w{2}-?\\w{4}$");
		var nullChk = new RegExp("\\S+");
		var numChk = new RegExp("^[\\d]+$");
		var phoneChk = new RegExp("^\\(?\\d{3}\\)?[ -\\.]?\\d{3}[ -\\.]?\\d{4}.*$");
		var ssnChk = new RegExp("^\\d{3}-?\\d{2}-?\\d{4}$");
		var stateChk = new RegExp("^[a-zA-Z]{2}$");
		var zipChk = new RegExp("^[\\d]{5}([-]{1}[\\d]{4})?$");
		
		var isDyn = isAll = isID = isLay = false;
		if (document.all) isAll = true;
		else if (document.getElementById) isID = true;
		else if ((navigator.appName.indexOf('Netscape') != -1) &&
		         (parseInt(navigator.appVersion) == 4)) isLay = true;
		if (isAll || isID || isLay) isDyn = true;
		
		var SeeCurr = "";   // current open menu item
		var cyclotron;
		
// ---------------------------------------------------------		
			// un-highlights a form field
		function b(o) {
			if (isAll||isID) o.style.backgroundColor = '#FFFFFF';
			else o.backgroundColor = '#FFFFFF';
		}
// ---------------------------------------------------------		
		  // swap background color
		function bgcolor(obj) {
		  if (isAll || isID) obj = obj.style;
			obj.background = (obj.background == "#999999")?"#CCCCCC":"#999999";
		}
// ---------------------------------------------------------		
			    // disables/enables a span group
		function Dis(n,tf,f){     // n = span name; tf = true/false; f = related form fields, space delimited
		  if (n) {
  			obj = findObj(n);
	  		obj.disabled = tf;
			}
			if (f) {
  			objA = new Array();
				objA = f.split(' ');
	  		for (x=0; x<objA.length; x++) {
//				  obj = findObj(objA[x])||formObj(objA[x]);
				  obj = formObj(objA[x]);
//					alert(objA[x]+"\n"+obj);
					obj.disabled = tf;
				}
		  	if (!tf) {
				  obj = formObj(objA[0]);
					obj.select();
				}
			}
		}
// ---------------------------------------------------------		
			// highlights a form field
		function f(o) {
			if (isAll||isID) o.style.backgroundColor = '#CCDDFF';
			else o.backgroundColor = '#CCDDFF';
		}
// ---------------------------------------------------------		
		  // locate an object on the page
		function findObj(objID) {
		  if      (isAll) return (document.all[objID]);
			else if (isID)  return (document.getElementById(objID));
			else if (isLay) return (document.layers[objID]);
			else alert(objID+' = null'); 
		}
// ---------------------------------------------------------		
		  // locate an object on the page
		function formObj(objID) {
		  if      (isAll) return eval('form1.'+objID);
			else if (isID)  return eval('document.forms.form1.'+objID);
			else if (isLay) return (document.layers[objID]);
			else alert(objID+' = null'); 
		}
// ---------------------------------------------------------		
			// hide visible
    function NoSee(menu) {
    	if (menu == SeeCurr) {
			  // start delay time loop
				cyclotron = setTimeout("NotSee('"+menu+"')",500);
			} else {
			  NotSee(menu);
    	}
    }
// ---------------------------------------------------------		
			// hide visible
    function NotSee(menuItem) {
		  obj = findObj(menuItem);
			if (isAll || isID) {
				hid = "hidden";
				vis = "visible";
				obj = obj.style;
			} else {
				hid = "hide";
				vis = "show";
			};
  	  if (obj.visibility == vis) obj.visibility = hid;
    }
// ---------------------------------------------------------		
		  //HRA login = open window; write form to window; submit form
		function LogIn(F){
		  Lid = F.loginid.value;
			Lpin = F.pin.value;
			Ltype = F.logintype.value;
			
			if (!Lid || !Lpin) return false;
			if (Ltype=="S" && !ssnChk.test(Lid)) {
			  alert("Invalid SSN");
				F.loginid.select();
				return false;
			}
			if (Lid.substring(0,1) == "a") Ltype = "A";
			if (Ltype=="I" && !numChk.test(Lid)) {
			  alert("Your Group ID must be a numeric value");
				F.loginid.select();
				return false;
			}
			
			URL = "";  //"https://www.repayme.com/admin/main.asp?cn=PESC&loginid="+Lid+"&pin="+Lpin+"&logintype="+Ltype;

			thewin = popZero(URL,500,750);
			
			thewin.document.write('<html><form name="login" id="login" method="post" action="https://www.repayme.com/admin/default.asp">\n');
			thewin.document.write('  <input name="loginid" type="hidden" id="loginid" value="'+Lid+'" />\n');
			thewin.document.write('  <input name="pin" type="hidden" id="pin" value="'+Lpin+'" />\n');
			thewin.document.write('  <input name="logintype" type="hidden" id="logintype" value="'+Ltype+'" />\n');
			thewin.document.write('  <input name="cn" type="hidden" id="cn" value="PESC" />\n');
			thewin.document.write('</form></html>');
			
			thewin.document.forms.login.submit();
		}
// ---------------------------------------------------------		
      // popup window w/o menus fixed size (375 x 425)
		function popwin(o){
			addy = 'http://www.pescadministrators.com/forms/' + ((o)?'disclaimer':'privacy') + '.htm';
			params = "width=425,height=375,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,copyhistory=0,resizable=0,top=50,left=100,screenX=50,screenY=100";
			window.open(addy, '_blank', params);
			return false;
		}
// ---------------------------------------------------------		
      // popup window w/o menus variable size
		function popZero(url,hgt,wdt) {
			params = 'directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=no';
			params += ',width='+wdt+',height='+hgt+',left=0,top=0,screenX=0,screenY=0';
			return window.open(url,'_blank',params);
		}
// ---------------------------------------------------------		
			// reveal hidden
    function See(menu,adj) {
		  // turn off previous menu
		  clearTimeout(cyclotron);
		  if (menu != SeeCurr && SeeCurr) {
				NotSee(SeeCurr);
			}

		  obj = findObj(menu);
			if (isAll || isID) {
				hid = "hidden";
				vis = "visible";
				obj = obj.style;
			} else {
				hid = "hide";
				vis = "show";
			};
			
			appVer = navigator.appVersion;
			ix = appVer.indexOf("MSIE");
			iVer = (ix==-1)?false:(appVer.substr(ix+5,3).valueOf()<6)?true:false;
    	if (obj.visibility == hid) {
  			obj.visibility = vis;
    	}
			SeeCurr = menu;
			
			if (adj && iVer) obj.top = adj;
    }
// ---------------------------------------------------------		
		  // current date in format mm/dd/yy
		function theDate(){
			var today = new Date();
			month = today.getMonth()+1;
			day = today.getDate();
			year = today.getFullYear();
			month = (month < 10)? '0' + month : month;
			day = (day < 10)? '0' + day : day;
			year = year.toString().substr(2);
			return (month + '/' + day + '/' + year);
		}
