// JavaScript Document
function FrontPage_Form1_Validator(theForm)
{

  if (theForm.Name.value == "")
  {
    alert("Please enter a value for the \"Name\" field.");
    theForm.Name.focus();
    return (false);
  }

  if (theForm.Name.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Name\" field.");
    theForm.Name.focus();
    return (false);
  }

  if (theForm.Name.value.length > 100)
  {
    alert("Please enter at most 100 characters in the \"Name\" field.");
    theForm.Name.focus();
    return (false);
  }

  if (theForm.Address.value == "")
  {
    alert("Please enter a value for the \"Address\" field.");
    theForm.Address.focus();
    return (false);
  }

  if (theForm.Address.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Address\" field.");
    theForm.Address.focus();
    return (false);
  }

  if (theForm.Address.value.length > 100)
  {
    alert("Please enter at most 100 characters in the \"Address\" field.");
    theForm.Address.focus();
    return (false);
  }

  if (theForm.Telephone.value == "")
  {
    alert("Please enter a value for the \"Telephone\" field.");
    theForm.Telephone.focus();
    return (false);
  }

  if (theForm.Telephone.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Telephone\" field.");
    theForm.Telephone.focus();
    return (false);
  }

  if (theForm.Telephone.value.length > 25)
  {
    alert("Please enter at most 25 characters in the \"Telephone\" field.");
    theForm.Telephone.focus();
    return (false);
  }

  if (theForm.E_mail.value == "")
  {
    alert("Please enter a value for the \"E_mail\" field.");
    theForm.E_mail.focus();
    return (false);
  }

  if (theForm.E_mail.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"E_mail\" field.");
    theForm.E_mail.focus();
    return (false);
  }

  if (theForm.E_mail.value.length > 100)
  {
    alert("Please enter at most 100 characters in the \"E_mail\" field.");
    theForm.E_mail.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_-.@";
  var checkStr = theForm.E_mail.value;
  var allValid = true;
  var validGroups = 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 letter, digit and \"_-.@\" characters in the \"E_mail\" field.");
    theForm.E_mail.focus();
    return (false);
  }

  if (theForm.Inquiry.value == "")
  {
    alert("Please enter a value for the \"Inquiry\" field.");
    theForm.Inquiry.focus();
    return (false);
  }

  if (theForm.Inquiry.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Inquiry\" field.");
    theForm.Inquiry.focus();
    return (false);
  }

  if (theForm.Inquiry.value.length > 1000)
  {
    alert("Please enter at most 1000 characters in the \"Inquiry\" field.");
    theForm.Inquiry.focus();
    return (false);
  }
  if(theForm.turingcode.value != theForm.code.value)
  {
	alert("Security code you entered is invalid");
    theForm.code.focus();
    return (false);

  }
  return (true);
}

