function Form2_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);

}



if (theform.LastName.value == "")

{

alert("You must enter your last name.");

theform.LastName.focus();

return (false);

}



if (theform.Phone.value == "")

{

alert("You must enter your phone number.");

theform.Phone.focus();

return (false);

}



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 numeric characters in the \"phone number\" field.");

theform.Phone.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 is invalid. Please re-enter.");

theform.Email.focus();

return (false);

}



if(theform.AgeVerified.checked){

  }else{



  alert('You must be 24 years or older to continue.')

  theform.AgeVerified.focus();

  return false;

}

if(theform.ResidentVerified.checked){

  }else{



  alert('You must be an Indianapolis resident to continue.')

  theform.ResidentVerified.focus();

  return false;

}

	return (true);

// replace the above with return(true); if you have a valid form to submit to

}



