<!-- Template Name: clientsideerrorchecks.inc -->
<!-- Author: -->
<!-- Company: Spider Partners, LLC -->
<!--  Creation Date: 5/19/00 -->
<!--  Functional Description: -->
<!--  Revision List: -->
<!--  	1. 5/25/00 Template summary added -->
<!-- 	2. 5/27/00 AddErrorMessageByTag added - Snook -->
<!-- 	3. 5/27/00 Returned errors handling added - Snook -->


<!-- -->
<!-- Get index or name from supplied nameIndex label routines -->
<!-- -->	

function indexOfName (tagLabel)	//Returns the trailing number (any number of digits) of a name or label
	{
	returnText = "";																				//Initialize result
	for (indexCount = tagLabel.length-1; indexCount >=0; indexCount = indexCount-1)	//Step backwards thru string
		if (!(isNaN(tagLabel.slice(indexCount,indexCount+1))))								//Is the character a number
			returnText = tagLabel.slice(indexCount,indexCount+1) + returnText;			//If so accumulate it
		else return returnText;																	//If not we're done
	return returnText;
	}

function valueOfName (tagLabel)	//Returns supplied string less the trailing number
	{
	return tagLabel.slice(0, tagLabel.length - indexOfName(tagLabel).length);			//Get trailing number and slice it off
	}


<!-- -->
<!-- Highlight, unhighlight or test if highlighted from supplied form control routines -->
<!-- -->	

function redAndBoldit (thiscontrol) //Sets style.color to red and style.font-weight to bold
	{
	if (document.layers)
		{
		}
	else if (document.all)
		{
		formcontrol=eval(thiscontrol);
		formcontrol.style.color="red";
		formcontrol.style.fontWeight="bold";
		}
	else {
		formcontrol=eval(thiscontrol);
		if (formcontrol.style) {
			formcontrol.style.color="red";
			formcontrol.style.fontWeight="bold";
			}
		}
	}
	
function blackAndUnboldit (thiscontrol) //Sets style.color to black and style.font-weight to normal
	{
	if (document.layers)
		{
		}
	else if (document.all)
		{
		formcontrol=eval(thiscontrol);
		formcontrol.style.color="black";
		formcontrol.style.fontWeight="normal";
		}
	else
		{
		formcontrol=eval(thiscontrol);
		if (formcontrol.style) {
			formcontrol.style.color="black";
			formcontrol.style.fontWeight="normal";
			}
		}
	}

<!-- -->
<!-- Add or remove an error message plus supporting display error message or restore static message routines -->
<!-- -->

//reset error message	
var errorHolder = "";

function addErrorMessage (errorTag, errorText)	// This adds an error message to pane with <SPAN name=''></SPAN> tags
{
	displayEachError(errorTag, errorText);
	errorHolder = errorHolder + "<SPAN name='" + errorTag + "'>" + " " + errorText + "<br> " + "</SPAN>";
	//displayErrorText (errorHolder);
}

function getErrLineFromErrTag (errorTag){ // get the line of the error 
	var errorLine;
	//cut out the first 7 characters: ustaxxx, ustanum
	errorLine = errorTag.slice(7,errorTag.indexOf(":"));
	//do we have the usta number now?
	if ((isNaN(errorLine)) && (errorLine.length > 0)) {
		if (errorLine.slice(0, 4) == 'mnum'){ //is this a teamnumber?
			errorLine = errorLine.slice(4, errorLine.length);
		}
	}
	//lert(errorTag + ' ' + errorLine);
	return errorLine;
}

function resizeHandler (eventObj)
	{
	if (errorHolder > "")
		displayErrorText(errorHolder);
	else
		restoreStaticText();
	return true;
	}

function moveHandler (eventObj)
	{
	if (errorHolder > "")
		displayErrorText(errorHolder);
	else
		restoreStaticText();
	return true;
	}

function removeErrorMessage (errorTag)	// Finds and removes error text by reviewing error message <SCAN> tag
	{											// names looking for "name='xxx'" where "xxx" is the supplied parameters
	var errorLine;
	errorLine = getErrLineFromErrTag(errorTag);

	if (errorHolder.indexOf("<SPAN name='submit:nogo'>") != -1)
		errorHolder = errorHolder.slice(errorHolder.indexOf("/SPAN>") + "/SPAN>".length);

	i=0;
	
	while ((errorHolder.slice(i).indexOf("<SPAN") != -1))
		{
		thisErrorText = errorHolder.slice(i + errorHolder.slice(i).indexOf("<SPAN"), i + errorHolder.slice(i).indexOf("/SPAN>") + "/SPAN>".length);
		thisErrorTag = thisErrorText.slice(thisErrorText.indexOf("name"));
		thisErrorTag = thisErrorTag.slice(thisErrorTag.indexOf("'")+1);
		thisErrorTag = thisErrorTag.slice(0,thisErrorTag.indexOf("'")); 
		if (thisErrorTag == errorTag)
				{
				
				removeEachErrorMessage(errorLine);
				errorHolder = errorHolder.slice(0, i + errorHolder.slice(i).indexOf("<SPAN")) + errorHolder.slice(i + errorHolder.slice(i).indexOf("/SPAN>") + "/SPAN>".length);
				if (errorHolder > "")
					displayErrorText(errorHolder);
				else
					restoreStaticText();
				return;
				}
		i = i + (errorHolder.slice(i).indexOf("/SPAN>") + "/SPAN>".length);
		}

	}	

function displayErrorText (suppliedText)		// This displays the error text by hiding the static text and
	{												// un-hiding the error text pane and loading from supplied param
	if (suppliedText.indexOf("<SPAN name='submit:nogo'>") == 0)
		displayText = suppliedText.slice(0, suppliedText.indexOf("/SPAN>", suppliedText.indexOf("/SPAN>") + "/SPAN>".length + 1) + "/SPAN>".length);
	else
		displayText = suppliedText;
	if (document.all)
		{
		document.all.staticmsg.style.display = "none";
		document.all.dynamicmsg.innerHTML= "<span id='errorbox'>" + displayText + "</span>";
		document.all.dynamicmsg.style.display = "";
		document.all.dynamicmsg.style.borderWidth = 2;
		document.all.dynamicmsg.style.clip="rect(0 " + errorClipWidth + " " + errorClipLength + " 0)";
		}
	else if (document.layers)
		{
		document.msgparent.document.staticmsg.visibility = "hide";
		document.msgparent.document.staticmsg.zIndex = 0;
		document.msgparent.document.dynamicmsg.document.write("<span id='errorbox'>" + displayText + "</span>");
		document.msgparent.document.dynamicmsg.document.close();
		//document.msgparent.document.dynamicmsg.visibility = "show";
		document.msgparent.document.dynamicmsg.zIndex = 1;
		document.msgparent.document.dynamicmsg.clip.bottom = errorClipLength;
		}
	else if (document.getElementById) {
		var e;
		e = document.getElementById('staticmsg');
		e.style.display = "none";
		e = document.getElementById('dynamicmsg');
		e.innerHTML= "<span id='errorbox'>" + displayText + "</span>";
		e.style.display = "";
		e.style.width = 180;
		e.style.borderWidth = 2;
		e.style.clip="rect(0 " + errorClipWidth + " " + errorClipLength + " 0)";
		}
	}

