function limitAttach(fmname,dname,fdname,isid,exts) {
	if (isid==true) fname=document.getElementById(fdname)
	else fname=eval('fmname.'+fdname)
	fname.style.backgroundColor = "";
	if (fname.value == "") return(true);
	/************************************************
	DESCRIPTION: Validates that a file to be uploaded
	has a valid extension.

	PARAMETERS:
	fname.value - String to be tested for validity

	RETURNS:
	True if valid, otherwise false.
	**************************************************/
	if (exts && exts != "")
		extArray=exts.split(',');
	else
		extArray = new Array(".gif", ".jpg", ".png");
	file=fname.value;
	allowSubmit = false;
	while (file.indexOf("\\") != -1)
		file = file.slice(file.indexOf("\\") + 1);
	ext = file.slice(file.indexOf(".")).toLowerCase();
	for (var i = 0; i < extArray.length; i++) {
		if (extArray[i] == ext) { allowSubmit = true; break; }
	}
	if (!allowSubmit) {
		alert('Please only upload files that end in types:  "'+(extArray.join("  "))+'" for the \"'+dname+'\" field.\nPlease select a different file to upload.');
		fname.style.backgroundColor=formBadBG;
		fname.focus();
		if (window.resetSubmit != null) resetSubmit();
		return (false);
	}
	return (true);
}



function digits(fmname,dname,fdname,isid) {
	if (isid==true) fname=document.getElementById(fdname)
	else fname=eval('fmname.'+fdname)
	fname.style.backgroundColor = "";
	if (fname.value == "") return(true);
	/************************************************
	DESCRIPTION: Validates that a string contains only
	valid integer number.

	PARAMETERS:
	fname.value - String to be tested for validity

	RETURNS:
	True if valid, otherwise false.
	**************************************************/
	var objRegExp  = /(^-?\d\d*$)/;

	//check for integer characters
	allValid = objRegExp.test(fname.value);
	if (!allValid) {
		alert('Please enter only digit characters in the \"'+dname+'\" field.');
		fname.style.backgroundColor=formBadBG;
		fname.focus();
		if (window.resetSubmit != null) resetSubmit();
		return (false);
	}
	return (true);
}



function year(fmname,dname,fdname,isid,min,max) {
	if (isid==true) fname=document.getElementById(fdname)
	else fname=eval('fmname.'+fdname)
	fname.style.backgroundColor = "";
	if (fname.value == "") return(true);
	allValid=true;
	/************************************************
	DESCRIPTION: Validates that a string contains only
	a valid year number within given min and max (optional).

	PARAMETERS:
	fname.value - String to be tested for validity

	RETURNS:
	True if valid, otherwise false.
	**************************************************/

	//check for integer characters
	var objRegExp  = /(^-?\d\d*$)/;
	if (!objRegExp.test(fname.value)) {
		allValid=false;
		var msg='Please enter only digit characters in the \"'+dname+'\" field.';
	}
	else if ((fname.value < min && min > 0 && min != "") || (fname.value > max && max > 0 && max != "") || fname.value == 0) {
		//check min, max, and > 0
		allValid=false;
		if(fname.value == 0)
			var msg='Year cannot be zero.';
		else if (min != "" && min > 0 && max != "" && max > 0)
			var msg='Year must be between '+min+' and '+max+'.';
		else if(min != "" && min > 0 && max == "" || max < 1)
			var msg='Year must be at least '+min+'.';
		else if(min == "" || min < 1 && max != "" && max > 0)
			var msg='Year must be no greater than '+max+'.';
	}
	if (!allValid) {
		alert(msg);
		fname.style.backgroundColor=formBadBG;
		fname.focus();
		if (window.resetSubmit != null) resetSubmit();
		return (false);
	}
	return (true);
}




