// JavaScript Document
function validateForm(contact)
{

  var alertsay = ""; // define for long lines
  // alertsay is not necessary for your code,
  // but I need to break my lines in multiple lines
  // so the code won't extend off the edge of the page
  
  // check to see if the field is blank
  if (contact.MyName.value == "")
  {
    alert("Please enter your Name.");
    contact.MyName.focus();
    return (false);
  }

  // require at least 3 characters be entered
  if (contact.MyName.value.length < 2)
  {
    alert("At least 2 characters are required for your Name.");
    contact.MyName.focus();
    return (false);
  }
  // check if numbers field is blank
 if (contact.PhoneNo.value == "")
  {
    alert("Please enter your Phone number.");
    contact.PhoneNo.focus();
    return (false);
  }

  // only allow numbers to be entered
  var checkOK = "0123456789-()";
  var checkStr = contact.PhoneNo.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 your phone number. Use the form 865-555-1212. Thank You.");
    contact.PhoneNo.focus();
    return (false);
  }
   // check if email field is blank
 if (contact.Email.value == "")
  {
    alert("Please enter a value for the \"Email\" field.");
    contact.Email.focus();
    return (false);
  }
  // test if valid email address, must have @ and .
  var checkEmail = "@.";
  var checkStr = contact.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("Your email address appears to be invalid, please enter it again. Use the form : amanda@ladidasale.com. Thank You.");
    contact.Email.focus();
    return (false);
  }
   // check to see if the field is blank
  if (contact.ContactMeVia.value == "")
  {
    alert("Please tell us how you want us to contact you. Thank you.");
    contact.ContactMeVia.focus();
    return (false);
  }
  
    // check to see if the field is blank
  if (contact.Address.value == "")
  {
    alert("Please enter your Street Address.");
    contact.Address.focus();
    return (false);
  }
      // check to see if the field is blank
  if (contact.City.value == "")
  {
    alert("Please enter your City.");
    contact.City.focus();
    return (false);
  }
        // check to see if the field is blank
  if (contact.State.value == "")
  {
    alert("Please select your State.");
    contact.State.focus();
    return (false);
  }
          // check to see if the field is blank
  if (contact.Zip.value == "")
  {
    alert("Please select your Zip Code.");
    contact.Zip.focus();
    return (false);
  }
       return (true);
  // replace the above with return(true); if you have a valid form to submit to
}
//-->