function addErrorMessageByTag (tagname)

	{

	tagIndex = "";
	ourTagValueLeft = tagname.slice(0,tagname.indexOf(":"));					//Split tag into field name and condition
	ourTagValueRight = tagname.slice(tagname.indexOf(":")+1);

	while (IsNumeric(ourTagValueLeft.charAt(ourTagValueLeft.length-1)))	//Trim of field name number and save
			{
			tagIndex = ourTagValueLeft.charAt(ourTagValueLeft.length-1) + tagIndex;
			ourTagValueLeft = ourTagValueLeft.slice(0,ourTagValueLeft.length-1);
			}
	if (tagIndex > "")
		tagline = " on line " + tagIndex;											//Create line number plug-in
	else
		tagline = "";
		
	tagname = ourTagValueLeft + ":" + ourTagValueRight;						//Construct vanilla tag

	switch (tagname)
		{
		case "ustanum:blank":		
			{addErrorMessage ("ustanum" + tagIndex + ":blank", "<center><b>Data submission error !</b></center>The USTA number " + tagline + " is missing; it should consist of up to 10 digits.<br>");
			return true;}
		case "ustanum:nonnum":		
			{addErrorMessage ("ustanum" + tagIndex + ":nonnum", "<center><b>Data submission error !</b></center>The USTA number " + tagline + " is invalid and should consist of up to 10 <i>digits only</i>.<br>");
			redAndBoldit ("document.forms[0].elements['ustanum" + tagIndex + "']");
			return true;}
		case "ustanum:toolong":		
			{addErrorMessage ("ustanum" + tagIndex + ":toolong", "<center><b>Data submission error !</b></center>The USTA number " + tagline + " is invalid and should consist of <i>no more than 10</i> digits.<br>");
			redAndBoldit ("document.forms[0].elements['ustanum" + tagIndex + "']");
			return true;}
		case "ustanum:invalid":		
			{addErrorMessage ("ustanum" + tagIndex + ":invalid", "<center><b>Data submission error !</b></center>The USTA number entered" + tagline + " is invalid and should consist of up to 10 digits only.<br>");
			redAndBoldit ("document.forms[0].elements['ustanum" + tagIndex + "']");
			return true;}
		case "ustateamnum:blank":		
			{addErrorMessage ("ustateamnum" + tagIndex + ":blank", "<center><b>Data submission error !</b></center>The USTA team number " + tagline + " is missing.<br>");
			return true;}
		case "ustateamnum:nonnum":		
			{addErrorMessage ("ustateamnum" + tagIndex + ":nonnum", "<center><b>Data submission error !</b></center>The USTA team number " + tagline + " is invalid and should consist of <i>digits only</i>.<br>");
			redAndBoldit ("document.forms[0].elements['ustateamnum" + tagIndex + "']");
			return true;}
		case "ustateamnum:toolong":		
			{addErrorMessage ("ustateamnum" + tagIndex + ":toolong", "<center><b>Data submission error !</b></center>The USTA team number " + tagline + " is invalid and should consist of at least 5 digits.<br>");
			redAndBoldit ("document.forms[0].elements['ustateamnum" + tagIndex + "']");
			return true;}
		case "ustateamnum:invalid":		
			{addErrorMessage ("ustateamnum" + tagIndex + ":invalid", "<center><b>Data submission error !</b></center>The USTA Team number entered" + tagline + " is invalid and should consist of at least 5 digits only.<br>");
			redAndBoldit ("document.forms[0].elements['ustateamnum" + tagIndex + "']");
			return true;}
		case "tel_num:nonnum":
			{addErrorMessage ("tel_num" + tagIndex + ":nonnum", "<center><b>Data submission error !</b></center>The phone number entered" + tagline + " is invalid and should consist of 10 digits with an area code.<br>");
			redAndBoldit ("document.forms[0].elements['tel_num" + tagIndex + "']");
			return true;}
		case "tel_num:toolong":
			{addErrorMessage ("tel_num" + tagIndex + ":toolong", "<center><b>Data submission error !</b></center>The phone number entered" + tagline + " is invalid and should consist of 10 digits with an area code.<br>");
			redAndBoldit ("document.forms[0].elements['tel_num" + tagIndex + "']");
			return true;}
		case "empty:empty":
			{addErrorMessage ("empty:empty", "<center><b>Data submission error !</b></center>All form lines are blank or otherwise incomplete.<br>");
			return true;}
		case "nodep:nodep":
			{addErrorMessage ("nodep:nodep", "<center><b>Data submission error !</b></center>The membership type selected is Family but no dependants have been listed..<br>");
			return true;}
		case "txtfname:blank":
			{addErrorMessage ("txtfname" + tagIndex + ":blank", "<center><b>Data submission error !</b></center>The first name field" + tagline + " is blank.<br>");
			return true;}
		case "txtfname:nonalpha":
			{addErrorMessage ("txtfname" + tagIndex + ":nonalpha", "<center><b>Data submission error !</b></center>The first name field" + tagline + " can only consist of alpha characters, hyphens, etc.<br>");
			redAndBoldit ("document.forms[0].elements['txtfname" + tagIndex + "']");
			return true;}
		case "txtlname:blank":
			{addErrorMessage ("txtlname" + tagIndex + ":blank", "<center><b>Data submission error !</b></center>The last name field" + tagline + " is blank.<br>");
			return true;}
		case "txtlname:nonalpha":
			{addErrorMessage ("txtlname" + tagIndex + ":nonalpha", "<center><b>Data submission error !</b></center>The last name field" + tagline + " can only consist of alpha characters, hyphens, etc.<br>");
			redAndBoldit ("document.forms[0].elements['txtlname" + tagIndex + "']");
			return true;}
		case "txtMIName:nonalpha":
			{addErrorMessage ("txtMIName" + tagIndex + ":nonalpha", "<center><b>Data submission error !</b></center>The middle initial" + tagline + " can only be an alpha character.<br>");
			redAndBoldit ("document.forms[0].elements['txtMIName" + tagIndex + "']");
			return true;}
		case "txtmidname:nonalpha":
			{addErrorMessage ("txtmidname" + tagIndex + ":nonalpha", "<center><b>Data submission error !</b></center>The middle initial" + tagline + " can only be an alpha character.<br>");
			redAndBoldit ("document.forms[0].elements['txtmidname" + tagIndex + "']");
			return true;}
		case "txtaddr:blank":
			{addErrorMessage ("txtaddr" + tagIndex + ":blank", "<center><b>Data submission error !</b></center>The first address line field" + tagline + " is blank.<br>");
			return true;}
		case "txtcity:blank":
			{addErrorMessage ("txtcity" + tagIndex + ":blank", "<center><b>Data submission error !</b></center>The city field" + tagline + " is blank.<br>");
			return true;}
		case "txtcity:bad":
			{addErrorMessage ("txtcity" + tagIndex + ":blank", "<center><b>Data submission error !</b></center>The city field" + tagline + " must contain at least one alpha character.<br>");
			redAndBoldit ("document.forms[0].elements['txtcity" + tagIndex + "']");
			return true;}
		case "txtzip:blank":
			{addErrorMessage ("txtzip" + tagIndex + ":blank", "<center><b>Data submission error !</b></center>The zip field" + tagline + " is blank.<br>");
			return true;}
		case "txtzip:nonzip":
			{addErrorMessage ("txtzip" + tagIndex + ":nonzip", "<center><b>Data submission error !</b></center>The zip field" + tagline + " can only consist of 5 numeric characters.<br>");
			redAndBoldit ("document.forms[0].elements['txtzip" + tagIndex + "']");
			return true;}
		case "txtzip:badzip":
			{addErrorMessage ("txtzip" + tagIndex + ":badzip", "<center><b>Data submission error !</b></center>The zip field" + tagline + " is not a valid zip code.<br>");
			redAndBoldit ("document.forms[0].elements['txtzip" + tagIndex + "']");
			return true;}
		case "txthphonearea:nonnum":
			{addErrorMessage ("txthphonearea" + tagIndex + ":nonnum", "<center><b>Data submission error !</b></center>The home phone area code " + tagline + " can only contain numbers, spaces and dashes .<br>");
			return true;}
		case "txthphonenum:nonnum":
			{addErrorMessage ("txthphonenum" + tagIndex + ":nonnum", "<center><b>Data submission error !</b></center>The home phone number " + tagline + " can only contain number, dashes and parentheses.<br>");
			return true;}
		case "txtwphonearea:nonnum":
			{addErrorMessage ("txtwphonearea" + tagIndex + ":nonnum", "<center><b>Data submission error !</b></center>The work phone area code " + tagline + " can only contain number, dashes and parentheses.<br>");
			return true;}
		case "txtwphonenum:nonnum":
			{addErrorMessage ("txtwphonenum" + tagIndex + ":nonnum", "<center><b>Data submission error !</b></center>The work phone number " + tagline + " can only contain number, dashes and parentheses.<br>");
			return true;}
		case "txtfaxarea:nonnum":
			{addErrorMessage ("txtfaxarea" + tagIndex + ":nonnum", "<center><b>Data submission error !</b></center>The fax area code " + tagline + " can only contain number, dashes and parentheses.<br>");
			return true;}
		case "txtfaxnum:nonnum":
			{addErrorMessage ("txtfaxnum" + tagIndex + ":nonnum", "<center><b>Data submission error !</b></center>The fax number " + tagline + " can only contain number, dashes and parentheses.<br>");
			return true;}
		case "txthphonearea:toolong":
			{addErrorMessage ("txthphonearea" + tagIndex + ":toolong", "<center><b>Data submission error !</b></center>The home phone area code and number " + tagline + " combined must contain exactly 10 numeric digits.<br>");
			return true;}
		case "txthphonenum:toolong":
			{addErrorMessage ("txthphonenum" + tagIndex + ":toolong", "<center><b>Data submission error !</b></center>The home phone area code and number " + tagline + " combined must contain exactly 10 numeric digits.<br>");
			return true;}
		case "txtwphonearea:toolong":
			{addErrorMessage ("txtwphonearea" + tagIndex + ":toolong", "<center><b>Data submission error !</b></center>The work phone area code and number " + tagline + " combined must contain exactly 10 numeric digits.<br>");
			return true;}
		case "txtwphonenum:toolong":
			{addErrorMessage ("txtwphonenum" + tagIndex + ":toolong", "<center><b>Data submission error !</b></center>The work phone area code and number " + tagline + " combined must contain exactly 10 numeric digits.<br>");
			return true;}
		case "txtfaxarea:toolong":
			{addErrorMessage ("txtfaxarea" + tagIndex + ":toolong", "<center><b>Data submission error !</b></center>The fax area code and number " + tagline + " combined must contain exactly 10 numeric digits.<br>");
			return true;}
		case "txtfaxnum:toolong":
			{addErrorMessage ("txtfaxnum" + tagIndex + ":toolong", "<center><b>Data submission error !</b></center>The fax area code and number " + tagline + " combined must contain exactly 10 numeric digits.<br>");
			return true;}
		case "txtemail:badadd":
			{addErrorMessage ("txtemail:badadd", "<center><b>Data submission error !</b></center>The e-mail address supplied does not appear to be a valid e-mail address.<br>");
			return true;}
		case "txtstate:nonstate":
			{addErrorMessage ("txtstate" + tagIndex + ":nonstate", "<center><b>Data submission error !</b></center>No state has been selected for the state field" + tagline + ".<br>");
			redAndBoldit ("document.forms[0].elements['txtstate" + tagIndex + "']");
			return true;}
		case "txtdob:blank":
			{addErrorMessage ("txtdob" + tagIndex + ":blank", "<center><b>Data submission error !</b></center>The date of birth field" + tagline + " is blank.<br>");
			return true;}
		case "txtdob:nondate":
			{addErrorMessage ("txtdob" + tagIndex + ":nondate", "<center><b>Data submission error !</b></center>The value in the date of birth field" + tagline + " does not represent a valid date.<br>");
			redAndBoldit ("document.forms[0].elements['txtdob" + tagIndex + "']");
			return true;}
		case "txtdob:baddate":
			{addErrorMessage ("txtdob" + tagIndex + ":baddate", "<center><b>Data submission error !</b></center>The value in the date of birth field" + tagline + " does not represent a valid date or is not in the format mm/dd/yyyy.<br>");
			redAndBoldit ("document.forms[0].elements['txtdob" + tagIndex + "']");
			return true;}
		case "txtdob:futdate":
			{addErrorMessage ("txtdob" + tagIndex + ":futdate", "<center><b>Data submission error !</b></center>The value in the date of birth field" + tagline + " represents a date in the future or too far in the past.<br>");
			redAndBoldit ("document.forms[0].elements['txtdob" + tagIndex + "']");
			return true;}
		case "txtdob:gt19date":
			{addErrorMessage ("txtdob" + tagIndex + ":gt19date", "<center><b>Data submission error !</b></center>A Junior membership has been selected but the date in the date of birth field" + tagline + " indicates an age of 19 or over.<br>");
			redAndBoldit ("document.forms[0].elements['txtdob" + tagIndex + "']");
			return true;}
		case "txtdob:lt19date":
			{addErrorMessage ("txtdob" + tagIndex + ":lt19date", "<center><b>Data submission error !</b></center>An Adult membership has been selected but the date in the date of birth field" + tagline + " indicates an age under 19.<br>");
			redAndBoldit ("document.forms[0].elements['txtdob" + tagIndex + "']");
			return true;}
		case "txtdob:gt19nodob":
			{addErrorMessage ("txtdob" + tagIndex + ":gt19nodob", "<center><b>Data submission error !</b></center>A Junior membership has been selected but the date of birth field" + tagline + " has been left undeclared.<br>");
			redAndBoldit ("document.forms[0].elements['txtdob" + tagIndex + "']");
			return true;}
		case "gender:blank":
			{addErrorMessage ("gender" + tagIndex + ":blank", "<center><b>Data submission error !</b></center>The gender field" + tagline + " is blank.<br>");
			return true;}
		case "gender:nonmf":
			{addErrorMessage ("gender" + tagIndex + ":nonmf", "<center><b>Data submission error !</b></center>The value in the gender field" + tagline + " is neither M nor F<br>");
			redAndBoldit ("document.forms[0].elements['gender" + tagIndex + "']");
			return true;}
		case "txtgender:blank":
			{addErrorMessage ("gender" + tagIndex + ":blank", "<center><b>Data submission error !</b></center>The gender field" + tagline + " is blank.<br>");
			return true;}
		case "txtgender:nonmf":
			{addErrorMessage ("gender" + tagIndex + ":nonmf", "<center><b>Data submission error !</b></center>The value in the gender field" + tagline + " is neither Male nor Female<br>");
			redAndBoldit ("document.forms[0].elements['txtgender" + tagIndex + "']");
			return true;}
		case "cc_name:blank":
			{addErrorMessage ("cc_name" + tagIndex + ":blank", "<center><b>Data submission error !</b></center>The credit card name field" + tagline + " is blank.<br>");
			return true;}
		case "cc_name:nonalpha":
			{addErrorMessage ("cc_name" + tagIndex + ":nonalpha", "<center><b>Data submission error !</b></center>The credit card name field" + tagline + " can only consist of alpha characters, hyphens, spaces, etc.<br>");
			redAndBoldit ("document.forms[0].elements['cc_name" + tagIndex + "']");
			return true;}
		case "cc_num:bad":
			{addErrorMessage ("cc_num" + tagIndex + ":bad", "<center><b>Data submission error !</b></center>The credit card number field" + tagline + " can only consist of 15 or 16 numeric characters.<br>");
			redAndBoldit ("document.forms[0].elements['cc_num" + tagIndex + "']");
			return true;}
		case "cc_type:bad":
			{addErrorMessage ("cc_type" + tagIndex + ":bad", "<center><b>Data submission error !</b></center>The credit card type" + tagline + " is not valid.<br>");
			redAndBoldit ("document.forms[0].elements['cc_type" + tagIndex + "']");
			return true;}
		case "cc_expmonth:bad":
			{addErrorMessage ("cc_expmonth" + tagIndex + ":bad", "<center><b>Data submission error !</b></center>The credit card expiry month field" + tagline + " is not valid.<br>");
			redAndBoldit ("document.forms[0].elements['cc_expmonth" + tagIndex + "']");
			return true;}
		case "cc_expyear:bad":
			{addErrorMessage ("cc_expyear" + tagIndex + ":bad", "<center><b>Data submission error !</b></center>The credit card expiry year" + tagline + " is not valid.<br>");
			redAndBoldit ("document.forms[0].elements['cc_expyear" + tagIndex + "']");
			return true;}
		case "cc_expiry:bad":
			{addErrorMessage ("cc_expiry" + tagIndex + ":bad", "<center><b>Data submission error !</b></center>The credit card " + tagline + " seems to be expired.<br>");
			redAndBoldit ("document.forms[0].elements['cc_expyear" + tagIndex + "']");
			redAndBoldit ("document.forms[0].elements['cc_expmonth" + tagIndex + "']");
			return true;}
		case "cc_expiry:unselect":
			{addErrorMessage ("cc_expiry" + tagIndex + ":unselect", "<center><b>Data submission error !</b></center>Please select a valid expiry month and/or expiry year " + tagline + ".<br>");
			redAndBoldit ("document.forms[0].elements['cc_expyear" + tagIndex + "']");
			redAndBoldit ("document.forms[0].elements['cc_expmonth" + tagIndex + "']");
			return true;}
		case "cc_zip:blank":
			{addErrorMessage ("cc_zip" + tagIndex + ":blank", "<center><b>Data submission error !</b></center>The credit card zip field" + tagline + " is blank.<br>");
			return true;}
		case "cc_zip:nonzip":
			{addErrorMessage ("cc_zip" + tagIndex + ":nonzip", "<center><b>Data submission error !</b></center>The credit card zip field" + tagline + " can only consist of 5 numeric characters.<br>");
			redAndBoldit ("document.forms[0].elements['cc_zip" + tagIndex + "']");
			return true;}
		case "cc_zip:badzip":
			{addErrorMessage ("cc_zip" + tagIndex + ":badzip", "<center><b>Data submission error !</b></center>The credit card zip field" + tagline + " is not a valid zip code.<br>");
			redAndBoldit ("document.forms[0].elements['cc_zip" + tagIndex + "']");
			return true;}
		case "cc_amount:zero":
			{addErrorMessage ("cc_amount" + tagIndex + ":zero", "<center><b>Data submission error !</b></center>The credit card amount " + tagline + " is $0.00 and there appears to be nothing to update.<br>");
			return true;}
		case "email:badadd":
			{addErrorMessage ("email" + tagIndex + ":badadd", "<center><b>Data submission error !</b></center>The e-mail address supplied does not appear to be a valid e-mail address.<br>");
			return true;}	
		}
	return false;
	}
	
function restoreStaticText()		// This restores the static text by hiding the error text and
	{									// and unhiding the static text pane
	if (document.all)
		{
		document.all.staticmsg.style.display="";
		document.all.dynamicmsg.style.display="none";
		}
	else if (document.layers)
		{
		document.msgparent.document.dynamicmsg.visibility = "hide";
		document.msgparent.document.dynamicmsg.zIndex = 0;
		//document.msgparent.document.staticmsg.visibility = "show";
		document.msgparent.document.staticmsg.zIndex = 1;
		document.msgparent.document.staticmsg.document.write(staticText);
		document.msgparent.document.staticmsg.document.close();
		}
	else if (document.getElementById) {
		var e;
		e = document.getElementById('dynamicmsg');
		e.style.display = 'none';
		e = document.getElementById('staticmsg');
		e.style.display = '';
		e.style.width = '180px';
		e.style.height = e.style.height;
		}
	}
	
<!-- -->	
<!-- Get error message count by tag, get error message partner, and get count by partner routines -->	
<!-- -->	

