function EmailCheck(Email)
{

  if (Email.indexOf("@")<2) {return (false);}
  if (Email.indexOf("@")!= Email.lastIndexOf("@")) {return (false);}
  if (Email.indexOf(".") ==-1) {return (false);}
  if (Email.indexOf(" ") !=-1) {return (false);}
 if (Email.lastIndexOf(".") < (Email.length-4)) {return (false);}
  return (true);
}

function Form_Validator(theForm)
{
  if (theForm.subject.value == "")
  {
    alert(",    .");
    theForm.subject.focus();
    return (false);
  }

  if ((theForm.text.value == "") || (theForm.text.value == " "))
  {
    alert(",    .");
    theForm.text.focus();
    return (false);
  }

  if (theForm.text.value.length > 1000)
  {
    alert("     1000 . \n,   .");
    theForm.text.focus();
    return (false);
  } 
 
  if ( (theForm.firm.value == "")&&(theForm.person.value == "") )
  {
    alert(",   \n   .");
    theForm.firm.focus();
    return (false);
  }
  
  if ( (theForm.email.value == "") )
  {
    alert(",   E-mail.");
    theForm.email.focus();
    return (false);
  }
  
  if ( (theForm.email.value != "")&&(!EmailCheck(theForm.email.value)))
  {
    alert("   Email.");
    theForm.email.focus();
    return (false);
  }
  
 return (true);
}