function date(fmname,dname,fdname,isid) {
	if (isid==true) fname=document.getElementById(fdname)
	else fname=eval('fmname.'+fdname)
	fname.style.backgroundColor = "";
	if (fname.value == "") return(true);
	/************************************************
	DESCRIPTION: Validates that a string contains only
	    valid dates with 2 digit month, 2 digit day,
	    4 digit year. Date separator can be ., -, or /.
	    Uses combination of regular expressions and
	    string parsing to validate date.
	    Ex. mm/dd/yyyy or mm-dd-yyyy or mm.dd.yyyy

	PARAMETERS:
	   strValue - String to be tested for validity

	RETURNS:
	   True if valid, otherwise false.

	REMARKS:
	   Avoids some of the limitations of the Date.parse()
	   method such as the date separator character.
	*************************************************/
	  var objRegExp = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/
	  strValue=fname.value;
	  allValid = false;
	  //check to see if in correct format
	  if(!objRegExp.test(strValue))
	    allValid = false; //doesn't match pattern, bad date
	  else{
	    var strSeparator = strValue.substring(2,3)
	    var arrayDate = strValue.split(strSeparator);
	    //create a lookup for months not equal to Feb.
	    var arrayLookup = { '01' : 31,'03' : 31,
				'04' : 30,'05' : 31,
				'06' : 30,'07' : 31,
				'08' : 31,'09' : 30,
				'10' : 31,'11' : 30,'12' : 31}
	    var intDay = parseInt(arrayDate[1],10);

	    //check if month value and day value agree
	    if(arrayLookup[arrayDate[0]] != null) {
	      if(intDay <= arrayLookup[arrayDate[0]] && intDay != 0)
		allValid = true; //found in lookup table, good date
	    }

	    //check for February (bugfix 20050322)
	    //bugfix  for parseInt kevin
	    //bugfix  biss year  O.Jp Voutat
	    var intMonth = parseInt(arrayDate[0],10);
	    if (intMonth == 2) {
	       var intYear = parseInt(arrayDate[2]);
	       if (intDay > 0 && intDay < 29) {
		   allValid = true;
	       }
	       else if (intDay == 29) {
		 if ((intYear % 4 == 0) && (intYear % 100 != 0) ||
		     (intYear % 400 == 0)) {
		      // year div by 4 and ((not div by 100) or div by 400) ->ok
		     allValid = true;
		 }
	       }
	    }
	  }
	if (!allValid) {
		alert('Dates can only be enter as mm/dd/yyyy or mm-dd-yyyy or mm.dd.yyyy and must also contain a valid date in the \"'+dname+'\" field.');
		fname.style.backgroundColor = formBadBG;
		fname.focus();
		if (window.resetSubmit != null) resetSubmit();
		return (false);
	}
	return (true);
}



function numbers(fmname,dname,fdname,isid) {
	if (isid==true) fname=document.getElementById(fdname)
	else fname=eval('fmname.'+fdname)
	fname.style.backgroundColor = "";
	if (fname.value == "") return(true);
	/*****************************************************************
	DESCRIPTION: Validates that a string contains only valid numbers.

	PARAMETERS:
	fname.value - String to be tested for validity

	RETURNS:
	True if valid, otherwise false.
	******************************************************************/
	var objRegExp  =  /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/;

	//check for numeric characters
	allValid = objRegExp.test(fname.value);

	if (!allValid) {
		alert('Please enter only numbers in the \"'+dname+'\" field.');
		fname.style.backgroundColor = formBadBG;
		fname.focus();
		if (window.resetSubmit != null) resetSubmit();
		return (false);
	}
	return (true);
}


function ssNum(fmname,dname,fdname,isid) {
	if (isid==true) fname=document.getElementById(fdname)
	else fname=eval('fmname.'+fdname)
	fname.style.backgroundColor = "";
	if (fname.value == "") return(true);
	/*****************************************************************
	DESCRIPTION: Validates that a string contains valid social security numbers.
		     999-99-9999 or 999999999999

	PARAMETERS:
	fname.value - String to be tested for validity

	RETURNS:
	True if valid, otherwise false.
	******************************************************************/
	var objRegExp  =  /^\d{3}\-?\d{2}\-?\d{4}$/;

	allValid = objRegExp.test(fname.value);

	if (!allValid) {
		alert('Please enter only valid social security numbers in the \"'+dname+'\" field.');
		fname.style.backgroundColor = formBadBG;
		fname.focus();
		if (window.resetSubmit != null) resetSubmit();
		return (false);
	}
	return (true);
}


