
function ValidateForm(theForm)
{
  var emailstring = theForm.Contact_Email.value;
  var ampIndex = emailstring.indexOf("@");
  var afterAmp = emailstring.substring((ampIndex + 1), emailstring.length);
  // find a dot in the portion of the string after the ampersand only
  var dotIndex = afterAmp.indexOf(".");
  // determine dot position in entire string (not just after amp portion)
  dotIndex = dotIndex + ampIndex + 1;
  // afterAmp will be portion of string from ampersand to dot
  afterAmp = emailstring.substring((ampIndex + 1), dotIndex);
  // afterDot will be portion of string from dot to end of string
  var afterDot = emailstring.substring((dotIndex + 1), emailstring.length);
  var beforeAmp = emailstring.substring(0,(ampIndex));
  var regex = /\;|#|\$|%|\^|&|\*|\(|\)|\+|\\|\/|\?|>|<|\{|\}|\,|\[|\]|\`|\|/;
  // index of -1 means "not found"
  if ((emailstring.indexOf("@") != "-1") &&
     (emailstring.length > 5) &&
     (afterAmp.length > 0) &&
     (beforeAmp.length > 1) &&
     (afterDot.length > 1) &&
     ! (regex.test(emailstring)) ) 
     {;
  } else {
     alert("Please enter a valid email address!");
     theForm.Contact_Email.focus();
     return false;
  }

  if (theForm.Contact_FullName.value == "")
  {
    alert("Please enter a value for the \"Name\" field.");
    theForm.Contact_FullName.focus();
    return (false);
  }
  if (theForm.Contact_FullName.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Name\" field.");
    theForm.Contact_FullName.focus();
    return (false);
  }
  if (theForm.Contact_FullName.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"Name\" field.");
    theForm.Contact_FullName.focus();
    return (false);
  }
 /* if (theForm.Contact_Title.value == "")
  {
    alert("Please enter a value for the \"title\" field.");
    theForm.Contact_Title.focus();
    return (false);
  }
  if (theForm.Contact_Title.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"title\" field.");
    theForm.Contact_Title.focus();
    return (false);
  }
  if (theForm.Contact_Title.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"title\" field.");
    theForm.Contact_Title.focus();
    return (false);
  }
  */
  if (theForm.Contact_Organization.value == "")
  {
    alert("Please enter a value for the \"Organization\" field.");
    theForm.Contact_Organization.focus();
    return (false);
  }
  if (theForm.Contact_Organization.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Organization\" field.");
    theForm.Contact_Organization.focus();
    return (false);
  }
  if (theForm.Contact_Organization.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"Organization\" field.");
    theForm.Contact_Organization.focus();
    return (false);
  }
  if (theForm.Contact_StreetAddress.value == "")
  {
    alert("Please enter a value for the \"Address\" field.");
    theForm.Contact_StreetAddress.focus();
    return (false);
  }
  if (theForm.Contact_StreetAddress.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Address\" field.");
    theForm.Contact_StreetAddress.focus();
    return (false);
  }
  if (theForm.Contact_StreetAddress.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"Address\" field.");
    theForm.Contact_StreetAddress.focus();
    return (false);
  }
  if (theForm.Contact_City.value == "")
  {
    alert("Please enter a value for the \"City\" field.");
    theForm.Contact_City.focus();
    return (false);
  }
  if (theForm.Contact_City.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"City\" field.");
    theForm.Contact_City.focus();
    return (false);
  }
  if (theForm.Contact_City.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"City\" field.");
    theForm.Contact_City.focus();
    return (false);
  }
  if (theForm.Contact_State.value == "")
  {
    alert("Please enter a value for the \"State\" field.");
    theForm.Contact_State.focus();
    return (false);
  }
  if (theForm.Contact_State.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"State\" field.");
    theForm.Contact_State.focus();
    return (false);
  }
  if (theForm.Contact_State.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"State\" field.");
    theForm.Contact_State.focus();
    return (false);
  }
  if (theForm.Contact_ZipCode.value == "")
  {
    alert("Please enter a value for the \"Zip\" field.");
    theForm.Contact_ZipCode.focus();
    return (false);
  }
  if (theForm.Contact_ZipCode.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Zip\" field.");
    theForm.Contact_ZipCode.focus();
    return (false);
  }
  if (theForm.Contact_ZipCode.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"Zip\" field.");
    theForm.Contact_ZipCode.focus();
    return (false);
  }

/*	Remove this because European mail codes are alpha-numeric
  Zipval = theForm.Contact_ZipCode.value
  Ziplen = Zipval.length
  for (i = 0; i <= Ziplen-1; i++) {
  if (Zipval.charAt(i) < "0" || Zipval.charAt(i) > "9") 
    {
      alert("Please enter a numeric value in the \"Zip\" field.")
      return false
    }
  }

*/


  if (theForm.Contact_Country.value == "")
  {
    alert("Please enter a value for the \"Country\" field.");
    theForm.Contact_Country.focus();
    return (false);
  }
  if (theForm.Contact_Country.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Country\" field.");
    theForm.Contact_Country.focus();
    return (false);
  }
  if (theForm.Contact_Country.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"Country\" field.");
    theForm.Contact_Country.focus();
    return (false);
  }
  if (theForm.Contact_WorkPhone.value == "")
  {
    alert("Please enter a value for the \"Phone\" field.");
    theForm.Contact_WorkPhone.focus();
    return (false);
  }
  if (theForm.Contact_WorkPhone.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Phone\" field.");
    theForm.Contact_WorkPhone.focus();
    return (false);
  }
  if (theForm.Contact_WorkPhone.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"Phone\" field.");
    theForm.Contact_WorkPhone.focus();
    return (false);
  }
  if (theForm.Contact_Email.value == "")
  {
    alert("Please enter a value for the \"Email\" field.");
    theForm.Contact_Email.focus();
    return (false);
  }
  if (theForm.Contact_Email.value.length < 3)
  {
    alert("Please enter at least 3 characters in the \"Email\" field.");
    theForm.Contact_Email.focus();
    return (false);
  }
  if (theForm.Contact_Email.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"Email\" field.");
    theForm.Contact_Email.focus();
    return (false);
  }

  return (true);
}