<!--
function aspForm_Validator(theForm)
{

var alertsay = ""; // define for long lines
// alertsay is not necessary for your code,
// but I need to break my lines in multiple lines
// so the code won't extend off the edge of the page

// check to see if the field is blank
if (theForm.A_USERNAME.value == "")
{
alert("You must enter a username.");
theForm.A_USERNAME.focus();
return (false);

}

// require at least 5 characters in the password field
if (theForm.A_PASSWORD.value.length < 6)
{
alert("Please enter at least 5 characters in the \"Password\" field.");
theForm.A_PASSWORD.focus();
return (false);
}

// check if both password fields are the same
if (theForm.A_PASSWORD.value != theForm.A_R_PASSWORD.value)
{
	alert("The two passwords are not the same.");
	theForm.A_R_PASSWORD.focus();
	return (false);
}

// check to see if the field is blank
if (theForm.A_SECURITY_Q.value == "")
{
alert("You must enter a Security Question.");
theForm.A_SECURITY_Q.focus();
return (false);
}
// check to see if the field is blank
if (theForm.A_SECURITY_A.value == "")
{
alert("You must enter a Security Answer.");
theForm.A_SECURITY_A.focus();
return (false);
}

// check to see if the field is blank
if (theForm.A_DOB_MONTH.value == "")
{
alert("You must enter a Month for your Date of Birth.");
theForm.A_DOB_MONTH.focus();
return (false);
}

// check to see if the field is blank
if (theForm.A_DOB_DAY.value == "")
{
alert("You must enter a Day for your Date of Birth..");
theForm.A_DOB_DAY.focus();
return (false);
}

// check to see if the field is blank
if (theForm.A_DOB_YEAR.value == "")
{
alert("You must enter a Year for your Date of Birth.");
theForm.A_DOB_YEAR.focus();
return (false);
}

// check to see if the field is blank
if (theForm.A_DRIVERS.value == "")
{
alert("You must enter a VALID Drivers License #.");
theForm.A_DRIVERS.focus();
return (false);
}

// check to see if the field is blank
if (theForm.A_FIRST_NAME.value == "")
{
alert("You must enter Your First Name.");
theForm.A_FIRST_NAME.focus();
return (false);
}

// check to see if the field is blank
if (theForm.A_LAST_NAME.value == "")
{
alert("You must enter Your Last Name.");
theForm.A_LAST_NAME.focus();
return (false);
}

// check to see if the field is blank
if (theForm.A_ADDRESS.value == "")
{
alert("You must enter Your Address.");
theForm.A_ADDRESS.focus();
return (false);
}

// test if valid email address, must have @ and .
var checkEmail = "@.";
var checkStr = theForm.A_EMAIL.value;
var EmailValid = false;
var EmailAt = false;
var EmailPeriod = false;
for (i = 0;  i < checkStr.length;  i++)
{
ch = checkStr.charAt(i);
for (j = 0;  j < checkEmail.length;  j++)
{
if (ch == checkEmail.charAt(j) && ch == "@")
EmailAt = true;
if (ch == checkEmail.charAt(j) && ch == ".")
EmailPeriod = true;
	  if (EmailAt && EmailPeriod)
		break;
	  if (j == checkEmail.length)
		break;
	}
	// if both the @ and . were in the string
if (EmailAt && EmailPeriod)
{
		EmailValid = true
		break;
	}
}
if (!EmailValid)
{
alert("Please enter a valid email address.");
theForm.A_EMAIL.focus();
return (false);
}

// require at least 10 characters in the phone field
if (theForm.A_PHONE.value.length < 10)
{
alert("Please enter a 10 digit Phone Number.");
theForm.A_PHONE.focus();
return (false);
}

// allow ONLY alphanumeric keys, no symbols or punctuation
// this can be altered for any "checkOK" string you desire
var checkOK = "+-()0123456789";
var checkStr = theForm.A_PHONE.value;
var allValid = true;
for (i = 0;  i < checkStr.length;  i++)
{
ch = checkStr.charAt(i);
for (j = 0;  j < checkOK.length;  j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
alert("Please enter in phone # format. (800) 555-1212.");
theForm.A_PHONE.focus();
return (false);
}

// check to see if the field is blank
if (theForm.A_CITY.value == "")
{
alert("You must enter Your City.");
theForm.A_CITY.focus();
return (false);
}

// check to see if the field is blank
if (theForm.A_STATE.value == "")
{
alert("You must enter Your State.");
theForm.A_STATE.focus();
return (false);
}

// require at least 3 characters be entered
if (theForm.A_ZIP.value.length < 5)
{
alert("Please enter 5 digit zip code");
theForm.A_ZIP.focus();
return (false);
}

// only allow numbers to be entered
var checkOK = "0123456789";
var checkStr = theForm.A_ZIP.value;
var allValid = true;
var allNum = "";
for (i = 0;  i < checkStr.length;  i++)
{
ch = checkStr.charAt(i);
for (j = 0;  j < checkOK.length;  j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("Please enter 5 digit zip code.");
theForm.A_ZIP.focus();
return (false);
}

// check to see if the field is blank
if (theForm.A_DR_NAME.value == "")
{
alert("You must enter Your Physicians Name.");
theForm.A_DR_NAME.focus();
return (false);
}

// check to see if the field is blank
if (theForm.A_CLINIC_NAME.value == "")
{
alert("You must enter Your Clinic Name.");
theForm.A_CLINIC_NAME.focus();
return (false);
}

// require at least 10 characters in the phone field
if (theForm.A_CLINIC_PHONE.value.length < 10)
{
alert("Please enter a 10 digit Clinic Phone Number.");
theForm.A_CLINIC_PHONE.focus();
return (false);
}

// allow ONLY alphanumeric keys, no symbols or punctuation
// this can be altered for any "checkOK" string you desire
var checkOK = "+-()0123456789";
var checkStr = theForm.A_CLINIC_PHONE.value;
var allValid = true;
for (i = 0;  i < checkStr.length;  i++)
{
ch = checkStr.charAt(i);
for (j = 0;  j < checkOK.length;  j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
alert("Please enter in phone # format. (800) 555-1212.");
theForm.A_CLINIC_PHONE.focus();
return (false);
}

// check to see if the field is blank
if (theForm.A_CARD_NUMBER.value == "")
{
alert("You must enter Your Patient/Card Number.");
theForm.A_CARD_NUMBER.focus();
return (false);
}

// check to see if the field is blank
if (theForm.A_D_R_MONTH.value == "")
{
alert("You must enter an recommendation Month.");
theForm.A_D_R_MONTH.focus();
return (false);
}

// check to see if the field is blank
if (theForm.A_D_R_DAY.value == "")
{
alert("You must enter an recommendation Day.");
theForm.A_D_R_DAY.focus();
return (false);
}

// check to see if the field is blank
if (theForm.A_D_R_YEAR.value == "")
{
alert("You must enter an recommendation Year.");
theForm.A_D_R_YEAR.focus();
return (false);
}




// check to see if the field is blank
if (theForm.A_E_R_MONTH.value == "")
{
alert("You must enter an expiration Month.");
theForm.A_E_R_MONTH.focus();
return (false);
}

// check to see if the field is blank
if (theForm.A_E_R_DAY.value == "")
{
alert("You must enter an expiration Day.");
theForm.A_E_R_DAY.focus();
return (false);
}

// check to see if the field is blank
if (theForm.A_E_R_YEAR.value == "")
{
alert("You must enter an expiration Year.");
theForm.A_E_R_YEAR.focus();
return (false);
}


// replace the above with return(true); if you have a valid form to submit to
}
//-->

