function Form1_Validator(theForm)
{
var alertsay = ""; 

// check to see if the field is blank
if (theForm.FirstName.value == "")
{
alert("You must enter your First Name.");
theForm.FirstName.focus();
return (false);
}

// allow ONLY alphanumeric keys, no symbols or punctuation
// this can be altered for any "checkOK" string you desire
var checkOK = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&" -_';
var checkStr = theForm.FirstName.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 only letter and numeric characters in the \"First Name\" field.");
theForm.FirstName.focus();
return (false);
}

if (theForm.LastName.value == "")
{
alert("You must enter your Last Name.");
theForm.LastName.focus();
return (false);
}

// check if Email field is blank
if (theForm.Email.value == "")
{
alert("Please enter a value 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);
}

// check if numbers field is blank
if (theForm.Phone.value == "")
{
alert("Please enter a value for the \"Phone\" field.");
theForm.Phone.focus();
return (false);
}

// only allow numbers to be entered
var checkOK = "0123456789-()";
var checkStr = theForm.Phone.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 only digit characters in the \"Phone\" field.");
theForm.Phone.focus();
return (false);
}

if (theForm.Phone.value.length < 10)
{
alert("\"Phone\" Number should be 10 digits ");
theForm.Phone.focus();
return (false);
}

if (theForm.Comment.value == "")
{
alert("You must enter brief description.");
theForm.Comment.focus();
return (false);
}

}
