function isEmail(valor) {
  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)){
    return (true)
  } else {
    return (false);
  }
}

function pega_cidades(cduf,selectedcdmunicipio) {
    document.form.cdmunicipio.disabled = true;
	urlest = "/indprof/lib/filtro_municipios.php?cduf="+cduf+"&selectedcdmunicipio="+selectedcdmunicipio;
	if_hidden.location.href=urlest;
}

function somentenumero(evt)
{
  var tecla = evt.keyCode ? evt.keyCode :
              evt.charCode ? evt.charCode :
		      evt.which ? evt.which : void 0;
  if((tecla > 47 && tecla < 58) || tecla == 9)  // numeros || tab
    return true;
  else
    {
      if (tecla != 8) // backspace
        return false;
      else
        return true;
    }
}

function FormataData(input, evt){
  var tecla = evt.keyCode ? evt.keyCode :
              evt.charCode ? evt.charCode :
		      evt.which ? evt.which : void 0;
   if ((tecla<48)||(tecla>57)){
      event.returnValue = false;
	} else {
       if ((input.value.length==2)||(input.value.length==5))
       		input.value=input.value + "/" ;
  	}
}

// valida form contato

function checkdata_faleconosco() {
	with(document.frmcontato) {
	        if (nome.value == "") {
			alert("O campo NOME é obrigatório.");
			nome.focus();
			return false; }
    		 if (email.value == "") {
    			alert("O campo E-MAIL é obrigatório.");
    			email.focus();
    			return false;
    		}
    		 if (assunto.value == "") {
    			alert("O campo ASSUNTO é obrigatório.");
    			assunto.focus();
    			return false;
    		}
    		 if (mensagem.value == "") {
    			alert("O campo MENSAGEM é obrigatório.");
    			mensagem.focus();
    			return false;
    		}
            submit();
	}
}
// valida form login

function checkdata_login() {
	with(document.frmlogin) {
	        if (id.value == "") {
			alert("O campo USUÁRIO é obrigatório.");
			id.focus();
			return false; }
		 if (senha.value == "") {
			alert("O campo SENHA é obrigatório.");
			senha.focus();
			return false;
		}
                        submit();
	}
}