function phoneNum(fmname,dname,fdname,isid) {
	if (isid==true) fname=document.getElementById(fdname)
	else fname=eval('fmname.'+fdname)
	fname.style.backgroundColor = "";
	if (fname.value == "") return(true);

	phoneRegex = /^\(\d\d\d\) \d\d\d-\d\d\d\d$/;
	phoneRegex2 = /^\d\d\d-\d\d\d-\d\d\d\d$/;
	phoneRegex3 = /^\(\d\d\d\)\d\d\d-\d\d\d\d$/;
	var num=fname.value;
	if (!num.match(phoneRegex) && !num.match(phoneRegex2) && !num.match(phoneRegex3)) {
		alert('Please enter a valid phone number in the \"'+dname+'\" field.');
		fname.style.backgroundColor = formBadBG;
		fname.focus();
		if (window.resetSubmit != null) resetSubmit();
		return (false);
	}
	return (true);
}




function alphaNum(fmname,dname,fdname,isid) {
	return (true);
	/* Effectivly disabled the function untill it can be determined that it is useful enough to keep. */
	if (isid==true) fname=document.getElementById(fdname)
	else fname=eval('fmname.'+fdname)
	fname.style.backgroundColor = "";
	if (fname.value == "") return(true);

	regex = /^[- &:_0-9a-zA-Z]+$/;
	var num=fname.value;
	if (!num.match(regex)) {
		alert('Please enter only alphanumeric characters (a-z, A-Z, 0-9), - (dash), _ (underscore), : (colon), & (ampersand), or [space]) in the \"'+dname+'\" field.');
		fname.style.backgroundColor = formBadBG;
		fname.focus();
		if (window.resetSubmit != null) resetSubmit();
		return (false);
	}
	return (true);
}




function idNum(fmname,dname,fdname,isid) {
	if (isid==true) fname=document.getElementById(fdname)
	else fname=eval('fmname.'+fdname)
	fname.style.backgroundColor = "";
	if (fname.value == "") return(true);

	regex = /^[\- 0-9]+$/;
	var num=fname.value;
	if (!num.match(regex)) {
		alert('Please enter only digits (0-9), - (dash), or [space]) in the \"'+dname+'\" field.');
		fname.style.backgroundColor = formBadBG;
		fname.focus();
		if (window.resetSubmit != null) resetSubmit();
		return (false);
	}
	return (true);
}



