function isNotMail(mailField){
  strMail = mailField.value
  var re = new RegExp;
  re = /.+@.+\..+/;
  var arr = re.exec(strMail);
  if (arr == null)
    return(true)
  else
    return(false);
}

function minLen(txtField, minVal){
  strExp = txtField.value
  l = strExp.length;
  if (l < minVal)
    return(true);
  else
    return(false);
}

function isBlank(txtField){
  if (txtField.value)
    return (false);
  else
    return(true)
}

function isSelectedZero(txtField){
  selected = txtField.selectedIndex;
  if (selected == 0)
    return(true);
  else
    return(false);
}

function isFieldBlank(theField)
{
  var inStr = theField.value;
  var inLen = inStr.length;
      
  for(var i = 0; i < inLen; i++)
  {
    var ch = inStr.substring(i, i+1)

    if (ch != " ")
      return (false);   
  }

  //Permissoes de seguranca nao deixavam a atribuicao funcionar 
  inStr = "";
  return (true);
}

function isEmail(mail)
{
  if (mail.value.length < 6)
  {
    return (false);
  }
  myRe = new RegExp;
  
  RegExp.lastIndex = 0;

  myRe = /([_a-zA-Z\d\-\.][_a-zA-Z\d\-\.]+)@([_a-zA-Z\d\-][_a-zA-Z\d\-]+(\.[_a-zA-Z\d\-][_a-zA-Z\d\-]+))/;

  if (! myRe.test(mail.value))
  {
    return false;
  }
  
  myRe.exec(mail);

  myRe = null;

  return (true);
}

function isFone(theFone)
{
  inStr = theFone.value;
  inLen = inStr.length;

  var ContAbr = 0;
  var ContFec = 0;
  var PosAbr  = 0;
  var PosFec  = 0;

  for(var i = 0; i < inLen; i++)
  {
    var ch = inStr.substring(i, i+1);
  
    if ((ch != "0") && (ch != "1") && (ch != "2") && (ch != "3") && (ch != "4") && (ch != "5") && (ch != "6") && (ch != "7") && (ch != "8") && (ch != "9") && (ch != "(") && (ch != ")") && (ch != " "))
      return (false);

    if (ch == "(")
    {
      ContAbr = ContAbr + 1;
      PosAbr  = i;
    }
    
    if (ch == ")")
    {
      ContFec = ContFec + 1;
      PosFec  = i;
    }
  }
  
  if (ContAbr == 0)
    return (false);
  
  if (ContAbr > 0 || ContFec > 0)
  {
    if (ContAbr > 1 || ContFec > 1)
      return (false);

    if (ContAbr != ContFec)
      return (false);
  }

  if (PosAbr > PosFec)
    return (false);

  if ((PosFec + 1 )== inLen)
    return (false);

  return (true);
}