function getErrorPartner (errorTagHalf)	// Finds the partner number of an error by reviewing error message <SCAN> tag
	{											// names looking for "name='(xxx:yyy)'" where xxx or yyy are supplied parameters
	i=0;
	while ((errorHolder.slice(i).indexOf("<SPAN") != -1))
		{
		thisErrorText = errorHolder.slice(i + errorHolder.slice(i).indexOf("<SPAN"), i + errorHolder.slice(i).indexOf("/SPAN>") + "/SPAN>".length);
		thisErrorTag = thisErrorText.slice(thisErrorText.indexOf("name"));
		thisErrorTag = thisErrorTag.slice(thisErrorTag.indexOf("(")+1);
		thisErrorTag = thisErrorTag.slice(0,thisErrorTag.indexOf(")")); 
		if (thisErrorTag.slice(0,thisErrorTag.indexOf(":")) == errorTagHalf)
			return thisErrorTag.slice(thisErrorTag.indexOf(":")+1);
		if (thisErrorTag.slice(thisErrorTag.indexOf(":")+1) == errorTagHalf)
			return thisErrorTag.slice(0,thisErrorTag.indexOf(":"));
		i = i + (errorHolder.slice(i).indexOf("/SPAN>") + "/SPAN>".length);
		}
		return("");
	}	

function getAllErrorPartners (errorTagHalf)	// Finds the partner number of an error by reviewing error message <SCAN> tag
	{												// names looking for "name='(xxx:yyy)'" where xxx or yyy are supplied parameters
	i=0;
	returnPartners = "";
	while ((errorHolder.slice(i).indexOf("<SPAN") != -1))
		{
		thisErrorText = errorHolder.slice(i + errorHolder.slice(i).indexOf("<SPAN"), i + errorHolder.slice(i).indexOf("/SPAN>") + "/SPAN>".length);
		thisErrorTag = thisErrorText.slice(thisErrorText.indexOf("name"));
		thisErrorTag = thisErrorTag.slice(thisErrorTag.indexOf("(")+1);
		thisErrorTag = thisErrorTag.slice(0,thisErrorTag.indexOf(")")); 
		if (thisErrorTag.slice(0,thisErrorTag.indexOf(":")) == errorTagHalf)
			returnPartners = returnPartners + thisErrorTag.slice(thisErrorTag.indexOf(":")+1) + ":";
		if (thisErrorTag.slice(thisErrorTag.indexOf(":")+1) == errorTagHalf)
			returnPartners = returnPartners + thisErrorTag.slice(0,thisErrorTag.indexOf(":")) + ":";
		i = i + (errorHolder.slice(i).indexOf("/SPAN>") + "/SPAN>".length);
		}
		return(returnPartners);
	}	

function getErrorPartnerCount (errorTagHalf)		// Finds the number (quantity) of an error type by reviewing error message <SCAN> tag
	{													// names looking for "name='(xxx:yyy)'" where xxx or yyy are supplied parameters
	i=0;
	j=0;
	while ((errorHolder.slice(i).indexOf("<SPAN") != -1))
		{
		thisErrorText = errorHolder.slice(i + errorHolder.slice(i).indexOf("<SPAN"), i + errorHolder.slice(i).indexOf("/SPAN>") + "/SPAN>".length);
		thisErrorTag = thisErrorText.slice(thisErrorText.indexOf("name"));
		thisErrorTag = thisErrorTag.slice(thisErrorTag.indexOf("(")+1);
		thisErrorTag = thisErrorTag.slice(0,thisErrorTag.indexOf(")")); 
		if (thisErrorTag.slice(0,thisErrorTag.indexOf(":")) == errorTagHalf)
			j=j+1;
		if (thisErrorTag.slice(thisErrorTag.indexOf(":")+1) == errorTagHalf)
			j=j+1;
		i = i + (errorHolder.slice(i).indexOf("/SPAN>") + "/SPAN>".length);
		}
		return j;
	}	
	
function getErrorCount (errorTag)				// Finds the number (quantity) of an error type by reviewing error message <SCAN> tag
	{												// names looking for "name='xxx'" where xxx is a supplied parameters
	i=0;
	j=0;
	while ((errorHolder.slice(i).indexOf("<SPAN") != -1))
		{
		thisErrorText = errorHolder.slice(i + errorHolder.slice(i).indexOf("<SPAN"), i + errorHolder.slice(i).indexOf("/SPAN>") + "/SPAN>".length);
		thisErrorTag = thisErrorText.slice(thisErrorText.indexOf("name"));
		thisErrorTag = thisErrorTag.slice(thisErrorTag.indexOf("'")+1);
		thisErrorTag = thisErrorTag.slice(0,thisErrorTag.indexOf("'")); 
		if (thisErrorTag == errorTag)
			j=j+1;
		i = i + (errorHolder.slice(i).indexOf("/SPAN>") + "/SPAN>".length);
		}
		return j;
	}		

<!-- -->	
<!-- Specific leagueregmulti1.asp routines to validate USTA number, team number, phone number -->	
<!-- -->	

function checkBlankLine (thisIndex)
	{
	if ((document.forms[0].elements["ustanum" + thisIndex].value == "") && (document.forms[0].elements["ustateamnum" + thisIndex].value == "") && !(document.forms[0].elements["yes_box" + thisIndex].checked) && (document.forms[0].elements["tel_num" + thisIndex].value == ""))
		return true;
	else
		return false;
	}

function checkUSTAnumber (thisIndex)
	{
	
	
	if (!(checkBlankLine(thisIndex)) && (document.forms[0].elements["ustanum" + thisIndex].value == "")) {if (getErrorCount("ustanum" + thisIndex + ":blank") == 0) addErrorMessageByTag ("ustanum" + thisIndex+ ":blank");}
	else
		{
		removeErrorMessage ("ustanum" + thisIndex + ":blank");
		if (!(IsNumeric(document.forms[0].elements["ustanum" + thisIndex].value)))
			{
			if (getErrorCount("ustanum" + thisIndex + ":nonnum") == 0)
				{
				addErrorMessageByTag ("ustanum" + thisIndex + ":nonnum");
				redAndBoldit ("document.forms[0].elements['ustanum" + thisIndex + "']");
				}
			}
		else
			{
			removeErrorMessage ("ustanum" + thisIndex + ":nonnum");
			if (document.forms[0].elements["ustanum" + thisIndex].value.length > 10)
				{
				if (getErrorCount("ustanum" + thisIndex + ":toolong") == 0)
					{
					addErrorMessageByTag ("ustanum" + thisIndex + ":toolong");
					redAndBoldit ("document.forms[0].elements['ustanum" + thisIndex + "']");
					}
				}
			else
				{
				removeErrorMessage ("ustanum" + thisIndex + ":toolong");
				//if ((getErrorCount("ustateamnum" + thisIndex + ":blank") == 0) && (getErrorCount("ustateamnum" + thisIndex + ":nonnum") == 0) && (getErrorCount("ustateamnum" + thisIndex + ":toolong") == 0) && (getErrorCount("ustateamnum" + thisIndex + ":dberror") == 0))
				//	{
					//checkdupe(thisIndex);
				//	}
				if (getErrorPartner("dupe" + thisIndex) == "")
					blackAndUnboldit ("document.forms[0].elements['ustanum" + thisIndex + "']");
				}
			}
		}
	
	}
	
function recheckUSTAnumber (thisIndex)
	{

	if (getErrorPartner("dupe" + thisIndex) == "")
		{
		removeErrorMessage ("ustanum" + thisIndex + ":dberror");
		removeErrorMessage ("ustaxxx" + thisIndex + ":dberror");
		if ((getErrorCount("ustanum" + thisIndex + ":blank") > 0) || (getErrorCount("ustanum" + thisIndex + ":nonnum") > 0) || (getErrorCount("ustanum" + thisIndex + ":toolong") > 0) || (document.forms[0].elements["ustateamnum" + thisIndex].value > "") || (document.forms[0].elements["tel_num" + thisIndex].value > ""))
			{
			removeErrorMessage ("ustanum" + thisIndex + ":blank");
			removeErrorMessage ("ustanum" + thisIndex + ":nonnum");
			removeErrorMessage ("ustanum" + thisIndex + ":toolong");
			if (getErrorPartner("dupe" + thisIndex) == "")
				blackAndUnboldit ("document.forms[0].elements['ustanum" + thisIndex + "']");
			checkUSTAnumber (thisIndex);
			}
		if (document.forms[0].elements["ustanum" + thisIndex].value > "")
			{			
			removeErrorMessage ("empty:empty");
			}
		else if (checkBlankLine(thisIndex))
			removeErrorMessage ("ustateamnum" + thisIndex + ":blank");
		}
	//else
		//checkdupe(thisIndex);
	
	}

function checkUSTAteamnumber (thisIndex)
	{
	if (!(checkBlankLine(thisIndex)) && (document.forms[0].elements["ustateamnum" + thisIndex].value == "")) {if (getErrorCount("ustateamnum" + thisIndex + ":blank") == 0) addErrorMessageByTag ("ustateamnum" + thisIndex+ ":blank");}
	else
		{
		removeErrorMessage ("ustateamnum" + thisIndex + ":blank");
		if (!(IsNumeric(document.forms[0].elements["ustateamnum" + thisIndex].value)))
			{
			if (getErrorCount("ustateamnum" + thisIndex + ":nonnum") == 0)
				{
				addErrorMessageByTag ("ustateamnum" + thisIndex + ":nonnum");
				redAndBoldit ("document.forms[0].elements['ustateamnum" + thisIndex + "']");
				}
			}
		else
			{
			removeErrorMessage ("ustateamnum" + thisIndex + ":nonnum");
			if (document.forms[0].elements["ustateamnum" + thisIndex].value.length < 5)
				{
				if (getErrorCount("ustateamnum" + thisIndex + ":toolong") == 0)
					{
					addErrorMessageByTag ("ustateamnum" + thisIndex + ":toolong");
					redAndBoldit ("document.forms[0].elements['ustateamnum" + thisIndex + "']");
					}
				}
			else
				{
				removeErrorMessage ("ustateamnum" + thisIndex + ":toolong");
				if ((getErrorCount("ustanum" + thisIndex + ":blank") == 0) && (getErrorCount("ustanum" + thisIndex + ":nonnum") == 0) && (getErrorCount("ustanum" + thisIndex + ":toolong") == 0) && (getErrorCount("ustanum" + thisIndex + ":dberror") == 0))
					{
					//checkdupe(thisIndex);
					checkcapn(thisIndex);
					}
				if ((getErrorPartner("dupe" + thisIndex) == "") && (getErrorPartner("capn" + thisIndex) == ""))
					blackAndUnboldit ("document.forms[0].elements['ustateamnum" + thisIndex + "']");
				}
			}
		}
	}
	
function recheckUSTAteamnumber (thisIndex)
	{
	//keep only numbers in team number
	var currentUSTATeamNumber;
	var currentChar;
	currentUSTATeamNumber = document.forms[0].elements["ustateamnum" + thisIndex].value;
	document.forms[0].elements["ustateamnum" + thisIndex].value = ""
	for (i=0; i < currentUSTATeamNumber.length;i++)
	{
		currentChar = currentUSTATeamNumber.substring(i,i+1);
		if (currentChar == "0" || currentChar == "1" || currentChar == "2" || currentChar == "3" || currentChar == "4" || currentChar == "5" || currentChar == "6" || currentChar == "7" || currentChar == "8" || currentChar == "9")
		{
			document.forms[0].elements["ustateamnum" + thisIndex].value = document.forms[0].elements["ustateamnum" + thisIndex].value + currentChar;
		};
	};
	
		
	if (getErrorPartner("dupe" + thisIndex) == "")
		{
		removeErrorMessage ("ustateamnum" + thisIndex + ":dberror");
		removeErrorMessage ("ustaxxx" + thisIndex + ":dberror");
		if ((getErrorCount("ustateamnum" + thisIndex + ":blank") > 0) || (getErrorCount("ustateamnum" + thisIndex + ":nonnum") > 0) || (getErrorCount("ustateamnum" + thisIndex + ":toolong") > 0) || (document.forms[0].elements["ustanum" + thisIndex].value > "") || (document.forms[0].elements["tel_num" + thisIndex].value > ""))
			{
			removeErrorMessage ("ustateamnum" + thisIndex + ":blank");
			removeErrorMessage ("ustateamnum" + thisIndex + ":nonnum");
			removeErrorMessage ("ustateamnum" + thisIndex + ":toolong");
			if ((getErrorPartner("dupe" + thisIndex) == "") && (getErrorPartner("capn" + thisIndex) == ""))
				blackAndUnboldit ("document.forms[0].elements['ustateamnum" + thisIndex + "']");
			checkUSTAteamnumber (thisIndex);
			}
		if (document.forms[0].elements["ustateamnum" + thisIndex].value > "")
			{
			removeErrorMessage ("empty:empty");
			recheckUSTAnumber(thisIndex);
			}
		else if (checkBlankLine(thisIndex))
			removeErrorMessage ("ustanum" + thisIndex + ":blank");
		}
	else
		//checkdupe(thisIndex);
		checkcapn(thisIndex);
	}

function checkTelnumber (thisIndex)
	{
	if (document.forms[0].elements["tel_num" + thisIndex].value.length > 0)
		{
		if (!(IsNumeric(StripTel(document.forms[0].elements["tel_num" + thisIndex].value))))
			{
			if (getErrorCount("tel_num" + thisIndex + ":nonnum") == 0)
				{
				
				addErrorMessageByTag ("tel_num" + thisIndex + ":nonnum");
				redAndBoldit ("document.forms[0].elements['tel_num" + thisIndex + "']");
				}
			}
		else
			{
			
			removeErrorMessage ("tel_num" + thisIndex + ":nonnum");
			if (StripTel(document.forms[0].elements["tel_num" + thisIndex].value).length != 10)
				{
				if (getErrorCount("tel_num" + thisIndex + ":toolong") == 0)
					{
					
					 addErrorMessageByTag ("tel_num" + thisIndex + ":toolong");
					 redAndBoldit ("document.forms[0].elements['tel_num" + thisIndex + "']");
					}
				}
			else
				{
				
				removeErrorMessage ("tel_num" + thisIndex + ":toolong");
				blackAndUnboldit ("document.forms[0].elements['tel_num" + thisIndex + "']");
				}
			}
		}
	}
	
