<!--
function fCheckDate(dt){
	var reDate = /\d{1,2}\/\d{1,2}\/\d\d\d\d/;
	var r = true
	if (reDate.test(dt)){
		// passes format check for slashes
		var reMD = /\d{1,2}/g;
		var q;
		var bLeapFlag = false;
		var iLeap;
		var w = 1;
		var m_dt = dt;
		
		q = dt.match(reMD)
/*		for(var w = 0; w < q.length; w++){
			alert(q[w]);
		}
*/
		//MONTH
		var M = q[0];
		if (!(M > 0 && M < 13)){
//		alert("BadMonth: " + M)
			r = false;
		}
		if (M == 2){
			bLeapFlag = true;
		}
		//DAY
		var D = q[1];
		var maxD;
		if (M == 1 || M == 3 || M == 5 || M == 7 || M == 8 || M == 10 || M == 12){
			maxD = 32;
		} else {
			if (M != 2){
				maxD = 31;
			} else {
				maxD = 30;
			}
		}
		if (!(D > 0 && D < maxD)){
//		alert("BadDay: " + D)
			r = false;
		}
		if (bLeapFlag && D < 29){
			bLeapFlag = false;
		} else {
			iLeap = D;
		}
		//YEAR
		var Y = q[2];
		if (!(Y > 17 && Y < 22)){
//		alert("BadYear: " + Y)
			r = false;
		}
		if (bLeapFlag){
			if (iLeap > 29){
				r = false;
			} else {
				var reYr = /\d{4}/g;
				q = reYr.exec(dt);
				Y = q[0];
				if (Y%4 != 0){
					if (iLeap == 29){
						r = false;
					}
				}
			}
		}
	} else {
		r = false;
	}
	return r;
}

function fCheckTime(timeStr) {
// Checks if time is in HH:MM:SS AM/PM format.
// The seconds and AM/PM are optional.

	var timePat = /^(\d{1,2}):(\d{2})(:(\d{2}))?(\s?(AM|am|PM|pm))?$/;

	var matchArray = timeStr.match(timePat);
	if (matchArray == null) {
//		alert("Time is not in a valid format.");
		return false;
	}
	hour = matchArray[1];
	minute = matchArray[2];
	second = matchArray[4];
	ampm = matchArray[6];

	if (second=="") { second = null; }
	if (ampm=="") { ampm = null }

	if (hour < 0  || hour > 23) {
//		alert("Hour must be between 1 and 12. (or 0 and 23 for military time)");
		return false;
	}
	if (hour <= 12 && ampm == null) {
		if (confirm("Please indicate which time format you are using.  OK = Standard Time, CANCEL = Military Time")) {
//			alert("You must specify AM or PM.");
			return false;
	   }
	}
	if  (hour > 12 && ampm != null) {
//		alert("You can't specify AM or PM for military time.");
		return false;
	}
	if (minute<0 || minute > 59) {
//		alert ("Minute must be between 0 and 59.");
		return false;
	}
	if (second != null && (second < 0 || second > 59)) {
//		alert ("Second must be between 0 and 59.");
		return false;
	}
	return true;
}