function not_allowed(fmname,dname,fdname,isid,notAllow) {
	/*****************************************************************
	DESCRIPTION: Validates that a string DOES NOT contain
					 certain characters.

	PARAMETERS:
	fname.value - String to be tested for validity
	notAllow    - Non separated list of characters to NOT ALLOW.
					  Must be properly escaped for RegExp.

	RETURNS:
	True if valid, otherwise false.
	******************************************************************/
	if (isid==true) fname=document.getElementById(fdname)
	else fname=eval('fmname.'+fdname)
	fname.style.backgroundColor = "";
	if (fname.value == "") return(true);
	regex = eval("/["+notAllow+"]/gi");
	var str=fname.value;
	if (str.match(regex)) {
		var newna;
		var na=notAllow.toLowerCase();
		na=na.replace(/\\\\/g,'[%BCKSLSH%]');
		na=na.replace(/\\/g,'');
		na=na.replace(/\[\%BCKSLSH\%\]/g,'\\');
		x=0;
		while (x <= na.length-1) {
			if (x==0)
				newna=na.charAt(x)+'\n'
			else
				newna=newna+na.charAt(x)+'\n'
			x++;
		}
		newna=newna.replace(/\ /g,'  (Space)');
		newna=newna.replace(/\=/g,'=  (Equal Sign)');
		newna=newna.replace(/\-/g,'-  (Dash/Minus Sign)');
		newna=newna.replace(/\//g,'/  (Fwd Slash)');
		newna=newna.replace(/\\/g,'\\  (Backslash)');
		newna=newna.replace(/\./g,'.  (Period)');
		newna=newna.replace(/\,/g,',  (Comma)');
		newna=newna.replace(/\;/g,';  (Semicolon)');
		newna=newna.replace(/\'/g,'\'  (Single Quote)');
		newna=newna.replace(/\"/g,'\"  (Dbl Quote)');
		newna=newna.replace(/\|/g,'|  (Pipe)');
		alert('Please do not use the following characters in the \"'+dname+'\" field:\n\n'+newna);
		fname.style.backgroundColor = formBadBG;
		fname.focus();
		if (window.resetSubmit != null) resetSubmit();
		return (false);
	}

	/*
	var chkVal = fname.value;
	var prsVal = chkVal;
	if (chkVal != "" && !(prsVal != "' $ l.notAllow $ '")) {
		alert('Please do not use \"'+notAllow+'\" in the \"'+dname+'\" field.');
		fname.style.backgroundColor = formBadBG;
		fname.focus();
		if (window.resetSubmit != null) resetSubmit();
		return (false);
	}
	*/
	return (true);
}




function letters_digits(fmname,dname,fdname,isid) {
	return(alphaNum(fmname,dname,fdname,isid))

	/*
	if (isid==true) fname=document.getElementById(fdname)
	else fname=eval('fmname.'+fdname)
	if (fname.value == "") return(true);
	fname.style.backgroundColor = "";
	if (fname.value == "") return(true);

	regex = /^[0-9a-zA-Z]+$/;
	var num=fname.value;
	if (!num.match(regex)) {
		alert('Please enter only letters or digits (a-z, A-Z, 0-9)');
		fname.style.backgroundColor = formBadBG;
		fname.focus();
		if (window.resetSubmit != null) resetSubmit();
		return (false);
	}
	return (true);
	*/
}




function required(fmname,dname,fdname,isid,type) {
	if (isid==true) fname=document.getElementById(fdname)
	else fname=eval('fmname.'+fdname)
	fname.style.backgroundColor = "";
	if (type=='radio') {
		var radioSelected = false;
		for (i = 0;  i < fname.length;  i++) {
			if (fname[i].checked)
				radioSelected = true;
		}
		if (!radioSelected) {
			alert('Please select one of the \"'+dname+'\" options.');
			fname.style.backgroundColor = formBadBG;
			if (window.resetSubmit != null) resetSubmit();
			return (false);
		}
	}
	else if(type=='drop') {
		if (fname.options[fname.selectedIndex].value == "") {
			alert('Please select one of the \"'+dname+'\" options.');
			fname.style.backgroundColor = formBadBG;
			fname.focus();
			if (window.resetSubmit != null) resetSubmit();
			return (false);
		}
	}
	else if(fname.value == "") {
		alert('Please enter a value for the \"'+dname+'\" field.');
		fname.style.backgroundColor = formBadBG;
		fname.focus();
		if (window.resetSubmit != null) resetSubmit();
		return (false);
	}
	return (true);
}



function zipCode(fmname,dname,fdname,isid) {
	if (isid==true) fname=document.getElementById(fdname)
	else fname=eval('fmname.'+fdname)
	fname.style.backgroundColor = "";
	if (fname.value == "") return(true);

	/************************************************
	DESCRIPTION: Validates that a string a United
	  States zip code in 5 digit format or zip+4
	  format. 99999 or 99999-9999

	PARAMETERS:
	   fname.value - String to be tested for validity

	RETURNS:
	   True if valid, otherwise false.

	*************************************************/
	var objRegExp  = /(^\d{5}$)|(^\d{5}-\d{4}$)/;

	  //check for valid US Zipcode
	  allValid = objRegExp.test(fname.value);
	if (!allValid) {
		alert('Please enter a valid zip code in the \"'+dname+'\" field.');
		fname.style.backgroundColor = formBadBG;
		fname.focus();
		if (window.resetSubmit != null) resetSubmit();
		return (false);
	}
	return (true);
}



function maxlen(fmname,dname,fdname,isid,max) {
	if (isid==true) fname=document.getElementById(fdname)
	else fname=eval('fmname.'+fdname)
	fname.style.backgroundColor = "";
	if (fname.value == "") return(true);
	if (fname.value.length > ' $ l.max $ ') {
		alert('Please enter at most '+max+' characters in the \"'+dname+'\" field.\nYou currently have '+fname.value.length+' characters.');
		fname.style.backgroundColor = formBadBG;
		fname.focus();
		if (window.resetSubmit != null) resetSubmit();
		return (false);
	}
	return (true);
}



function minlen(fmname,dname,fdname,isid,min) {
	if (isid==true) fname=document.getElementById(fdname)
	else fname=eval('fmname.'+fdname)
	fname.style.backgroundColor = "";
	if (fname.value == "") return(true);
	if (fname.value.length < ' $ l.min $ ') {
		alert('Please enter at most '+min+' characters in the \"'+dname+'\" field.\nYou currently have '+fname.value.length+' characters.');
		fname.style.backgroundColor = formBadBG;
		fname.focus();
		if (window.resetSubmit != null) resetSubmit();
		return (false);
	}
	return (true);
}



function html(fmname,dname,fdname,isid) {
	if (isid==true) fname=document.getElementById(fdname)
	else fname=eval('fmname.'+fdname)
	fname.style.backgroundColor = "";
	if (fname.value == "") return(true);
	var checkNOT = "<>";
	var checkStr = fname.value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++) {
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkNOT.length;  j++) {
			if (ch == checkNOT.charAt(j)) {
				allValid = false;
				break;
			}
		}
	}
	if (!allValid) {
		alert('You cannot use the \"<\" or \">\" characters in the \"'+dname+'\" field.');
		fname.style.backgroundColor = formBadBG;
		fname.focus();
		if (window.resetSubmit != null) resetSubmit();
		return (false);
	}
	return (true);
}