function recheckTelnumber (thisIndex)
	{
	
	removeErrorMessage ("tel_num" + thisIndex + ":nonnum");
	removeErrorMessage ("tel_num" + thisIndex + ":toolong");
	blackAndUnboldit (document.forms[0].elements["tel_num" + thisIndex]);
	checkTelnumber (thisIndex);
	if (document.forms[0].elements["tel_num" + thisIndex].value > "")
		{
		removeErrorMessage ("empty:empty");
		recheckUSTAnumber(thisIndex);
		recheckUSTAteamnumber(thisIndex);
		}
	else
		{
		if ((document.forms[0].elements["ustanum" + thisIndex].value == "") && (document.forms[0].elements["ustateamnum" + thisIndex].value == ""))
			{
			removeErrorMessage ("ustateamnum" + thisIndex + ":blank");
			removeErrorMessage ("ustateamnum" + thisIndex + ":nonnum");
			removeErrorMessage ("ustateamnum" + thisIndex + ":toolong");
			blackAndUnboldit ("document.forms[0].elements['tel_num" + thisIndex + "']");
			removeErrorMessage ("ustanum" + thisIndex + ":blank");
			removeErrorMessage ("ustanum" + thisIndex + ":nonnum");
			removeErrorMessage ("ustanum" + thisIndex + ":toolong");
			blackAndUnboldit (document.forms[0].elements["ustanum" + thisIndex]);
			}
		}
	}
	function EmailCheck(thisIndex)
	{
	    
		if (document.forms[0].elements["email" + thisIndex].value > "")
		{
		    
			if (!((document.forms[0].elements["email" + thisIndex].value.indexOf("@") >= 0) && (document.forms[0].elements["email" + thisIndex].value.indexOf(".") >= 0)))
			{
			   
				if (getErrorCount("email" + thisIndex + ":badadd") == 0)
				{
				    
					addErrorMessageByTag ("email" + thisIndex + ":badadd");
					redAndBoldit ("document.forms[0].elements['email" + thisIndex + "']");
				}
			}
			else
			{
			       
			    
				removeErrorMessage ("email" + thisIndex + ":badadd");
				blackAndUnboldit ("document.forms[0].elements['email" + thisIndex + "']");
				
			}
		}
	}
    function reEmailCheck(thisIndex)
	{
	  
	   
	    //if (getErrorCount("email" + thisIndex + ":badadd") > 0)
		//{ 		   
			removeErrorMessage ("email" + thisIndex + ":badadd");
			blackAndUnboldit ("document.forms[0].elements['email" + thisIndex + "']");
			EmailCheck(thisIndex);
			
		//}
	}
	
	
	
	
	function NTRPCheck(thisIndex)
	{
	
	 
	      if (document.forms[0].elements["ntrprating" + thisIndex].value == "")
		 {
		
		   
					//addErrorMessageByTag ("ntrprating" + thisIndex + ":badadd");
					redAndBoldit ("document.forms[0].elements['ntrprating" + thisIndex + "']");
		 }
		 else
		 {
		            recheckUSTAnumber(thisIndex);
					recheckUSTAteamnumber(thisIndex);
		       //  blackAndUnboldit (document.forms[0].elements["ustanum" + thisIndex]);
		       //  blackAndUnboldit (document.forms[0].elements["ustateamnum" + thisIndex]);
		         blackAndUnboldit ("document.forms[0].elements['ntrprating" + thisIndex + "']");
		
		 }	
		}
	
	
	
	function recheckNTRPnumber(thisIndex)
	{
	  
	   
	    //if (getErrorCount("ntrprating" + thisIndex + ":badadd") > 0)
		//{ 		   
			//removeErrorMessage ("ntrprating" + thisIndex + ":badadd");
			blackAndUnboldit ("document.forms[0].elements['ntrprating" + thisIndex + "']");
			NTRPCheck(thisIndex);
			
		//}
	}
	
	
	
	
	
	
	
	
	
	
	
<!-- -->
<!-- Check for duplicates across teams for supplied team number and USTA number -->
<!-- -->

function checkdupe(thisIndex)
	{
	if (getErrorPartner("dupe" + thisIndex) == "")
		{
		for (i = 0; i < document.forms[0].elements.length; i++)
			if ((valueOfName(document.forms[0].elements[i].name) == "ustanum") && (indexOfName(document.forms[0].elements[i].name) != thisIndex))
				{
				possIndex = indexOfName(document.forms[0].elements[i].name);
				if ((document.forms[0].elements["ustanum" + possIndex].value == document.forms[0].elements["ustanum" + thisIndex].value) && (document.forms[0].elements["ustateamnum" + possIndex].value == document.forms[0].elements["ustateamnum" + thisIndex].value) && !(document.forms[0].elements["remove_box" + thisIndex].checked || document.forms[0].elements["remove_box" + possIndex].checked))
					{
					addErrorMessage("(dupe" + thisIndex + ":dupe" + possIndex + ")", "<br>The USTA number and team number on line #" + possIndex + " duplicate the information on line #" + thisIndex + ".  Please change the duplicate information.<br>");
					redAndBoldit("document.forms[0].elements['ustanum" + thisIndex + "']");
					redAndBoldit("document.forms[0].elements['ustanum" + possIndex+ "']");
					redAndBoldit("document.forms[0].elements['ustateamnum" + thisIndex + "']");
					redAndBoldit("document.forms[0].elements['ustateamnum" + possIndex+ "']");
					return false;
					}
				}
		}
	else
		{
		while (getErrorPartner("dupe" + thisIndex) > "") {
			thisDupe = indexOfName(getErrorPartner("dupe" + thisIndex));
			if ((document.forms[0].elements["ustanum" + thisDupe].value == document.forms[0].elements["ustanum" + thisIndex].value) && (document.forms[0].elements["ustateamnum" + thisDupe].value == document.forms[0].elements["ustateamnum" + thisIndex].value) && !(document.forms[0].elements["remove_box" + thisIndex].checked || document.forms[0].elements["remove_box" + thisDupe].checked)) {
				return false;
			}
			else {
				removeErrorMessage("(dupe" + thisIndex + ":dupe" + thisDupe + ")");
				removeErrorMessage("(dupe" + thisDupe + ":dupe" + thisIndex + ")");
				recheckUSTAnumber(thisDupe);
				recheckUSTAteamnumber(thisDupe);
			}
		}
		recheckUSTAnumber(thisIndex);
		recheckUSTAteamnumber(thisIndex);
		}
		return true;
	}

<!-- -->
<!-- Check captain consistency across teams for supplied team number or captain check box -->
<!-- -->

function checkcapn(thisIndex)			// Check if duplicate captains for any team. NOTE !!!!!!!!!
											// Relies on ustateamnum999, yes_box999 element name style
	{
	
	//////////////////////////////////////////////////////////////////////////////////////////////////////////
	// ADDED BY DWHALEN (06/05/2003) -- We can't check for duplicate captains on the front-end anymore.  The
	// Teams in question may or may not allow for co-captains.  The only way to know is to submit through.
	return;
	//////////////////////////////////////////////////////////////////////////////////////////////////////////
						
	if (getErrorPartner("capn" + thisIndex) == "")
		{
		
		for (i = 0; i < document.forms[0].elements.length; i++)
			if ((valueOfName(document.forms[0].elements[i].name) == "ustanum") && (indexOfName(document.forms[0].elements[i].name) != thisIndex))
				{
				possIndex = indexOfName(document.forms[0].elements[i].name);
				if ((document.forms[0].elements["yes_box" + possIndex].checked) && (document.forms[0].elements["yes_box" + thisIndex].checked) && (document.forms[0].elements["ustateamnum" + possIndex].value == document.forms[0].elements["ustateamnum" + thisIndex].value))
					{
					addErrorMessage("(capn" + thisIndex + ":capn" + possIndex + ")", "<br>The team captain marked on line #" + thisIndex + " duplicates the team captain marked on line #" + possIndex + ".  Only one team captain is allowed per team.  Please correct the duplicate information.<br>");
					redAndBoldit("document.forms[0].elements['ustateamnum" + thisIndex + "']");
					redAndBoldit("document.forms[0].elements['ustateamnum" + possIndex+ "']");
					return true;
					}
				}
		}
	else
		{
		while (getErrorPartner("capn" + thisIndex) > "")
			{
			thiscapn = indexOfName(getErrorPartner("capn" + thisIndex));
			if ((document.forms[0].elements["yes_box" + thiscapn].checked) && (document.forms[0].elements["yes_box" + thisIndex].checked) && (document.forms[0].elements["ustateamnum" + thiscapn].value == document.forms[0].elements["ustateamnum" + thisIndex].value)) {
				//displayEachError('ustanum1:blank', '<center><b>The team captain marked on line #' + thiscapn + ' duplicates the team captain marked on line #' + thisIndex + '.  Only one team captain is allowed per team.  Please correct the duplicate information.<br>');
				//addErrorMessage("(capn" + thiscapn + ":capn" + possIndex + ")", "<br>The team captain marked on line #" + thisIndex + " duplicates the team captain marked on line #" + possIndex + ".  Only one team captain is allowed per team.  Please correct the duplicate information.<br>");
				return true;
			}
			else
				removeErrorMessage("(capn" + thisIndex + ":capn" + thiscapn + ")");
				removeErrorMessage("(capn" + thiscapn + ":capn" + thisIndex + ")");
				recheckUSTAteamnumber(thiscapn);
			}
		recheckUSTAteamnumber(thisIndex);
		}
	if (!(document.forms[0].elements["yes_box" + thisIndex].checked))
		{
		removeErrorMessage ("ustaxxx" + thisIndex + ":dberror");
		blackAndUnboldit ("document.forms[0].elements['ustanum" + thisIndex + "']");
		blackAndUnboldit ("document.forms[0].elements['ustateamnum" + thisIndex + "']");
		}
	}

<!-- -->	
<!-- Routines to test for valid name (alphacharacters plus space, comma, hyphen, period, apostrophe and parenthese), valid alpha, etc -->
<!-- -->	

function IsName (thisString)
	{
	for (i=0; i < thisString.length; i++)
		if (!(((thisString.charAt(i) >= "a") && (thisString.charAt(i) <= "z")) || ((thisString.charAt(i) >= "A") && (thisString.charAt(i) <= "Z")) || (thisString.charAt(i) == " ") || (thisString.charAt(i) == ",") || (thisString.charAt(i) == "-") || (thisString.charAt(i) == ".") || (thisString.charAt(i) == "'") || (thisString.charAt(i) == "(") || (thisString.charAt(i) == ")")))
			return false;
	return true;
	}

function IsCCName (thisString)
	{
	for (i=0; i < thisString.length; i++)
		if (!(((thisString.charAt(i) >= "a") && (thisString.charAt(i) <= "z")) || ((thisString.charAt(i) >= "A") && (thisString.charAt(i) <= "Z")) || (thisString.charAt(i) == " ") || (thisString.charAt(i) == ",") || (thisString.charAt(i) == "-") || (thisString.charAt(i) == ".") || (thisString.charAt(i) == "'") || (thisString.charAt(i) == "(") || (thisString.charAt(i) == ")")))
			return false;
	return true;
	}

function IsAlpha (thisString)
	{
	for (i=0; i < thisString.length; i++)
		if (!(((thisString.charAt(i) >= "a") && (thisString.charAt(i) <= "z")) || ((thisString.charAt(i) >= "A") && (thisString.charAt(i) <= "Z"))))
			return false;
	return true;
	}
	
function AtLeastOneAlpha (thisString)
	{
	for (i=0; i < thisString.length; i++)
		if (((thisString.charAt(i) >= "a") && (thisString.charAt(i) <= "z")) || ((thisString.charAt(i) >= "A") && (thisString.charAt(i) <= "Z")))
			return true;
	return false;
	}
	
function IsNumeric (thisString)
	{
	for (i=0; i < thisString.length; i++)
		if (!((thisString.charAt(i) >= "0") && (thisString.charAt(i) <= "9")))
			return false;
	return true;
	}
	
function spaceTrim (thisString)
	{
	while (thisString.slice(0, 1) == " ")
		thisString = thisString.slice(1);
	while (thisString.slice(thisString.length-1, 1) == " ")
		thisString = thisString.slice(0, thisString.length-2);
	return thisString;
	}
	
function StripTel(thisString)
	{
	var tempString;
	tempString = "";
	for (i=0; i < thisString.length; i++)
		if ((thisString.slice(i,i+1) != "(") && (thisString.slice(i,i+1) != ")") && (thisString.slice(i,i+1) != " ") && (thisString.slice(i,i+1) != "-"))	tempString = tempString + thisString.slice(i,i+1);
	return tempString;
	}
	
function getDaysInMonthAlpha (monthString)
	{
	if (monthString.length > 3) monthString = monthString.slice(0,2);
	switch (monthString)
		{
		case "Jan" : {daysInMonth = "31"; break;}
		case "Feb" : {daysInMonth = "29"; break;}
		case "Mar" : {daysInMonth = "31"; break;}
		case "Apr" : {daysInMonth = "30"; break;}
		case "May" : {daysInMonth = "31"; break;}
		case "Jun" : {daysInMonth = "30"; break;}
		case "Jul" : {daysInMonth = "31"; break;}
		case "Aug" : {daysInMonth = "31"; break;}
		case "Sep" : {daysInMonth = "30"; break;}
		case "Oct" : {daysInMonth = "31"; break;}
		case "Nov" : {daysInMonth = "30"; break;}
		case "Dec" : {daysInMonth = "31"; break;}
		default: {daysInMonth = "99"; break;}
		}
	return daysInMonth;
	}