function fCheckEmail (emailStr) {
	/* The following pattern is used to check if the entered e-mail address
	   fits the user@domain format.  It also is used to separate the username
	   from the domain. */
	var emailPat=/^(.+)@(.+)$/;
	/* The following string represents the pattern for matching all special
	   characters.  We don't want to allow special characters in the address. 
	   These characters include ( ) < > @ , ; : \ " . [ ]    */
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
	/* The following string represents the range of characters allowed in a 
	   username or domainname.  It really states which chars aren't allowed. */
	var validChars="\[^\\s" + specialChars + "\]";
	/* The following pattern applies if the "user" is a quoted string (in
	   which case, there are no rules about which characters are allowed
	   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
	   is a legal e-mail address. */
	var quotedUser="(\"[^\"]*\")";
	/* The following pattern applies for domains that are IP addresses,
	   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
	   e-mail address. NOTE: The square brackets are required. */
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	/* The following string represents an atom (basically a series of
	   non-special characters.) */
	var atom=validChars + '+';
	/* The following string represents one word in the typical username.
	   For example, in john.doe@somewhere.com, john and doe are words.
	   Basically, a word is either an atom or quoted string. */
	var word="(" + atom + "|" + quotedUser + ")";
	// The following pattern describes the structure of the user
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	/* The following pattern describes the structure of a normal symbolic
	   domain, as opposed to ipDomainPat, shown above. */
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

	/* Finally, let's start trying to figure out if the supplied address is
	   valid. */

	/* Begin with the coarse pattern to simply break up user@domain into
	   different pieces that are easy to analyze. */
	var matchArray=emailStr.match(emailPat);
	if (matchArray==null) {
	  /* Too many/few @'s or something; basically, this address doesn't
	     even fit the general mould of a valid e-mail address. */
//		alert("Email address seems incorrect (check @ and .'s)");
		return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];

	// See if "user" is valid 
	if (user.match(userPat)==null) {
	    // user is not valid
//	    alert("The username doesn't seem to be valid.");
	    return false;
	}

	/* if the e-mail address is at an IP address (as opposed to a symbolic
	   host name) make sure the IP address is valid. */
	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) {
	    // this is an IP address
		  for (var i=1;i<=4;i++) {
		    if (IPArray[i]>255) {
//		        alert("Destination IP address is invalid!");
			return false;
		    }
	    }
	    return true;
	}

	// Domain is symbolic name
	var domainArray=domain.match(domainPat)
	if (domainArray==null) {
//		alert("The domain name doesn't seem to be valid.");
	    return false;
	}

	/* domain name seems valid, but now make sure that it ends in a
	   three-letter word (like com, edu, gov) or a two-letter word,
	   representing country (uk, nl), and that there's a hostname preceding 
	   the domain or country. */

	/* Now we need to break up the domain to get a count of how many atoms
	   it consists of. */
	var atomPat=new RegExp(atom,"g");
	var domArr=domain.match(atomPat);
	var len=domArr.length;
	if (domArr[domArr.length-1].length<1 || 
	    domArr[domArr.length-1].length>5) {
	   // the address must end in a one through five letter word.
//	   alert("The address must end in a proper domain.");
	   return false;
	}

	// Make sure there's a host name preceding the domain.
	if (len<2) {
	   var errStr="This address is missing a hostname!";
//	   alert(errStr);
	   return false;
	}

	// If we've gotten this far, everything's valid!
	return true;
}