function no_quotes(fmname,dname,fdname,isid) {
	if (isid==true) fname=document.getElementById(fdname)
	else fname=eval('fmname.'+fdname)
	fname.style.backgroundColor = "";
	if (fname.value == "") return(true);
	var checkNOT = "\'\"";
	var checkStr = fname.value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++) {
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkNOT.length;  j++) {
		  if (ch == checkNOT.charAt(j)) {
			allValid = false;
			break;
		  }
		}
	}
	if (!allValid) {
		alert('You cannot use quotation marks or apostrophes in the \"'+dname+'\" field.');
		fname.style.backgroundColor = formBadBG;
		fname.focus();
		if (window.resetSubmit != null) resetSubmit();
		return (false);
	}
	return (true);
}



function check_passes(fmname,dname,passfield1,passfield2,isid) {
	if (isid==true) {
		passfield1=document.getElementById(passfield1);
		passfield2=document.getElementById(passfield2);
		passfield1.style.backgroundColor = "";
		passfield2.style.backgroundColor = "";
	}
	else {
		passfield1=eval('fmname.'+passfield1);
		passfield2=eval('fmname.'+passfield2);
		passfield1.style.backgroundColor = "";
		passfield2.style.backgroundColor = "";
	}
	if ((fmname.editwhat.value != "" && ((passfield1.value != "") || (passfield2.value != ""))) || fmname.editwhat.value == "")
	{

		if (passfield1.value == "") {
			alert('Please enter a value for the \"Password\" field.');
			passfield1.style.backgroundColor = formBadBG;
			passfield1.focus();
			if (window.resetSubmit != null) resetSubmit();
			return (false);
		}
		if (passfield2.value == "") {
			alert("Please enter a value for the \"Password Again\" field.");
			passfield2.style.backgroundColor = formBadBG;
			passfield2.focus();
			if (window.resetSubmit != null) resetSubmit();
			return (false);
		}
		if (passfield1.value != passfield2.value) {
			alert("Your two passwords do not match.");
			passfield1.value = "";
			passfield2.value = "";
			passfield1.style.backgroundColor = formBadBG
			passfield2.style.backgroundColor = formBadBG;
			passfield1.focus();
			if (window.resetSubmit != null) resetSubmit();
			return (false);
		}
	}
	return (true);
}