function getDaysInMonth (monthString)
	{
	if (monthString.length > 3) monthString = monthString.slice(0,2);
	switch (monthString)
		{
		case "01" : {daysInMonth = "31"; break;}
		case "02" : {daysInMonth = "29"; break;}
		case "03" : {daysInMonth = "31"; break;}
		case "04" : {daysInMonth = "30"; break;}
		case "05" : {daysInMonth = "31"; break;}
		case "06" : {daysInMonth = "30"; break;}
		case "07" : {daysInMonth = "31"; break;}
		case "08" : {daysInMonth = "31"; break;}
		case "09" : {daysInMonth = "30"; break;}
		case "10" : {daysInMonth = "31"; break;}
		case "11" : {daysInMonth = "30"; break;}
		case "12" : {daysInMonth = "31"; break;}
		default: {daysInMonth = "99"; break;}
		}
	return daysInMonth;
	}
	
function IsZip (thisString)
	{
	for (i=0; i < thisString.length; i++)
		if (!(((thisString.charAt(i) >= "a") && (thisString.charAt(i) <= "z")) || ((thisString.charAt(i) >= "A") && (thisString.charAt(i) <= "Z")) || ((thisString.charAt(i) >= "0") && (thisString.charAt(i) <= "9")) || (thisString.charAt(i) == " ")))
			return false;
	if (thisString.length > 9)
			return false;
	if (thisString == "00000")
			return false;	
	return true;
//
//			Allow only US style 5 numeric digit Zips for now 
//
//	if ((thisString.length == 5) && (IsNumeric(thisString)))
//		return true;
//	else
//		return false;
	}
	
<!-- -->	
<!-- Check for returned errors via &errorx= or &dberrorx= and display with supplied or canned text  -->	
<!-- -->	

function checkReturnedErrors (returnedErrorString)
	{

	returnedErrorString = unescape(returnedErrorString);
	if (returnedErrorString.length > 1)
		while ((returnedErrorString.slice(0,1) == "&") || (returnedErrorString.slice(0,1) == "?"))
			{
			returnedErrorString = unescape(returnedErrorString.slice(1));
			if (returnedErrorString.indexOf("&") > 0)
				thisTag = unescape(returnedErrorString.slice(0, returnedErrorString.indexOf("&")));
			else
				thisTag = unescape(returnedErrorString);
			returnedErrorString = returnedErrorString.slice(returnedErrorString.indexOf("&"));
			thisTagLabel = thisTag.slice(0, thisTag.indexOf("="));
			thisTagValue = thisTag.slice(thisTag.indexOf("=")+1);
			thisTagIndex = indexOfName(thisTagLabel);
			thisTagName = valueOfName(thisTagLabel);
			thisTagValueLeft = thisTagValue.slice(0,thisTagValue.indexOf(":"));
			thisTagValueRight = thisTagValue.slice(thisTagValue.indexOf(":")+1);
			if (thisTagValueRight.indexOf("=") > 0)
				{
				thisTagValueParam = unescape(thisTagValue.slice(thisTagValue.indexOf("=")+1));
				thisTagValueRight = thisTagValueRight.slice(0, thisTagValueRight.indexOf("="));
				}
			else
				thisTagValueParam = "";
			if (thisTagName == "dberror")
				{
				if (thisTagValueRight == "dbText")
					{
					if (thisTagValueParam.slice(0,1) == "@")
						if (thisTagIndex > "")
						{
							//addErrorMessage (thisTagValueLeft + ":dberror", "<center><b>Database check error !</b></center><br>Line #" + thisTagIndex + ": " + getErrorMessage(thisTagValueParam, thisTagIndex) + "<br>");
							  addErrorMessage (thisTagValueLeft + ":dberror", "Line #" + thisTagIndex + ": " + getErrorMessage(thisTagValueParam, thisTagIndex) + "<br>");
							  
						}
						else
							//addErrorMessage (thisTagValueLeft + ":dberror", "<center><b>Database check error !</b></center><br>" + getErrorMessage(thisTagValueParam, thisTagIndex) + "<br>");
							addErrorMessage (thisTagValueLeft + ":dberror", "" + getErrorMessage(thisTagValueParam, thisTagIndex) + "<br>");
					else
						if (thisTagIndex > "")
							//addErrorMessage (thisTagValueLeft + ":dberror", "<center><b>Database check error !</b></center><br>Line #" + thisTagIndex + ": " + thisTagValueParam + "<br>");
							  addErrorMessage (thisTagValueLeft + ":dberror", "Line #" + thisTagIndex + ": " + thisTagValueParam + "<br>");	
						else
							//addErrorMessage (thisTagValueLeft + ":dberror", "<center><b>Database check error !</b></center><br>" + thisTagValueParam + "<br>");
								addErrorMessage (thisTagValueLeft + ":dberror", "" + thisTagValueParam + "<br>");
					
					if (thisTagValueLeft == "ustaxxx" + thisTagIndex)
						{
						redAndBoldit("document.forms[0].elements.ustanum" + thisTagIndex);
						redAndBoldit("document.forms[0].elements.ustateamnum" + thisTagIndex);
						//redAndBoldit("document.forms[0].elements.ntrprating" + thisTagIndex);
						}
					else
						if (thisTagValueLeft != "nonfield")
							redAndBoldit("document.forms[0].elements." + thisTagValueLeft);
							//redAndBoldit("document.forms[0].elements.ntrprating" + thisTagIndex);
					}
				}
			if (thisTagName == "ccerror")
				{
				if (thisTagValueRight == "ccText")
					{
					if (thisTagValueParam.slice(0,1) == "@")
						addErrorMessage ("ccerror:ccerror", "<center><b>Credit check error !</b></center>" + getErrorMessage(thisTagValueParam, thisTagIndex) + "</FONT><br>");
					else
						addErrorMessage ("ccerror:ccerror", "<center><b>Credit check error !</b></center>" + thisTagValueParam + "</FONT><br>");
					}
				}
			if (thisTagName == "error")
				{
				if (!(addErrorMessageByTag(thisTagValue)))
					{
					if ((valueOfName(thisTagValueLeft) == "(dupe") && (thisTagValueRight.slice(0,4) == "dupe"))
						{
						thisTagValueRight = thisTagValueRight.slice(0, thisTagValueRight.length-1);
						addErrorMessage (thisTagValueLeft + ":" + thisTagValueRight + ")", "<br>The USTA number and team number on line #" + indexOfName(thisTagValueLeft) + "duplicate the information on line #" + indexOfName(thisTagValueRight) + ".  Please change the duplicate information.<br>");
						redAndBoldit("document.forms[0].elements['ustanum" + indexOfName(thisTagValueLeft) + "']");
						redAndBoldit("document.forms[0].elements['ustateamnum" + indexOfName(thisTagValueLeft) + "']");
						redAndBoldit("document.forms[0].elements['ustanum" + indexOfName(thisTagValueRight) + "']");
						redAndBoldit("document.forms[0].elements['ustateamnum" + indexOfName(thisTagValueRight) + "']");
						}
					if ((valueOfName(thisTagValueLeft) == "(capn") && (thisTagValueRight.slice(0,4) == "capn"))
						{
						thisTagValueRight = thisTagValueRight.slice(0, thisTagValueRight.length-1);
						addErrorMessage (thisTagValueLeft + ":" + thisTagValueRight + ")", "<br>The team captain marked on line #" + indexOfName(thisTagValueLeft) + " duplicates the team captain marked on line #" + indexOfName(thisTagValueRight) + ".  Only one team captain is allowed per team.  Please correct the duplicate information.<br>");
						redAndBoldit("document.forms[0].elements['ustateamnum" + indexOfName(thisTagValueLeft) + "']");
						redAndBoldit("document.forms[0].elements['ustateamnum" + indexOfName(thisTagValueRight) + "']");
						}
					}
				}
			}
	}


function openNTRP()
{
	window.open('/leagues/selfrate/ExperiencedPlayerGuidelines.pdf','','toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=yes');
	return false; 
}

function openSelfRate(MemberNum, TeamNum)
{
	MemberNum += "";
	TeamNum += "";
	var w;
	var h;
	w = 600;
	h = 550;
	if (window.screen) {
		w = window.screen.availWidth;
		h = window.screen.availHeight;
	}
	
	if ((MemberNum.length > 0)&&(TeamNum.length > 0))
	{
		window.open('../SelfRate/Questionnaire.asp?ustanum=' + MemberNum + '&teamnum=' + TeamNum,'SelfRate','toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=yes', 'SelfRate','width='+w+',height='+h+',top=0,left=0');	
	}
	else
	{
		alert("Please enter a valid member number and team number");
	}
}

function openAppeal(MemberNum, TeamNum)
{
	MemberNum += "";
	TeamNum += "";
	var w;
	var h;
	w = 800;
	h = 600;
	if (window.screen) {
		w = window.screen.availWidth;
		h = window.screen.availHeight;
	}
	
	if ((MemberNum.length > 0)&&(TeamNum.length > 0))
	{
		window.open('../SelfRate/appeal.asp?ustanum=' + MemberNum + '&teamnum=' + TeamNum,'SelfRate','toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=yes', 'SelfRate','width='+w+',height='+h+',top=0,left=0');	
	}
	else
	{
		alert("Please enter a valid member number and team number");
	}
}

function openAutoAppeal(MemberNum, TeamNum, RatingType)
{
	MemberNum += "";
	TeamNum += "";
	RatingType+="";
	var w;
	var h;
	w = 830;
	h = 610;
	
	if ((MemberNum.length > 0)&&(TeamNum.length > 0))
	{
		window.open('../Appeal/AppealEntry.aspx?membernum=' + MemberNum + '&teamnum=' + TeamNum + '&coord=' + eval("document.multireg.USTANumber.value") + '&rtype=' + RatingType + '&appealsource=plc','Appeal','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width='+w+',height='+h+',top=90,left=100', 'SelfRate');	
	}
	else
	{
		alert("Please enter a valid member number and team number");
	}
}

function bMentorOpen (sHref) {
				window.open(sHref, '_blank', 'width=830,height=610,scrollbars=yes,status=no,top=90,left=100');
			}

