function FORM_Validator(theForm)
{
  if (theForm.NOME.value == "")
  {
    alert("ERRO\nO campo NOME deve ser preenchido!");
    theForm.NOME.focus();
    theForm.NOME.select();
    return (false);
  }

  if (theForm.NOME.value.length < 3)
  {
    alert("ERRO\nO campo NOME deve ter pelo menos 3 caracteres!");
    theForm.NOME.focus();
    theForm.NOME.select();
    return (false);
  }

  if (theForm.NOME.value.length > 25)
  {
    alert("ERRO\nO campo NOME deve no máximo 25 caracteres!");
    theForm.NOME.focus();
    theForm.NOME.select();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzÁÃÇÉÊÍÓÔÕÚáâãçéêíóôõú \t\r\n\f";
  var checkStr = theForm.NOME.value;
  var allValid = 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("ERRO\nO campo NOME deve conter apenas LETRAS.");
    theForm.NOME.focus();
    theForm.NOME.select();
    return (false);
  }

  if (theForm.EMAIL.value == "")
  {
    alert("ERRO\nO campo EMAIL deve ser preenchido!");
    theForm.EMAIL.focus();
    theForm.EMAIL.select();
    return (false);
  }

  if (theForm.EMAIL.value.length < 10)
  {
    alert("ERRO\nO campo EMAIL deve ter pelo menos 10 caracteres!");
    theForm.EMAIL.focus();
    theForm.EMAIL.select();
    return (false);
  }

  if (theForm.EMAIL.value.length > 40)
  {
    alert("ERRO\nO campo EMAIL deve no máximo 40 caracteres!");
    theForm.EMAIL.focus();
    theForm.EMAIL.select();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-@_.";
  var checkStr = theForm.EMAIL.value;
  var allValid = 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("ERRO\nO campo EMAIL contém CARACTER(ES) INVÁLIDO(S)!");
    theForm.EMAIL.focus();
    theForm.EMAIL.select();
    return (false);
  }

  if (theForm.EMAIL.value.indexOf('@',0)==-1 ||
      theForm.EMAIL.value.indexOf('@',0)== 0 ||
      theForm.EMAIL.value.indexOf('.',0)==-1)
  {
    alert("ERRO\nEndereço de EMAIL inválido!");
    theForm.EMAIL.focus();
    theForm.EMAIL.select();
    return (false);
  }    

  if (theForm.EMPRESA.value == "")
  {
    alert("ERRO\nO campo EMPRESA deve ser preenchido!");
    theForm.EMPRESA.focus();
    theForm.EMPRESA.select();
    return (false);
  }

  if (theForm.EMPRESA.value.length < 5)
  {
    alert("ERRO\nO campo EMPRESA deve ter pelo menos 10 caracteres!");
    theForm.EMPRESA.focus();
    theForm.EMPRESA.select();
    return (false);
  }

  if (theForm.EMPRESA.value.length > 25)
  {
    alert("ERRO\nO campo EMPRESA deve no máximo 25 caracteres!");
    theForm.EMPRESA.focus();
    theForm.EMPRESA.select();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzÁÃÇÉÊÍÓÔÕÚáâãçéêíóôõú0123456789-/. \t\r\n\f";
  var checkStr = theForm.EMPRESA.value;
  var allValid = 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("ERRO\nO campo EMPRESA contém CARACTER(ES) INVÁLIDO(S)!");
    theForm.EMPRESA.focus();
    theForm.EMPRESA.select();
    return (false);
  }

  if (theForm.PREFIXO.value == "")
  {
    alert("ERRO\nO campo PREFIXO deve ser preenchido!");
    theForm.PREFIXO.focus();
    theForm.PREFIXO.select();
    return (false);
  }

  if (theForm.PREFIXO.value.length < 3)
  {
    alert("ERRO\nO campo PREFIXO deve ter 03 caracteres!");
    theForm.PREFIXO.focus();
    theForm.PREFIXO.select();
    return (false);
  }

  if (theForm.PREFIXO.value.length > 3)
  {
    alert("ERRO\nO campo PREFIXO deve ter 03 caracteres!");
    theForm.PREFIXO.focus();
    theForm.PREFIXO.select();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = theForm.PREFIXO.value;
  var allValid = true;
  var decPoints = 0;
  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;
    }
    allNum += ch;
  }
  if (!allValid)
  {
    alert("ERRO\nO campo PREFIXO deve conter apenas NÚMEROS!");
    theForm.PREFIXO.focus();
    theForm.PREFIXO.select();
    return (false);
  }

  if (theForm.TELEFONE.value == "")
  {
    alert("ERRO\nO campo TELEFONE deve ser preenchido!");
    theForm.TELEFONE.focus();
    theForm.TELEFONE.select();
    return (false);
  }

  if (theForm.TELEFONE.value.length < 8)
  {
    alert("ERRO\nO campo TELEFONE deve ter 08 caracteres!");
    theForm.TELEFONE.focus();
    theForm.TELEFONE.select();
    return (false);
  }

  if (theForm.TELEFONE.value.length > 8)
  {
    alert("ERRO\nO campo TELEFONE deve ter 08 caracteres!");
    theForm.TELEFONE.focus();
    theForm.TELEFONE.select();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = theForm.TELEFONE.value;
  var allValid = true;
  var decPoints = 0;
  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;
    }
    allNum += ch;
  }
  if (!allValid)
  {
    alert("ERRO\nO campo TELEFONE deve conter apenas NÚMEROS!\nOBS.: Sem o traço(-).");
    theForm.TELEFONE.focus();
    theForm.TELEFONE.select();
    return (false);
  }
  return (true);
}
