function Form1_Validator(theForm)
{

var alertsay = ""; 
// check to see if the field is blank

// RFA modification to Prefix field
// check if no drop down has been selected
if (theForm.prefix.selectedIndex < 0)
{
alert("Please select one of the \"Prefix \" options.");
theForm.prefix.focus();
return (false);
}

// check if the first drop down is selected, if so, invalid selection
if (theForm.prefix.selectedIndex == 0)
{
alert("The first \"Prefix \" option is not a valid selection.");
theForm.prefix.focus();
return (false);
} 

// 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 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);
} 

// ** Bill's modification to qualification field - select one option with text box appearing
// check if no drop down has been selected
if (theForm.box1.selectedIndex < 0)
{
alert("Please select one of the \"ECF account qualification\" options.");
theForm.box1.focus();
return (false);
}

// ** Bill's mod to check if text box appears from drop down selected, validate it
if (theForm.box1.selectedIndex == 1)
{
	if (theForm.states.value == "")
	{
	alert("Please identify Bankruptcy & District Courts (already certified to file electronically) in the \"Red Box\"");
	theForm.states.focus();
	return (false);
	}
}
// ** end Bill's modification
// check if the first drop down is selected, if so, invalid selection
if (theForm.box1.selectedIndex == 0)
{
alert("The first \"ECF account qualification\ \" option is not a valid selection.");
theForm.box1.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);
}

return confirm("ALL VALIDATIONS HAVE SUCCEEDED AND YOUR FORM IS READY TO BE SUBMITTED. BY CLICKING THE OK BUTTON, I UNDERSTAND THAT THE SUBMISSION OF THIS REGISTRATION CONSTITUTES MY SIGNATURE PURSUANT TO LOCAL RULE 9011-4. 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. BY CLICKING THE OK BUTTON, I UNDERSTAND THAT THE SUBMISSION OF THIS REGISTRATION CONSTITUTES MY SIGNATURE PURSUANT TO LOCAL RULE 9011-4. CLICK THE OK BUTTON TO COMPLETE THE SUBMISSION PROCESS."
//document.MM_returnValue = confirm(alertsay);
//alert(alertsay);
//return (false);
// replace the above with return(true); if you have a valid form to submit to
}