function getErrorMessage (messageTag, messageIndex)
	{
	var errInfo = messageTag.split(':');
	//var SelfRateLink = "<br><br><a href=# onCLick=\"openSelfRate(" + eval("document.multireg.ustanum"+messageIndex+".value") + ", " + eval("document.multireg.ustateamnum"+messageIndex+".value") +")\"><b><font color=blue>Self-Rate this player </font></b></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=# onCLick=\"openNTRP()\"><b><font color=blue>General &amp; Experienced Player Guidelines</font></b></a>"
//LGS-318 - modifed to allow leading 0's in the team code
	var SelfRateLink = "<br><br><a href=# onCLick=\"openSelfRate(" + 
						eval("document.multireg.ustanum"+messageIndex+".value") + 
						", " + 
						"'" + eval("document.multireg.ustateamnum"+messageIndex+".value") + "'" +
						")\"><b><font color=blue>Click here to Self-Rate this player </font></b></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=# onCLick=\"openNTRP()\"><b><font color=blue>General &amp; Experienced Player Guidelines</font></b></a>"

	switch (errInfo[0])
		{
		case "@1":
			return "Player already listed for this team.";
		case "@2":
			return "Registration for teams in different sections cannot be completed in the same transaction. Please complete a separate transaction for registrants in a different section.";
		case "@3":
			return "Player is already registered on this team.";
		case "@4":
			return "Number entered is not an active membership. Edit entry.";
		case "@5":
			return "Membership number has expired.  Edit or delete entry and contact membership services (1-800-990-8782) to renew.";
		case "@6":
			//return "This membership is not paid through the League Season. Edit or delete entry and contact membership services (1-800-990-8782) to renew.";
			//TL-966: Leagues - Renew membership duffle bag promotion  **** Remove on May 31, 2008 ****
			document.getElementById("msgDufflePromo").style.visibility = "visible";
			return "This membership is not paid through the League Season.  Edit or delete entry and contact membership services at <a href='http://www.usta.com/membership'>www.usta.com/membership</a> or call 800-990-8782 to renew.<br>Renew now for 5 years and receive 1 year FREE, plus a <a href='../images/League_duffle_bag.jpg' target='_blank'>USTA League duffle bag*</a>. Renew now and use source code: 8501. Hurry, this offer expires soon!<br>";
		case "@7":
			return "The membership record indicates this player is a male; team number entered is for a female team.  Edit entry or contact membership services (1-800-990-8782) to correct record.";
		case "@8":
			return "The membership record indicates this player is a female; team number entered is for a male team.  Edit entry or contact membership services (1-800-990-8782) to correct record.";
		case "@9":
			return "Registration for this team is not open at this time.  Edit or delete entry.";
		case "@10":
			return "The team you selected is not accepting registration at this time. If you made an error, enter the information again, or for additional information, contact your team captain or local league coordinator.";
		case "@11":
			return "Player entered does not meet age requirements for team.  Edit or delete entry and contact membership services (1-800-990-8782) to correct membership.";
		case "@12":
			return "Player’s rating is too high for team entered – Edit entry or <a href=# onCLick=\"openAutoAppeal(" + eval("document.multireg.ustanum"+messageIndex+".value") + ", '" + eval("document.multireg.ustateamnum"+messageIndex+".value") +"','')\"><b><font color=blue>Appeal Rating </font></b></a><br /><a href='/leagues/appeal/AppealInfo.aspx' onclick='bMentorOpen(this.href); return false'>Click here for more information about the automated appeal process</a>";
		case "@13":
			return "The system is currently unavailable.  Please try again at a later time.";
		case "@14":
			return "The team you selected has an incomplete profile. If you believe this information is correct, please contact the USTA at 1-800-990-USTA to speak with a customer service representative.";
		case "@15":
			return "Our records indicate that the profile for this member is incomplete. To correct the information, contact the USTA at 1-800-990-USTA to speak with a customer service representative.";
		case "@15dob":
			return "This player does not have a declared date of birth. Edit or delete entry and contact membership services (1-800-990-8782) to correct membership."; 
		case "@15gender":
			return "This player does not have a declared gender. Edit or delete entry and contact membership services (1-800-990-8782) to correct membership.";
		case "@16":
			return "Our records indicate that this member is already registered for this team.";
		case "@17":
			return "Team Number invalid – edit entry or contact captain or coordinator for correct number.";
		case "@18":
			return "The USTA number you entered is not valid.";
		case "@19":
			return "A system error prevents us from completing this transaction. Contact the USTA at 1-800-990-USTA to speak with a customer service representative.";
		case "@20":
			return "An NTRP rating is required to register for this team. There is no NTRP rating on file for this member. If you have any questions, please contact your Local League Coordinator.";
		case "@21":
			return "A system error prevents us from completing this transaction. Please contact the USTA at 1-800-990-USTA to speak with a customer service representative.";
		case "@22":
			return "We were unable to find a local chapter and county for the state and zip you supplied. Please correct or contact the USTA at 1-800-990-USTA to speak with a customer service representative.";
		case "@23":
			return "This team already has captains.  Please remove captain designation and contact your League Coordinator if there is an error.";
		case "@24":
			return "The team number you selected is no longer valid . If you made an error, enter the information again, or for additional information contact your team captain or local league coordinator.";
		case "@25":
		    return "A system error prevents us from completing this transaction. Please try again later, or contact our Member Services Center for assistance at 1-800-990-8782, M-F, 9AM-5PM Eastern Time.";
		case "@30":
		    return "Review the General &amp; Experienced Player Guidelines and Self-Rate this player. A self-rating describes individual playing level, not the team level." + SelfRateLink;
        case "@31":
		    return "Review the General &amp; Experienced Player Guidelines and Self-Rate this player. A self-rating describes individual playing level, not the team level." + SelfRateLink;
        case "@32":
			//ADDED BY DWHALEN -- To coincide with updates to dupregvalidatestep2.asp (cf)
		    return "Only one self-rating level can be selected.";
		case "@33":
			return "Player already has an NTRP rating.";
		case "@34":
			return "The team captain on line #" + errInfo[1] + " duplicates the team captain on this line. Only one team captain is allowed for this team.  Please correct the duplicate information.";
		case "@34A":
			return "Only two team captains are allowed for this team.  Please correct the duplicate information.";
		case "@35":
			return "This line duplicates with line #" + errInfo[1] + ". Please correct the duplicate information.";
		case "@36":
			return "NTRP rating for this player is expired. Please enter a new Self-Rating.  If not sure, view Self-Rating Guide.  A self-rating describes individual playing level, not the team level." + SelfRateLink;
		case "@37":
			return "NTRP rating for this player is expired. Please enter a new Self-Rating.  If not sure, view Self-Rating Guide.  A self-rating describes individual playing level, not the team level." + SelfRateLink;
		//ADDED 6/23 -- new league restrictions need error messages:
		case "@41":
			return "This player is already registered on a team at this level.  Edit or delete the entry.";
		case "@42":
			return "The player is already registered for the max number of teams in this league.  Edit or delete the entry.";
		case "@43":
			return "Player’s rating is too high for team entered – Edit entry or <a href=# onCLick=\"openAppeal(" + eval("document.multireg.ustanum"+messageIndex+".value") + ", '" + eval("document.multireg.ustateamnum"+messageIndex+".value") +"')\"><b><font color=blue>Appeal Rating </font></b></a>";
		case "@44":
			return "Player’s rating is too high for team entered – Edit entry, Player already requested an appeal within the past year";
		case "@45":
			return "Player’s rating is greater than the maximum allowed for a Doubles player in the flight for this Combined League – Edit entry or <a href=# onCLick=\"openAutoAppeal(" + eval("document.multireg.ustanum"+messageIndex+".value") + ", '" + eval("document.multireg.ustateamnum"+messageIndex+".value") +"','')\"><b><font color=blue>Appeal Rating </font></b></a><br /><a href='/leagues/appeal/AppealInfo.aspx' onclick='bMentorOpen(this.href); return false'>Click here for more information about the automated appeal process</a>";
		case "@46":
			return "Player’s rating is too high for team entered – Edit entry or <a href=# onCLick=\"openAutoAppeal(" + eval("document.multireg.ustanum"+messageIndex+".value") + ", '" + eval("document.multireg.ustateamnum"+messageIndex+".value") +"','D')\"><b><font color=blue>Appeal Rating </font></b></a><br /><a href='/leagues/appeal/AppealInfo.aspx' onclick='bMentorOpen(this.href); return false'>Click here for more information about the automated appeal process</a>";
		case "@47":
			return "Dynamic ratings are being updated. Please try again later.";
		case "@48":
			return "Player’s rating is greater than the maximum allowed for a Doubles player in the flight for this Combined League – Edit entry or <a href=# onCLick=\"openAutoAppeal(" + eval("document.multireg.ustanum"+messageIndex+".value") + ", '" + eval("document.multireg.ustateamnum"+messageIndex+".value") +"','D')\"><b><font color=blue>Appeal Rating </font></b></a><br /><a href='/leagues/appeal/AppealInfo.aspx' onclick='bMentorOpen(this.href); return false'>Click here for more information about the automated appeal process</a>"	;
	    case "@49":
			return "Player’s rating is greater than the maximum allowed for a Doubles player in the flight for this Combined League – Edit entry or <a href=# onCLick=\"openAppeal(" + eval("document.multireg.ustanum"+messageIndex+".value") + ", '" + eval("document.multireg.ustateamnum"+messageIndex+".value") +"')\"><b><font color=blue>Appeal Rating </font></b></a>";
		}

	}

<!-- -->	
<!-- Generic routine for checking form before submit  -->	
<!-- -->	

function checkForErrors ()
		{
		while (getErrorCount ("submit:nogo") > 0)
			removeErrorMessage ("submit:nogo");
		while (getErrorCount ("ccerror:ccerror") > 0)
			removeErrorMessage ("ccerror:ccerror");
		if (errorHolder > "")
			{
			errorHolder = "<SPAN name='submit:nogo'><center>There are errors on the form. Please resolve them and resubmit.<br></center></SPAN>" + errorHolder; 
			displayErrorText (errorHolder);
			return false;
			}
		else
		return true;
		}
	
<!-- -->	
<!-- Specific routines for checking memnew1.asp  -->	
<!-- -->	

function checkfamily (subType, subLength)
	{
	document.newmember.memtype.value = subType;
	document.newmember.memlen.value = subLength;

	if (((document.newmember.memtype.value == "Family") && (lastEntryMemtype > "") && (lastEntryMemtype != "Family")) || ((document.newmember.memtype.value != "Family") && (lastEntryMemtype == "Family")))
		{
		document.newmember.action = "memnew1.asp";
		document.newmember.submit();
		}

	lastEntryMemtype = subType;
	recheckDOB("");
	}
		
function copyMember ()
	{
	if (document.forms[0].memtype.value == "Family")
		{
		if (document.all)
			if (document.all.txtfname1 != null)
				{
				document.all.txtfname1.innerHTML = "&nbsp;&nbsp;&nbsp;" + document.forms[0].txtfname.value;
				document.all.txtmidname1.innerHTML = "&nbsp;&nbsp;" + document.forms[0].txtMIName.value;
				document.all.txtlname1.innerHTML = "&nbsp;&nbsp;&nbsp;" + document.forms[0].txtlname.value;
				document.all.txtdob1.innerHTML = "&nbsp;&nbsp;&nbsp;" + document.forms[0].txtdob.value;
				document.all.gender1.innerHTML = "&nbsp;&nbsp;" + document.forms[0].txtgender.options(document.forms[0].txtgender.selectedIndex).value;
				}
		if (document.layers)
			if (document.txtfname1.document != null)
				{
				document.txtfname1.document.txtfnamep.document.write("<span id='default'>&nbsp;" + document.forms[0].elements["txtfname"].value + "</span>");
				document.txtfname1.document.txtfnamep.document.close();
				document.txtmidname1.document.txtmidnamep.document.write("<span id='default'>&nbsp;" + document.forms[0].elements["txtMIName"].value + "</span>");
				document.txtmidname1.document.txtmidnamep.document.close();
				document.txtlname1.document.txtlnamep.document.write("<span id='default'>&nbsp;" + document.forms[0].elements["txtlname"].value + "</span>");
				document.txtlname1.document.txtlnamep.document.close();
				document.txtdob1.document.txtdobp.document.write("<span id='default'>&nbsp;" + document.forms[0].elements["txtdob"].value + "</span>");
				document.txtdob1.document.txtdobp.document.close();
				document.gender1.document.genderp.document.write("<span id='default'>&nbsp;" + document.forms[0].elements["txtgender"].options[document.forms[0].elements["txtgender"].selectedIndex].value + "</span>");
				document.gender1.document.genderp.document.close();
				}
		}
	}
	
function checkNewmemberForErrors ()
	{
	checkFirstName ("");
	checkLastName ("");
	checkMIName ("");
	checkAddress1 ();
	checkCity();
	checkState();
	checkZip();
	checkDOB("");
	checkPhone("hphonearea", "hphonenum");
	checkPhone("hphonenum", "hphonearea");
	checkPhone("wphonearea", "wphonenum");
	checkPhone("wphonenum", "wphonearea");
	checkPhone("faxarea", "faxnum");
	checkPhone("faxnum", "faxarea");
	checkEmail();
	if (document.newmember.elements["memtype"].value == "Family") checkDependents();
	gonogo = checkForErrors();
	if (document.all) window.event.returnValue = gonogo;
	return gonogo;
	}
		
<!-- -->	
<!-- General routines for checking memnew1.asp  and other similar forms-->	
<!-- -->

function checkFirstName (findex)
	{
	if (document.newmember.elements["txtfname" + findex].value == "") {if (getErrorCount("txtfname" + findex + ":blank") == 0) addErrorMessageByTag ("txtfname" + findex + ":blank");}
	else removeErrorMessage ("txtfname" + findex + ":blank");
	if (!(IsName(document.newmember.elements["txtfname" + findex].value)))
		{
		if (getErrorCount("txtfname" + findex + ":nonalpha") == 0) addErrorMessageByTag ("txtfname" + findex + ":nonalpha");
		redAndBoldit ("document.newmember.elements['txtfname" + findex + "']");
		}
	else
		{
		//removeErrorMessage ("txtfname" + findex + ":nonalpha");
		blackAndUnboldit ("document.newmember.elements['txtfname" + findex + "']");
		}
	}
	
function recheckFirstName (findex)
	{
	copyMember();
	if (findex > "") if (findex > 1) recheckDependents();
	if ((getErrorCount("txtfname" + findex + ":blank") > 0) || (getErrorCount("txtfname" + findex + ":nonalpha") > 0))
		{
		removeErrorMessage ("txtfname" + findex + ":blank");
		removeErrorMessage ("txtfname" + findex + ":nonalpha");
		blackAndUnboldit ("document.newmember.elements['txtfname" + findex + "']");
		checkFirstName (findex);
		if (findex > "") if (findex > 1) recheckDependents();
		}
	}
	
function checkLastName (findex)
	{
	if (document.newmember.elements["txtlname" + findex].value == "") {if (getErrorCount("txtlname" + findex + ":blank") == 0) addErrorMessageByTag ("txtlname" + findex + ":blank");}
	else removeErrorMessage ("txtlname" + findex + ":blank");
	if (!(IsName(document.newmember.elements["txtlname" + findex].value)))
		{
		if (getErrorCount("txtlname" + findex + ":nonalpha") == 0) addErrorMessageByTag ("txtlname" + findex + ":nonalpha");
		redAndBoldit ("document.newmember.elements['txtlname" + findex + "']");
		}
	else
		{
		removeErrorMessage ("txtlname" + findex + ":nonalpha");
		blackAndUnboldit ("document.newmember.elements['txtlname" + findex + "']");
		}
	}
	
function recheckLastName (findex)
	{
	copyMember();
	if (findex > "") if (findex > 1) recheckDependents();
	if ((getErrorCount("txtlname" + findex + ":blank") > 0) || (getErrorCount("txtlname" + findex + ":nonalpha") > 0))
		{
		removeErrorMessage ("txtlname" + findex + ":blank");
		removeErrorMessage ("txtlname" + findex + ":nonalpha");
		blackAndUnboldit ("document.newmember.elements['txtlname" + findex + "']");
		checkLastName(findex);
		if (findex > "") if (findex > 1) recheckDependents();
		}
	}

function checkMIName (findex)
	{
	if (!(IsAlpha(document.newmember.elements["txtMIName" + findex].value)))
		{
		if (getErrorCount("txtMIName" + findex + ":nonalpha") == 0)
			{
			addErrorMessageByTag ("txtMIName" + findex + ":nonalpha");
			redAndBoldit ("document.newmember.elements['txtMIName" + findex + "']");
			}
		}
	else
		{
		removeErrorMessage ("txtMIName" + findex + ":nonalpha");
		blackAndUnboldit ("document.newmember.elements['txtMIName" + findex + "']");
		}
	}

function recheckMIName (findex)
	{
	copyMember();
	if (getErrorCount("txtMIName" + findex + ":nonalpha") > 0)
		{
		removeErrorMessage ("txtMIName" + findex + ":nonalpha");
		blackAndUnboldit ("document.newmember.elements['txtMIName" + findex + "']");
		checkMIName (findex);
		if (findex > "") if (findex > 1) recheckDependents();
		}
	}

function checkMidName (findex)
	{
	if (!(IsAlpha(document.newmember.elements["txtmidname" + findex].value)))
		{
		if (getErrorCount("txtmidname" + findex + ":nonalpha") == 0)
			{
			addErrorMessageByTag ("txtmidname" + findex + ":nonalpha");
			redAndBoldit ("document.newmember.elements['txtmidname" + findex + "']");
			}
		}
	else
		{
		removeErrorMessage ("txtmidname" + findex + ":nonalpha");
		blackAndUnboldit ("document.newmember.elements['txtmidname" + findex + "']");
		}
	}