function check_state(fmname,dname,state,prov,req,isid) {
	if (isid==true) {
		state=document.getElementById(state);
		prov=document.getElementById(prov);
		state.style.backgroundColor = "";
		prov.style.backgroundColor = "";
	}
	else {
		state=eval('fmname.'+state);
		prov=eval('fmname.'+prov);
		state.style.backgroundColor = "";
		prov.style.backgroundColor = "";
	}
	if (req != "") {
		if (state.value == "" && prov.value == "") {
			alert('Please enter a value for the \"'+dname+'\" field.');
			state.style.backgroundColor = formBadBG;
			prov.style.backgroundColor = formBadBG;
			state.focus();
			if (window.resetSubmit != null) resetSubmit();
			return (false);
		}
	}
	if (state.value != "" && prov.value != "") {
		alert('You only need to enter a value for \"Province\" if you live outside the United States. \nPlease go back and correct this.');
		prov.style.backgroundColor = formBadBG;
		prov.focus();
		if (window.resetSubmit != null) resetSubmit();
		return (false);
	}
	return (true);
}



function emailCheck(fmname,dname,fdname,isid) {
	if (isid==true) fname=document.getElementById(fdname)
	else fname=eval('fmname.'+fdname)
	fname.style.backgroundColor = "";
	if (fname.value == "") return(true);

	// 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=fname.value.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("The \"" + dname + "\" field seems incorrect (check @ and .'s)");
		fname.style.backgroundColor = formBadBG;
		fname.focus();
		if (window.resetSubmit != null) resetSubmit();
		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 (the part before the \"@\" symbol) in the \"" + dname + "\" field, doesn't seem to be valid.");
		fname.style.backgroundColor = formBadBG;
		fname.focus();
		if (window.resetSubmit != null) resetSubmit();
		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 || IPArray[i]<0 || !IPArray[i]) {
			alert("Email IP address in the \"" + dname + "\" field is invalid!");
			fname.style.backgroundColor = formBadBG;
			fname.focus();
			if (window.resetSubmit != null) resetSubmit();
			return false;
			}
		}
		return true;
	}

	//  Domain is symbolic name
	var domainArray=domain.match(domainPat)
	if (domainArray==null) {
		alert("The domain name (the part following the \"@\" symbol) in the \"" + dname + "\" field doesn't seem to be valid.");
		fname.style.backgroundColor = formBadBG;
		 fname.focus();
		 if (window.resetSubmit != null) resetSubmit();
		 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<2 || domArr[domArr.length-1].length>3) {
	   //  the address must end in a two letter or three letter word.
	   alert("The \"" + dname + "\" field must end in a three-letter domain, or two letter country.");
	  fname.style.backgroundColor = formBadBG;
	   fname.focus();
	   if (window.resetSubmit != null) resetSubmit();
	   return false;
	}

	//  Make sure there's a host name preceding the domain.
	if (len<2) {
	   alert("The \"" + dname + "\" field is missing a hostname (the part following the \"@\" symbol) !");
	  fname.style.backgroundColor = formBadBG;
	   fname.focus();
	   if (window.resetSubmit != null) resetSubmit();
	   return false;
	}

	//  If we've gotten this far, everything's valid!
	return true;
}



function spaces(fmname,dname,fdname,isid) {
	if (isid==true) fname=document.getElementById(fdname)
	else fname=eval('fmname.'+fdname)
	while(''+fname.value.charAt(0)==' ')
		fname.value=fname.value.substring(1,fname.value.length);
	while(''+fname.value.charAt(fname.value.length-1)==' ')
		fname.value=fname.value.substring(0,fname.value.length-1);
	return(true);
}

function clrForm(theForm) {
	theForm=document.getElementById(theForm);
	x=0;
	while (theForm.elements[x]) {
		if (theForm.elements[x].type.toLowerCase()=="text") theForm.elements[x].value="";
		else if (theForm.elements[x].type.toLowerCase()=="checkbox" || theForm.elements[x].type.toLowerCase()=="radio") theForm.elements[x].checked=false;
		else if (theForm.elements[x].type.toLowerCase()=="select-one") theForm.elements[x].selectedIndex=0;
		x++;
	}
}

function disableAC() {
	if (document.getElementsByTagName) {
		var inputElements = document.getElementsByTagName("input");
		for (i=0; inputElements[i]; i++) {
			if (inputElements[i].className && (inputElements[i].className.indexOf("disableAutoComplete") != -1)) {
				inputElements[i].setAttribute("autocomplete","off");
			}//if current input element has the disableAutoComplete class set.
		}//loop thru input elements
	}//basic DOM-happiness-check
}