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.nome.value == "" )
  {
    alert('Favor digitar o seu nome.');
    theForm.nome.focus();
    return false;
  }
  if ( theForm.endereco.value == "" )
  {
    alert('Favor digitar o seu endereço.');
    theForm.endereco.focus();
    return false;
  }
   if ( theForm.cidade.value == "" )
  {
    alert('Favor digitar o sua Cidade.');
    theForm.cidade.focus();
    return false;
  } 
  	
	if ( theForm.cep.value == "" )
  {
    alert('Favor digitar o seu CEP.');
    theForm.cep.focus();
    return false;
  }
  
  if ( theForm.estado.value == "" )
  {
    alert('Favor digitar o seu Estado.');
    theForm.estado.focus();
    return false;
  }  
		
  if ( theForm.celular.value == "" )
  {
    alert('Favor digitar o seu celular.');
    theForm.celular.focus();
    return false;
  }
  if ( theForm.capital_giro.value == "" )
  {
    alert('Favor digitar o seu Capital de Giro.');
    theForm.capital_giro.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.cidade_i.value == "" )
  {
    alert('Favor digitar a sua Cidade de Interesse.');
    theForm.cidade_i.focus();
    return false;
  }    
    
  
  
}
