// <!-- Validate entries
function Validate ( obj ) {
	if ( (obj.nameto.value == "") || (obj.namefrom.value == "") ) {
		alert ('Please provide names in both name fields');
		return false;
	}
	if ( (obj.emailto.value == "") || (obj.emailfrom.value == "") ) {
		alert ('Please provide email addresses in both fields');
		return false;
	}
		if (obj.emailto.value.indexOf ('@',0) == -1 || 
	obj.emailto.value.indexOf ('.',0) == -1)
	{
		alert("\nThe email field requires a \"@\" and a \".\" be used.\n\nPlease re-enter your e-mail address.")
		obj.emailto.select();
		obj.emailto.focus();
		return false;
	}
	if (obj.emailfrom.value.indexOf ('@',0) == -1 || 
	obj.emailfrom.value.indexOf ('.',0) == -1)
	{
		alert("\nThe email field requires a \"@\" and a \".\" be used.\n\nPlease re-enter your e-mail address.")
		obj.emailfrom.select();
		obj.emailfrom.focus();
		return false;
	}
return true;
}

function do_redirect(u) {
	window.location.href = u;
}
function Form1_Validator(theForm)
{
	// check to see if required fields are blank
	if (theForm.txtCName.value == "")
	{
		alert("You must enter a Full Name.");
		theForm.txtCName.focus();
		return (false);
	}
	if (!check_email(theForm.txtEmailAddress))
	{
		alert("Email Address is not in acceptable format.");
		theForm.txtEmailAddress.focus();
		return (false);
	}
	if (theForm.txtEmailAddress.value == "")
	{
		alert("You must enter an Email Address.");
		theForm.txtEmailAddress.focus();
		return (false);
	}
	if (theForm.txtComments.value == "Enter information here.")
	{
		alert("You must enter some information.");
		theForm.txtComments.focus();
		return (false);
	}
	// Validate zip code by checking for blank and then 5 digits
	if (theForm.txtZip.value == "")
	{
		alert("You must enter a Zip Code.");
		theForm.txtZip.focus();
		return (false);
	}
	if (!check_zipcode(theForm.txtZip))
	{
		alert("Please enter only digit characters (exactly 5 digits) in the \"Zip\" field.");
		theForm.txtZip.focus();
		return (false);
	}
	return (true);
}

function Registration_Form1_Validator(theForm) {
	// check to see if required fields are blank
	if (theForm.txtFirstName.value == "")
	{
		alert("You must enter a First Name.");
		theForm.txtFirstName.focus();
		return (false);
	}
	if (theForm.txtLastName.value == "")
	{
		alert("You must enter a Last Name.");
		theForm.txtLastName.focus();
		return (false);
	}
	if (!check_email(theForm.txtEmailAddress))
	{
		alert("The \"Email Address\" field must contain an \"@\" and a \".\".");
		theForm.txtEmailAddress.focus();
		return (false);
	}
	if (theForm.txtEmailAddress.value == "")
	{
		alert("You must enter an Email Address.");
		theForm.txtEmailAddress.focus();
		return (false);
	}
	if (theForm.txtAddress1.value == "")
	{
		alert("You must enter an Address.");
		theForm.txtAddress1.focus();
		return (false);
	}
	if (theForm.txtCity.value == "")
	{
		alert("You must enter a City.");
		theForm.txtCity.focus();
		return (false);
	}
	// check if no state drop down has been selected
	if (theForm.txtStateId.selectedIndex < 0)
	{
		alert("Please select one of the \"State\" options.");
		theForm.txtStateId.focus();
		return (false);
	}
	// check if the first state drop down is selected, if so, invalid selection
	if (theForm.txtStateId.selectedIndex == 0)
	{
		alert("The first \"State\" option is not a valid selection.");
		theForm.txtStateId.focus();
		return (false);
	}
	// Validate zip code by checking for blank and then 5 digits
	if (theForm.txtZip.value == "")
	{
		alert("You must enter a Zip Code.");
		theForm.txtZip.focus();
		return (false);
	}
	if (!check_zipcode(theForm.txtZip))
	{
		alert("Please enter only digit characters (exactly 5 digits) in the \"Zip\" field.");
		theForm.txtZip.focus();
		return (false);
	}
	return (true);
}

function check_email (emailaddress) {
	// test if valid email address, must have @ and .
	var checkEmail = "@.";
	var checkStr = emailaddress.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)
	{
		return (false);
	}
	return(true);
}

function check_zipcode (zipcode) {
	// Only allow numbers to be entered in the zip field
	var checkOK = "0123456789";
	var checkStr = zipcode.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 (checkStr.length != 5)
	{
		allValid = false;
	}
	return (allValid);
}

// -->
// done hiding -->
