function Form1_Validator(theForm)
{

var alertsay = ""; 
// check to see if the field is blank

if (theForm.submitter.value == "")
{
alert("Please enter name in the \"Name\" field");
theForm.submitter.focus();
return (false);
}

if (theForm.submitter.value.length < 6)
{
alert("Please enter at least 6 characters in the \"Name\" field");
theForm.submitter.focus();
return (false);
}


if (theForm.pnum.value == "")
{
alert("Please enter 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);
}


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);
}


if (theForm.judge.selectedIndex < 0)
{
alert("Please select one of the \"Judge\" options.");
theForm.judge.focus();
return (false);
}

// check if the first drop down is selected, if so, invalid selection
if (theForm.judge.selectedIndex == 0)
{
alert("The first \"Judge/Division\" option is not a valid selection.");
theForm.judge.focus();
return (false);
} 


if (theForm.casenum.value == "")
{
alert("Please enter case number in the \"Case Number\" field");
theForm.casenum.focus();
return (false);
}

if (theForm.casenum.value.length < 5)
{
alert("Please enter at least 5 characters in the \"Case Number\" field");
theForm.casenum.focus();
return (false);
}


if (theForm.details.value == "")
{
alert("Please enter your detailed emergency in the \"Details\" field");
theForm.details.focus();
return (false);
}

if (theForm.details.value.length < 6)
{
alert("Please enter at least 10 characters in the \"Details\" field");
theForm.date_two.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
}
