function ValidateEmail(email)
{
  if(email.indexOf(" ")!=-1) return (false);
  var len=email.length;
  var at=email.indexOf("@");
  var tch=email.lastIndexOf(".");
  if((len>5) && (at==email.lastIndexOf("@")) && (tch>at+1) && (tch<len-2) && (at>0) && (at<len-1)) return (true);
    return (false);
}

function ValidateEmailForm(theForm)
{
  if (ValidateEmail(theForm.email.value)) {
     if (theForm.text.value != "")  {
        return (true);
     } else {
        alert("Warning! The message body could not be empty."); 
        theForm.text.focus();
     }
  } else {
     alert("Warning! You should enter correct e-mail address.");
     theForm.email.focus();
  }
  return (false);
}

function ValidateSubsEmail(theEmail)
{
  if (ValidateEmail(theEmail.value)) {
     return (true);
  } else {
     alert("Warning! You should enter correct e-mail address.");
     theEmail.focus();
     return (false);
  }
}