function fChkFrm(frm, aObj){

	var q;
	var w;
	var e;
	var r;
	var curObj;
	var curType;
	var aPass = new Array;
	var aResult = new Array;
	var sResult = "";
	var bPass = true;

	e = 0;
	
//	alert('boo!');
	
	for (q = 0;  q < aObj.length; q++){
//		alert(aObj[q][2])
		curObj = aObj[q][0];
		curType = aObj[q][1];
		for (w = 0; w < aObj[q][2].length; w++){
//			alert(curObj + "-" + curType + "-" + aObj[q][2][w])
			switch (aObj[q][1]){
				case "p": //password fields.  Passed as PWObject|PWConfirmObject
					switch (aObj[q][2][w]){
						case 1: //confirm match
							aPW = curObj.split("|");
							if (eval("document." + frm + "." + aPW[0] + ".value") == eval("document." + frm + "." + aPW[1] + ".value")){
								aPass[e] = 0;
								e++;
							} else {
								aPass[e] = 1;
								e++;
								sResult += aObj[q][3] + " do not match.\n";
							}
							break;
					}
					break;
				case "c": //Comparisons.  Passed as Data|Comparison
					switch (aObj[q][2][w]){
						case 1: //Less than
							aComp = curObj.split("|");
							if (aComp[0] < aComp[1]){
								aPass[e] = 0;
								e++;
							} else {
								aPass[e] = 1;
								e++;
								sResult += aObj[q][3] + " must be before " + aComp[1] + ".\n";
							}
							break;
					}
					break;
				case "d": //text boxes, passed as dates
					switch (aObj[q][2][w]){
						case 1: //valid date
							if (fCheckDate(eval("document." + frm + "." + curObj + ".value"))){
								aPass[e] = 0;
								e++;
							} else {
								aPass[e] = 1;
								e++;
								sResult += aObj[q][3] + " is not a properly formatted date (mm/dd/yyyy).\n";
							}
							break;
						case 2: //valid date if not null
							if (eval("document." + frm + "." + curObj + ".value.length") > 0){
								if (fCheckDate(eval("document." + frm + "." + curObj + ".value"))){
									aPass[e] = 0;
									e++;
								} else {
									aPass[e] = 1;
									e++;
									sResult += aObj[q][3] + " is not a properly formatted date (mm/dd/yyyy).\n";
								}
							}
							break;
						case 3: //valid date/time
							var theDateTime = eval("document." + frm + "." + curObj + ".value");
							var theDate = '', theTime = '';
							var bDoDate = true;
							for (i=0;i<theDateTime.length;i++){
								if (theDateTime.charAt(i) == ' '){
									bDoDate = false;
								}
								if (bDoDate){
									theDate += theDateTime.charAt(i);
								} else {
									theTime += theDateTime.charAt(i);
								}
							}
							if (fCheckDate(theDate)){
								aPass[e] = 0;
								e++;
							} else {
								aPass[e] = 1;
								e++;
								sResult += aObj[q][3] + " is not a properly formatted date (mm/dd/yyyy).\n";
							}
							for (i=0;i<theTime.length;i++){
								if (theTime.charAt(i) != ' ') {
									theTime = theTime.substr(i, theTime.length - 1);
									break;
								}
							}
							if (theTime.length > 0){
								if (fCheckTime(theTime)){
									aPass[e] = 0;
									e++;
								} else {
									aPass[e] = 1;
									e++;
									sResult += aObj[q][3] + " is not a properly formatted time (hh:mm AM|PM or HH:mm).\n";
								}
							}
							break;
					}
					break;
				case "s": //select objects
					switch(aObj[q][2][w]){
						case 1: //non zero
							if (eval("document." + frm + "." + curObj + ".options[document." + frm + "." + curObj + ".selectedIndex].value") != 0){
								aPass[e] = 0;
								e++;
							} else {
								aPass[e] = 1;
								e++;
								sResult += aObj[q][3] + " has not been selected.\n";
							}	
							break;
					}
					break;
				case "t": //text boxes
					switch (aObj[q][2][w]){
						case 1: //not empty
							if (eval("document." + frm + "." + curObj + ".value") != "") {
								aPass[e] = 0;
								e++;
							} else {
								aPass[e] = 1;
								e++;
								sResult += aObj[q][3] + " is empty.\n"
							}
							break;
						case 2: //not zero
							if (eval("document." + frm + "." + curObj + ".value") != 0) {
								aPass[e] = 0;
								e++;
							} else {
								aPass[e] = 1;
								e++;
								sResult += aObj[q][3] + " is set to zero.\n";
							}
							break;
						case 3: //string
							if (isNaN(parseInt(eval("document." + frm + "." + curObj + ".value")))) {
								aPass[e] = 0;
								e++;
							} else {
								aPass[e] = 1;
								e++;
								sResult += aObj[q][3] + " is not a text value.\n"
							}
							break;
						case 4: //number
							if (!isNaN(parseInt(eval("document." + frm + "." + curObj + ".value")))) {
								aPass[e] = 0;
								e++;
							} else {
								aPass[e] = 1;
								e++;
								sResult += aObj[q][3] + " is not a numeric value.\n"
							}
							break;
						case 5: //day of month (numeric)
							if (eval("document." + frm + "." + curObj + ".value") > 0 && eval("document." + frm + "." + curObj + ".value") < 32) {
								aPass[e] = 0;
								e++;
							} else {
								aPass[e] = 1;
								e++;
								sResult += aObj[q][3] + " is not valid day of the Month (between 1 and 31).\n"
							}
							break;
						case 6: //month of year (numeric)
							if (eval("document." + frm + "." + curObj + ".value") > 0 && eval("document." + frm + "." + curObj + ".value") < 13) {
								aPass[e] = 0;
								e++;
							} else {
								aPass[e] = 1;
								e++;
								sResult += aObj[q][3] + " is not a valid Month (between 1 and 12).\n"
							}
							break;
						case 7: //number or Null
							if (!isNaN(parseInt(eval("document." + frm + "." + curObj + ".value"))) || eval("document." + frm + "." + curObj + ".value") == "") {
								aPass[e] = 0;
								e++;
							} else {
								aPass[e] = 1;
								e++;
								sResult += aObj[q][3] + " is not a numeric value.\n"
							}
							break;
						case 8: //not just spaces
							if (eval("document." + frm + "." + curObj + ".value") != " "){
								aPass[e] = 0;
								e++;
							} else {
								aPass[e] = 1;
								e++;
								sResult += aObj[q][3] + " must contain more than spaces.\n";
							}
							break;
						case 9: //not email address (reg exp)
							if (eval("document." + frm + "." + curObj + ".value") != ""){
								if (fCheckEmail(eval("document." + frm + "." + curObj + ".value"))){
									aPass[e] = 0;
									e++;
								} else {
									aPass[e] = 1;
									e++;
									sResult += aObj[q][3] + " is not a properly formatted email.\n";
								}
							} else {
								aPass[e] = 0;
								e++;
							}
							/*if ((eval("document." + frm + "." + curObj + ".value.indexOf('@')") != -1) && (eval("document." + frm + "." + curObj + ".value.indexOf('.')") != -1)){
								aPass[e] = 0;
								e++;
							} else {
								aPass[e] = 1;
								e++;
								sResult += aObj[q][3] + " appears to be an invalid Email Address.\n";
							}*/
							break;
						case 10: //not valid time (regular or military)
							if (eval("document." + frm + "." + curObj + ".value.length") > 0){
								if (fCheckTime(eval("document." + frm + "." + curObj + ".value"))){
									aPass[e] = 0;
									e++;
								} else {
									aPass[e] = 1;
									e++;
									sResult += aObj[q][3] + " is not a properly formatted time (hh:mm AM|PM or HH:mm).\n";
								}
							}
							break;
						case 11: //max length check
							if (eval("document." + frm + "." + curObj + ".value.length") <= aObj[q][4]){
								aPass[e] = 0;
								e++;
							} else {
								aPass[e] = 1;
								e++;
								sResult += aObj[q][3] + " exceeds the maximum length allowed (" + aObj[q][4] + " characters).\n";
							}
							break;
						}
					break;
				
			}
		}
	}
	
//	alert(aPass);
	
	for (r = 0; r < aPass.length; r++){
		if (aPass[r] == 1){
			bPass = false;
			break;
		}
	}
	
	aResult[0] = bPass;
	aResult[1] = sResult;
	
	return aResult;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_nbGroup(event, grpName) { //v3.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : args[i+1];
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    if ((nbArr = document[grpName]) != null)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = args[i+1];
      nbArr[nbArr.length] = img;
  } }
}

function fPopMe(sURL, sName, sOpt){
	if (sOpt == 'false'){
		window.open(sURL, sName);
	} else {
		window.open(sURL, sName, sOpt);
	}
}

function fCloseRefresh(sOpener){
	window.opener.location = sOpener;
	window.close();
}

function fClearMe(fld, txt){
	if (fld.value == txt) {
		fld.value = "";
	}
}

function fRecallMe(fld, txt){
	if (fld.value == "") {
		fld.value = txt;
	}
}

//-->