function recheckMidName (findex)
	{
	if (findex > "") if (findex > 1) recheckDependents();
	if (getErrorCount("txtmidname" + findex + ":nonalpha") > 0)
		{
		removeErrorMessage ("txtmidname" + findex + ":nonalpha");
		blackAndUnboldit ("document.newmember.elements['txtmidname" + findex + "']");
		checkMidName (findex);
		if (findex > "") if (findex > 1) recheckDependents();
		}
	}

function checkAddress1 ()
	{
	if (document.newmember.elements["txtaddr1"].value == "")
		{
		if (getErrorCount("txtaddr:blank") == 0) 
			addErrorMessageByTag ("txtaddr:blank");
		}
	else
		removeErrorMessage ("txtaddr:blank");
	}
	
function recheckAddress1 ()
	{
	if (getErrorCount("txtaddr:blank") > 0)
		{
		removeErrorMessage ("txtaddr:blank");
		checkAddress1();
		}
	}

function checkCity ()
	{
	if (document.newmember.elements["txtcity"].value == "") {if (getErrorCount("txtcity:blank") == 0) addErrorMessageByTag ("txtcity:blank");}
	else 
		{
		removeErrorMessage ("txtcity:blank");
		if (!(AtLeastOneAlpha(document.newmember.elements["txtcity"].value)))
			{
			if (getErrorCount("txtcity:bad") == 0) addErrorMessageByTag ("txtcity:bad");
			redAndBoldit ("document.newmember.elements['txtcity']");
			}
		else
			{
			removeErrorMessage ("txtcity:bad");
			blackAndUnboldit ("document.newmember.elements['txtcity']");
			}
		}
	}
	
function recheckCity ()
	{
	if ((getErrorCount("txtcity:blank") > 0) || (getErrorCount("txtcity:bad") > 0))
		{
		removeErrorMessage ("txtcity:blank");
		removeErrorMessage ("txtcity:bad");
		checkCity();
		}
	}

function checkZip ()
	{
	if (document.newmember.elements["txtzip"].value == "") {if (getErrorCount("txtzip:blank") == 0) addErrorMessageByTag ("txtzip:blank");}
	else
		{
		removeErrorMessage ("txtzip:blank");
		if (!(IsZip(document.newmember.elements["txtzip"].value)))
			{
			if (getErrorCount("txtzip:badzip") == 0) addErrorMessageByTag ("txtzip:badzip");
			redAndBoldit ("document.newmember.elements['txtzip']");
			}
		else
			{
			removeErrorMessage ("txtzip:badzip");
			if (getErrorCount("txtzip:dberror") == 0)
				blackAndUnboldit ("document.newmember.elements['txtzip']");
			}
		}
	}

function recheckZip ()
	{
	if ((getErrorCount("txtzip:blank") > 0) || (getErrorCount("txtzip:dberror") > 0) || (getErrorCount("txtzip:nonzip") > 0) || (getErrorCount("txtzip:badzip") > 0))
		{
		removeErrorMessage ("txtzip:blank");
		removeErrorMessage ("txtzip:nonzip");
		removeErrorMessage ("txtzip:badzip");
		removeErrorMessage ("txtzip:dberror");
		blackAndUnboldit ("document.newmember.elements['txtzip']");
		checkZip ();
		}
	}
	
function checkState ()
	{
	if ((document.newmember.elements["txtstate"].options[document.newmember.elements["txtstate"].selectedIndex].value == "header") || (document.newmember.elements["txtstate"].options[document.newmember.elements["txtstate"].selectedIndex].value == "break1") || (document.newmember.elements["txtstate"].options[document.newmember.elements["txtstate"].selectedIndex].value == "break2"))
		{
		if (getErrorCount("txtstate:nonstate") == 0) addErrorMessageByTag ("txtstate:nonstate");
		redAndBoldit ("document.newmember.elements['txtstate']");
		}
	else
		{
		removeErrorMessage ("txtstate:nonstate");
		blackAndUnboldit ("document.newmember.elements['txtstate']");
		}
	}

function recheckState ()
	{
	if (getErrorCount("txtstate:nonstate") > 0)
		{
		removeErrorMessage ("txtstate:nonstate");
		blackAndUnboldit ("document.newmember.elements['txtstate']");
		checkState ();
		}
	recheckZip();
	}
	
function checkDOB (findex)
	{
	if (document.newmember.elements["txtdob" + findex].value == "")
		{
//		if (getErrorCount("txtdob" + findex + ":blank") == 0) addErrorMessageByTag ("txtdob" + findex + ":blank");
//		Blank date of birth OK as no longer required. Except ...
//		if (document.newmember.memtype.value == "Junior")
//			if (getErrorCount("txtdob" + findex + ":gt19nodob") == 0) addErrorMessageByTag ("txtdob" + findex + ":gt19nodob");
//		else
//			removeErrorMessage ("txtdob" + findex + ":gt19nodob");
		}
	else 
		{
		removeErrorMessage ("txtdob" + findex + ":blank");
		dateOfBirth = new Date(document.newmember.elements["txtdob" + findex].value);

		if	(isNaN(dateOfBirth))
			{
			if (getErrorCount("txtdob" + findex + ":nondate") == 0) addErrorMessageByTag ("txtdob" + findex + ":nondate");
			redAndBoldit ("document.newmember.elements['txtdob" + findex + "']");
			}
		else
			{
			removeErrorMessage ("txtdob" + findex + ":nondate");
			dayOfBirth = dateOfBirth.getDate().toString(); if (dayOfBirth.length < 2) dayOfBirth = "0" + dayOfBirth;
			monthOfBirth = (dateOfBirth.getMonth() + 1).toString(); if (monthOfBirth.length < 2) monthOfBirth = "0" + monthOfBirth;
			yearOfBirth = dateOfBirth.getFullYear().toString();

			if ((monthOfBirth + "/" + dayOfBirth + "/" + yearOfBirth) != document.newmember.elements["txtdob" + findex].value)
				{
				if (getErrorCount("txtdob" + findex + ":baddate") == 0) addErrorMessageByTag ("txtdob" + findex + ":baddate");
				redAndBoldit ("document.newmember.elements['txtdob" + findex + "']");
				}
			else
				{
				removeErrorMessage ("txtdob" + findex + ":baddate");
				nowDate = new Date(); nowDate.getFullYear(); nowDate.getMonth(); nowDate.getDate();
				oldDate = new Date(1850,1,1);

				if ((dateOfBirth > nowDate) || (dateOfBirth < oldDate))
					{
					if (getErrorCount("txtdob" + findex + ":futdate") == 0) addErrorMessageByTag ("txtdob" + findex + ":futdate");
					redAndBoldit ("document.newmember.elements['txtdob" + findex + "']");
					} 
				else
					{
					removeErrorMessage ("txtdob" + findex + ":futdate");
					dob19Date = new Date(); dob19Date.getFullYear(); dob19Date.getMonth(); dob19Date.getDate();
					dob19Date.setFullYear(dob19Date.getFullYear()-19);
					if ((findex == "") && (dateOfBirth < dob19Date) && (document.newmember.memtype.value == "Junior"))
						{
						if (getErrorCount("txtdob:gt19date") == 0) addErrorMessageByTag ("txtdob:gt19date");
						redAndBoldit ("document.newmember.elements['txtdob" + findex + "']");
						}
					else
						{
						removeErrorMessage ("txtdob" + findex + ":gt19date");
						if ((findex == "") && (dateOfBirth >= dob19Date) && (document.newmember.memtype.value == "Adult"))
							{
							if (getErrorCount("txtdob:lt19date") == 0) addErrorMessageByTag ("txtdob:lt19date");
							redAndBoldit ("document.newmember.elements['txtdob" + findex + "']");
							}
						else
							{
							removeErrorMessage ("txtdob" + findex + ":lt19date");
							blackAndUnboldit ("document.newmember.elements['txtdob" + findex + "']");
							}
						}
					}
				}
			}
		}
	}

function recheckDOB (findex)
	{
	copyMember();
	if (findex > "") if (findex > 1) recheckDependents();
	if ((getErrorCount("txtdob" + findex + ":blank") > 0) || (getErrorCount("txtdob" + findex + ":nondate") > 0) || (getErrorCount("txtdob" + findex + ":baddate") > 0 || (getErrorCount("txtdob" + findex + ":futdate") > 0) || (getErrorCount("txtdob" + findex + ":gt19date") > 0) || (getErrorCount("txtdob" + findex + ":gt19nodob") > 0) || (getErrorCount("txtdob" + findex + ":lt19date") > 0)))
		{
		removeErrorMessage ("txtdob" + findex + ":blank");
		removeErrorMessage ("txtdob" + findex + ":nondate");
		removeErrorMessage ("txtdob" + findex + ":futdate");
		removeErrorMessage ("txtdob" + findex + ":baddate");
		removeErrorMessage ("txtdob" + findex + ":gt19date");
		removeErrorMessage ("txtdob" + findex + ":gt19nodob");
		removeErrorMessage ("txtdob" + findex + ":lt19date");
		blackAndUnboldit ("document.newmember.elements['txtdob" + findex + "']");
		checkDOB(findex);
		if (findex > "") if (findex > 1) recheckDependents();
		}
	}

function checkPhone (thisType, otherType)
	{
	if (document.forms[0].elements["txt" + thisType].value.length > 0)
		{
		if (!(IsNumeric(StripTel(document.forms[0].elements["txt" + thisType].value))))
			{
			if (getErrorCount("txt" + thisType + ":nonnum") == 0)
				{
				addErrorMessageByTag ("txt" + thisType + ":nonnum");
				redAndBoldit ("document.forms[0].elements['txt" + thisType + "']");
				}
			}
		else
			{
			removeErrorMessage ("txt" + thisType + ":nonnum");
			if ((getErrorCount("txt" + otherType + ":nonnum") == 0) && (StripTel(document.forms[0].elements["txt" + thisType].value + document.forms[0].elements["txt" + otherType].value).length != 10))
				{
				if ((getErrorCount("txt" + thisType + ":toolong") == 0) && (getErrorCount("txt" + otherType + ":toolong") == 0))
					{
					addErrorMessageByTag ("txt" + thisType + ":toolong");
					redAndBoldit ("document.forms[0].elements['txt" + thisType + "']");
					}
				}
			else
				{
				removeErrorMessage ("txt" + thisType + ":toolong");
				blackAndUnboldit ("document.forms[0].elements['txt" + thisType + "']");
				}
			}
		}
	}
	
function recheckPhone (thisType, otherType)
	{
	if ((getErrorCount("txt" + thisType + ":nonnum") > 0) || (getErrorCount("txt" + otherType + ":toolong") > 0) || (getErrorCount("txt" + thisType + ":toolong") > 0))
		{
		removeErrorMessage ("txt" + thisType + ":nonnum");
		removeErrorMessage ("txt" + thisType + ":toolong");
		blackAndUnboldit (document.forms[0].elements["txt" + thisType]);
		if (getErrorCount("txt" + otherType + ":toolong") > 0)
			{
			removeErrorMessage ("txt" + otherType + ":toolong");
			blackAndUnboldit ("document.forms[0].elements['txt" + otherType + "']");
			}
		checkPhone (thisType, otherType);
		}
	}
	
function checkExtn()
	{
	}

function recheckExtn()
	{
	}
	
function checkDependents()
	{
	noDependents = true;
	for (q=2; q < 9; q++)
		{
		findex = q.toString();
		if ((document.newmember.elements["txtlname" + findex].value > "") || (document.newmember.elements["txtfname" + findex].value > "") || (document.newmember.elements["txtmidname" + findex].value > "") || (document.newmember.elements["txtdob" + findex].value > ""))
			{
			noDependents = false;
			checkFirstName(findex);
			checkMidName(findex);
			checkLastName(findex);
			checkDOB(findex);
			}
		}
		
	if (noDependents && (document.newmember.elements["memtype"].value == "Family"))
		{
		if (getErrorCount("txtfname" + findex + ":blank") == 0)
			addErrorMessageByTag ("nodep:nodep");
		else
			removeErrorMessage ("nodep:nodep");
		}
	}

function recheckDependents()
	{
	if (getErrorCount("nodep:nodep") > 0)
		{
		removeErrorMessage ("nodep:nodep");
		checkDependents();
		}
	}	
	
function checkEmail()
	{
	if (document.newmember.elements["txtemail"].value > "")
		{
		if (!((document.newmember.elements["txtemail"].value.indexOf("@") >= 0) && (document.newmember.elements["txtemail"].value.indexOf(".") >= 0)))
			{
			if (getErrorCount("txtemail:badadd") == 0)
				{
				addErrorMessageByTag ("txtemail:badadd");
				redAndBoldit ("document.newmember.elements['txtemail']");
				}
			}
		else
			{
			removeErrorMessage ("txtemail:badadd");
			blackAndUnboldit ("document.newmember.elements['txtemail']");
			}
		}
	}
	
function recheckEmail()
	{
	if (getErrorCount("txtemail:badadd") > 0)
		{
		removeErrorMessage ("txtemail:badadd");
		blackAndUnboldit (document.newmember.elements["txtemail"]);
		checkEmail();
		}
	}	

<!-- -->	
<!-- Specific routines for checking memnew2.asp (or similar forms) credit cards entries -->	
<!-- -->	

	
function checkCCfieldsForErrors ()
	{
	checkCC_name ();
	checkCC_num ();
	checkCC_type ();
	checkCC_expiry ();
	checkCC_zip();
	checkCC_amount();
	gonogo = checkForErrors ();
	if (document.all) window.event.returnValue = gonogo;
	return gonogo;
	}
	
