function Form_Validator(theForm)
{

// check to see if the first name field is blank
if (theForm.Firstname.value == "")
{
alert("Please enter your first name.");
theForm.Firstname.focus();
return (false);
}

// allow ONLY alphanumeric keys, no symbols or punctuation
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 letters in the \"First Name\" field.");
theForm.Firstname.focus();
return (false);
}

// check to see if the last name field is blank
if (theForm.Lastname.value == "")
{
alert("Please enter your last name.");
theForm.Lastname.focus();
return (false);
}

// allow ONLY alphanumeric keys, no symbols or punctuation
var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ";
var checkStr = theForm.Lastname.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 letters in the \"Last Name\" field.");
theForm.Lastname.focus();
return (false);
}

// check if email field is blank
if (theForm.Email.value == "")
{
alert("Please enter an email address.");
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\" provided is invalid!");
theForm.Email.focus();
return (false);
}

// check to see if the first name field is blank
if (theForm.Address1.value == "")
{
alert("Please enter your address.");
theForm.Address1.focus();
return (false);
}

// check to see if the first name field is blank
if (theForm.Phone.value == "")
{
alert("Please enter your phone no.");
theForm.Phone.focus();
return (false);
}
// allow ONLY alphanumeric keys, no symbols or punctuation
var checkOK = "0123456789- ";
var checkStr = theForm.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 only numbers in the \"Phone\" field.");
theForm.Phone.focus();
return (false);
}

// check to see if the first name field is blank
if (theForm.Cellphone.value == "")
{
alert("Please enter your cellphone no.");
theForm.Cellphone.focus();
return (false);
}
// allow ONLY alphanumeric keys, no symbols or punctuation
var checkOK = "0123456789- ";
var checkStr = theForm.Cellphone.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 numbers in the \"Cellphone\" field.");
theForm.Cellphone.focus();
return (false);
}


}


