// Função para checar e-mail
function isEmail(str)
{
  // browser suporta expressoes regulares em javascript?
  var supported = 0;
  if (window.RegExp) {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported)
    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  return (!r1.test(str) && r2.test(str));
}

function checkForm ( theForm )
{
  
  if ( theForm.empresa.value == "" ) {
    alert('Favor digitar o nome da sua Empresa.');
    theForm.empresa.focus();
    return false;
  }
  if ( theForm.nome.value == "" ) 
  {
    alert('Favor digitar seu nome corretamente.');
    theForm.nome.focus();
    return false;
  }
  
   if ( theForm.mail.value == "" ) 
 {
    alert('Favor digitar seu e-mail.');
    theForm.mail.focus();
    return false;
  } 
  else 
  {
    if (isEmail(theForm.mail.value)==false ) {
        alert('Digite seu e-mail corretamente.');
        theForm.mail.focus();
        return false;
    }
  }  
  
   
  if ( theForm.ddd.value == "" ) 
  {
    alert('Favor digitar o DDD do telefone.');
    theForm.ddd.focus();
    return false;
  }
  
  if ( theForm.telefone.value == "" ) {
    alert('Favor digitar o telefone.');
    theForm.telefone.focus();
    return false;
  }  
 
}