<!-- -->	
<!-- General routines for checking memnew1.asp  and other similar forms-->	
<!-- -->	

function checkCC_name ()
	{
	if (spaceTrim(document.forms[0].elements["cc_name"].value) == "") {if (getErrorCount("cc_name:blank") == 0) addErrorMessageByTag ("cc_name:blank");}
	else removeErrorMessage ("cc_name:blank");
	if (!(IsCCName(document.forms[0].elements["cc_name"].value)))
		{
		if (getErrorCount("cc_name:nonalpha") == 0) addErrorMessageByTag ("cc_name:nonalpha");
		redAndBoldit ("document.forms[0].elements['cc_name']");
		}
	else
		{
		removeErrorMessage ("cc_name:nonalpha");
		blackAndUnboldit ("document.forms[0].elements['cc_name']");
		}
	}
	
function recheckCC_name ()
	{
	if ((getErrorCount("cc_name:blank") > 0) || (getErrorCount("cc_name:nonalpha") > 0))
		{
		removeErrorMessage ("cc_name:blank");
		removeErrorMessage ("cc_name:nonalpha");
		blackAndUnboldit ("document.forms[0].elements['cc_name']");
		checkCC_name ();
		}
	}
	
function checkCC_num ()
{
	if ((document.forms[0].elements["cc_num"].value.length > 16) || (document.forms[0].elements["cc_num"].value.length < 15) || (!(IsNumeric(document.forms[0].elements["cc_num"].value))))
	{
	    if (getErrorCount("cc_num:bad") == 0) addErrorMessageByTag ("cc_num:bad");		
	}
	else
	{   
        removeErrorMessage ("cc_num:bad");
	}
}
	
function recheckCC_num ()
	{
	if (getErrorCount("cc_num:bad") > 0) 
		{
		removeErrorMessage ("cc_num:bad");
		blackAndUnboldit ("document.forms[0].elements['cc_num']");
		checkCC_num();
		}
	}

function checkCC_type ()
{
	if (!((document.forms[0].elements["cc_type"].options[document.forms[0].elements["cc_type"].selectedIndex].value == "1") || (document.forms[0].elements["cc_type"].options[document.forms[0].elements["cc_type"].selectedIndex].value == "2") || (document.forms[0].elements["cc_type"].options[document.forms[0].elements["cc_type"].selectedIndex].value == "3") || (document.forms[0].elements["cc_type"].options[document.forms[0].elements["cc_type"].selectedIndex].value == "VISA") || (document.forms[0].elements["cc_type"].options[document.forms[0].elements["cc_type"].selectedIndex].value == "MC") || (document.forms[0].elements["cc_type"].options[document.forms[0].elements["cc_type"].selectedIndex].value == "AMEX")))
	{
		if (getErrorCount("cc_type:bad") == 0)
		{
			addErrorMessageByTag ("cc_type:bad");
			redAndBoldit ("document.forms[0].elements['cc_type']");
		}
	}
	else
	{
	    var iCreditCardID;
	    iCreditCardID = document.forms[0].elements["cc_type"].selectedIndex;
	
	    if ((iCreditCardID == 2 && document.forms[0].elements["cc_num"].value.length != 15) ||
				(iCreditCardID != 2 && document.forms[0].elements["cc_num"].value.length != 16) ||
				(iCreditCardID == 0 && document.forms[0].elements["cc_num"].value.substr(0, 1) != '4') ||
				(iCreditCardID == 2 && document.forms[0].elements["cc_num"].value.substr(0, 1) != '3') ||
				(iCreditCardID == 1 && document.forms[0].elements["cc_num"].value.substr(0, 1) != '5')) 
		{
		    if (getErrorCount("cc_type:bad") == 0) addErrorMessageByTag ("cc_type:bad");
		    redAndBoldit ("document.forms[0].elements['cc_type']");
		}
		else
		{
		    removeErrorMessage ("cc_type:bad");
		    blackAndUnboldit ("document.forms[0].elements['cc_type']");
		}
	}
	
}

function recheckCC_type ()
	{
	if (getErrorCount("cc_type:bad") > 0)
		{
		removeErrorMessage ("cc_type:bad");
		blackAndUnboldit ("document.forms[0].elements['cc_type']");
		checkCC_type ();
		}
	}

function checkCC_expmonth ()
	{
	switch (document.forms[0].elements["cc_expmonth"].options[document.forms[0].elements["cc_expmonth"].selectedIndex].value)
		{
		case "01" : removeErrorMessage ("cc_expmonth:bad"); blackAndUnboldit ("document.forms[0].elements['cc_expmonth']"); break;
		case "02" : removeErrorMessage ("cc_expmonth:bad"); blackAndUnboldit ("document.forms[0].elements['cc_expmonth']"); break;
		case "03" : removeErrorMessage ("cc_expmonth:bad"); blackAndUnboldit ("document.forms[0].elements['cc_expmonth']"); break;
		case "04" : removeErrorMessage ("cc_expmonth:bad"); blackAndUnboldit ("document.forms[0].elements['cc_expmonth']"); break;
		case "05" : removeErrorMessage ("cc_expmonth:bad"); blackAndUnboldit ("document.forms[0].elements['cc_expmonth']"); break;
		case "06" : removeErrorMessage ("cc_expmonth:bad"); blackAndUnboldit ("document.forms[0].elements['cc_expmonth']"); break;
		case "07" : removeErrorMessage ("cc_expmonth:bad"); blackAndUnboldit ("document.forms[0].elements['cc_expmonth']"); break;
		case "08" : removeErrorMessage ("cc_expmonth:bad"); blackAndUnboldit ("document.forms[0].elements['cc_expmonth']"); break;
		case "09" : removeErrorMessage ("cc_expmonth:bad"); blackAndUnboldit ("document.forms[0].elements['cc_expmonth']"); break;
		case "10" : removeErrorMessage ("cc_expmonth:bad"); blackAndUnboldit ("document.forms[0].elements['cc_expmonth']"); break;
		case "11" : removeErrorMessage ("cc_expmonth:bad"); blackAndUnboldit ("document.forms[0].elements['cc_expmonth']"); break;
		case "12" : removeErrorMessage ("cc_expmonth:bad"); blackAndUnboldit ("document.forms[0].elements['cc_expmonth']"); break;

		default :
			if (getErrorCount("cc_expmonth:bad") == 0) 
				addErrorMessageByTag ("cc_expmonth:bad");
		}
	}
	
function recheckCC_expmonth ()
	{
	if (getErrorCount("cc_expmonth:bad") > 0)
		{
		removeErrorMessage ("cc_expmonth:bad");
		if ((document.forms[0].elements["cc_expmonth"].options[document.forms[0].elements["cc_expmonth"].selectedIndex].value != "00") && (document.forms[0].elements["cc_expyear"].options[document.forms[0].elements["cc_expyear"].selectedIndex].value != "0000"))
			checkCC_expmonth();
		}
	}

function checkCC_expyear ()
	{
	switch (document.forms[0].elements["cc_expyear"].options[document.forms[0].elements["cc_expyear"].selectedIndex].value)
		{
		case "2002" : removeErrorMessage ("cc_expyear:bad"); blackAndUnboldit (document.forms[0].elements["cc_expyear"]); break;
		case "2003" : removeErrorMessage ("cc_expyear:bad"); blackAndUnboldit (document.forms[0].elements["cc_expyear"]); break;
		case "2004" : removeErrorMessage ("cc_expyear:bad"); blackAndUnboldit (document.forms[0].elements["cc_expyear"]); break;
		case "2005" : removeErrorMessage ("cc_expyear:bad"); blackAndUnboldit (document.forms[0].elements["cc_expyear"]); break;
		case "2006" : removeErrorMessage ("cc_expyear:bad"); blackAndUnboldit (document.forms[0].elements["cc_expyear"]); break;
		case "2007" : removeErrorMessage ("cc_expyear:bad"); blackAndUnboldit (document.forms[0].elements["cc_expyear"]); break;
		case "2008" : removeErrorMessage ("cc_expyear:bad"); blackAndUnboldit (document.forms[0].elements["cc_expyear"]); break;
		case "2009" : removeErrorMessage ("cc_expyear:bad"); blackAndUnboldit (document.forms[0].elements["cc_expyear"]); break;
		case "2010" : removeErrorMessage ("cc_expyear:bad"); blackAndUnboldit (document.forms[0].elements["cc_expyear"]); break;
		case "2011" : removeErrorMessage ("cc_expyear:bad"); blackAndUnboldit (document.forms[0].elements["cc_expyear"]); break;
		case "2012" : removeErrorMessage ("cc_expyear:bad"); blackAndUnboldit (document.forms[0].elements["cc_expyear"]); break;
		case "2013" : removeErrorMessage ("cc_expyear:bad"); blackAndUnboldit (document.forms[0].elements["cc_expyear"]); break;
		case "2014" : removeErrorMessage ("cc_expyear:bad"); blackAndUnboldit (document.forms[0].elements["cc_expyear"]); break;
		case "2015" : removeErrorMessage ("cc_expyear:bad"); blackAndUnboldit (document.forms[0].elements["cc_expyear"]); break;

		default :
			if (getErrorCount("cc_expyear:bad") == 0) 
				addErrorMessageByTag ("cc_expyear:bad");
		}
	}
	
function recheckCC_expyear ()
	{
	if (getErrorCount("cc_expyear:bad") > 0)
		{
		removeErrorMessage ("cc_expyear:bad");
		if ((document.forms[0].elements["cc_expmonth"].options[document.forms[0].elements["cc_expmonth"].selectedIndex].value != "00") && (document.forms[0].elements["cc_expyear"].options[document.forms[0].elements["cc_expyear"].selectedIndex].value != "0000"))
			checkCC_expyear();
		}
	}
	
function checkCC_expiry ()
	{
	
	recheckCC_expyear();
	recheckCC_expmonth();
	if ((document.forms[0].elements["cc_expmonth"].options[document.forms[0].elements["cc_expmonth"].selectedIndex].value == "00") || (document.forms[0].elements["cc_expyear"].options[document.forms[0].elements["cc_expyear"].selectedIndex].value == "0000"))
			{
			if (getErrorCount("cc_expiry:unselect") == 0) addErrorMessageByTag ("cc_expiry:unselect");
			redAndBoldit ("document.forms[0].elements['cc_expyear']");
			redAndBoldit ("document.forms[0].elements['cc_expmonth']");
			}
	else	
			{ 
			removeErrorMessage ("cc_expiry:unselect");
			if ((getErrorCount("cc_expyear:bad") == 0) && (getErrorCount("cc_expmonth:bad") == 0))
				{
				var nowDate = new Date(); 
				var expiryDate = new Date(document.forms[0].elements["cc_expmonth"].options[document.forms[0].elements["cc_expmonth"].selectedIndex].value + "/" + getDaysInMonth(document.forms[0].elements["cc_expmonth"].options[document.forms[0].elements["cc_expmonth"].selectedIndex].value) + "/" + document.forms[0].elements["cc_expyear"].options[document.forms[0].elements["cc_expyear"].selectedIndex].value + " 23:59:59");
				if (expiryDate < nowDate)
					{
					if (getErrorCount("cc_expiry:bad") == 0) addErrorMessageByTag ("cc_expiry:bad");
					redAndBoldit ("document.forms[0].elements['cc_expyear']");
					redAndBoldit ("document.forms[0].elements['cc_expmonth']");
					}
				else removeErrorMessage ("cc_expiry:bad");
				}
			}
	}
	
function recheckCC_expiry ()
	{
	if ((getErrorCount("cc_expiry:bad") > 0) || (getErrorCount("cc_expiry:unselect") > 0))
		{
		removeErrorMessage ("cc_expiry:unselect");
		removeErrorMessage ("cc_expiry:bad");
		blackAndUnboldit ("document.forms[0].elements['cc_expyear']");
		blackAndUnboldit ("document.forms[0].elements['cc_expmonth']");
		if ((document.forms[0].elements["cc_expmonth"].options[document.forms[0].elements["cc_expmonth"].selectedIndex].value != "00") && (document.forms[0].elements["cc_expyear"].options[document.forms[0].elements["cc_expyear"].selectedIndex].value != "0000"))
			checkCC_expiry();
		}
	recheckCC_expmonth();
	recheckCC_expyear();
	}

function checkCC_zip ()
	{
	if (document.forms[0].elements["cc_zip"].value == "") {if (getErrorCount("cc_zip:blank") == 0) addErrorMessageByTag ("cc_zip:blank");}
	else removeErrorMessage ("cc_zip:blank");
	if (!(IsZip(document.forms[0].elements["cc_zip"].value)))
		{
		if (getErrorCount("cc_zip:badzip") == 0) addErrorMessageByTag ("cc_zip:badzip");
		redAndBoldit ("document.forms[0].elements['cc_zip']");
		}
	else
		{
		removeErrorMessage ("cc_zip:badzip");
		blackAndUnboldit ("document.forms[0].elements['cc_zip']");
		}
	}

function recheckCC_zip ()
	{
	if ((getErrorCount("cc_zip:blank") > 0) || (getErrorCount("cc_zip:badzip") > 0))
		{
		removeErrorMessage ("cc_zip:blank");
		removeErrorMessage ("cc_zip:badzip");
		blackAndUnboldit ("document.forms[0].elements['cc_zip']");
		checkCC_zip ();
		}
	}
	
function checkCC_amount ()
	{
	if (calctotal() == 0)
		if (getErrorCount("cc_amount:zero") == 0)
			addErrorMessageByTag ("cc_amount:zero");

	}
function recheckCC_amount ()
	{
	if (getErrorCount("cc_amount:zero") != 0)
		{
		removeErrorMessage ("cc_amount:zero");
		}
	checkCC_amount();
	}