function Form1_Validator(theForm)
{

var alertsay = ""; 
// check if  Name field is blank
if (theForm.realname.value == "")
{
alert("Please enter a value for the \" Name\" field.");
theForm.realname.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.email.value.length < 5)
{
alert("Please enter a value for the \"Email\" field.");
theForm.email.focus();
return (false);
}

// check if no Product has been selected
if (theForm.products.selectedIndex < 0)
{
alert("Please select one of the \"Products\" options.");
theForm.products.focus();
return (false);
}

// check if the first drop down is selected, if so, invalid selection
if (theForm.products.selectedIndex == 0)
{
alert("The first \"Products\" option is not a valid selection.");
theForm.products.focus();
return (false);
}
var alertsay = ""; 
// check if  Secure field is blank
if (theForm.code.value == "")
{
alert("Please type the numbers in the image below into the box");
theForm.code.focus();
return (false);
}
}
