function Form1_Validator(theForm)
{

var alertsay = ""; 
// check to see if the field is blank

// RFA modification to submitter field
if (theForm.submitter.value == "")
{
alert("Please enter your name in the \"Applicant Name\" field");
theForm.submitter.focus();
return (false);
}

// require at least 8 characters be entered
if (theForm.submitter.value.length < 8)
{
alert("Please enter at least 8 characters in the \"Applicant Name\" field");
theForm.submitter.focus();
return (false);
}

// RFA modification to address field
if (theForm.addr.value == "")
{
alert("Please enter your street address in the \"Address\" field");
theForm.addr.focus();
return (false);
}

// require at least 3 characters be entered
if (theForm.addr.value.length < 3)
{
alert("Please enter at least 3 characters in the \"Address\" field");
theForm.addr.focus();
return (false);
}

// RFA modification to city field
if (theForm.city.value == "")
{
alert("Please enter your city in the \"City\" field");
theForm.city.focus();
return (false);
}

// require at least 2 characters be entered
if (theForm.city.value.length < 2)
{
alert("Please enter at least 2 characters in the \"City\" field");
theForm.city.focus();
return (false);
}

// RFA modification to zip code field
if (theForm.zip.value == "")
{
alert("Please enter your zip code in the \"Zip Code\" field");
theForm.zip.focus();
return (false);
}

// require at least 5 characters be entered
if (theForm.zip.value.length < 5)
{
alert("Please enter at least 5 numeric characters in the \"Zip Code\" field");
theForm.zip.focus();
return (false);
}

// RFA modification to telephone number field
if (theForm.pnum.value == "")
{
alert("Please enter your phone number in the \"Phone Number\" field");
theForm.pnum.focus();
return (false);
}

// require at least 10 characters be entered
if (theForm.pnum.value.length < 10)
{
alert("Please enter at least 10 numeric characters in the \"Phone Number\" field");
theForm.pnum.focus();
return (false);
}

// RFA modification to email field
// check if email field is blank
if (theForm.Email.value == "")
{
alert("Please enter a valid email address for the \"Email\" field.");
theForm.Email.focus();
return (false);
}


// test if valid email address, must have @ and .
var checkEmail = "@.";
var checkStr = theForm.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("The \"Email\" field must contain an \"@\" and a \".\"");
theForm.Email.focus();
return (false);
}

// RFA modification to location field
// check if no drop down has been selected
if (theForm.location.selectedIndex < 0)
{
alert("Please select one of the \"Location for Training\" options.");
theForm.location.focus();
return (false);
}

// check if the first drop down is selected, if so, invalid selection
if (theForm.location.selectedIndex == 0)
{
alert("The first \"Location for Training\" option is not a valid selection.");
theForm.location.focus();
return (false);
} 

// RFA modification to EDI field
// check if no drop down has been selected
if (theForm.edi.selectedIndex < 0)
{
alert("Please select one of the \"Trading Partner Agreement\" options.");
theForm.edi.focus();
return (false);
}

// check if the first drop down is selected, if so, invalid selection
if (theForm.edi.selectedIndex == 0)
{
alert("The first \"Trading Partner Agreement\" option is not a valid selection.");
theForm.edi.focus();
return (false);
} 

// RFA modification to signature field
if (theForm.signature.value == "")
{
alert("Please enter your full name in the \"Typed Name of Applicant\" field");
theForm.signature.focus();
return (false);
}

// require at least 10 characters be entered
if (theForm.signature.value.length < 5)
{
alert("Please enter at least 5 characters in the \"Typed Name of Applicant\" field");
theForm.signature.focus();
return (false);
}

// because this is a sample page, don't allow to exit to the post action
// comes in handy when you are testing the form validations and don't
// wish to exit the page
return confirm("ALL VALIDATIONS HAVE SUCCEEDED AND YOUR FORM IS READY TO BE SUBMITTED. CLICK THE OK BUTTON TO COMPLETE THE SUBMISSION PROCESS OR CANCEL TO ABORT.");

//alertsay = "ALL VALIDATIONS HAVE SUCCEEDED AND YOUR FORM IS READY TO BE SUBMITTED. CLICK THE OK BUTTON TO COMPLETE THE SUBMISSION PROCESS OR THE X BUTTON TO CANCEL."
//alert(alertsay);
//return (true);
// replace the above with return(true); if you have a valid form to submit to
}
