/*FORMATA CAMPOS COM MASCARA*/
function FormataCampo(e,src,mask) {
    if(window.event) { _TXT = e.keyCode; }
    else if(e.which) { _TXT = e.which; }
    if(_TXT > 47 && _TXT < 58) {
 var i = src.value.length; var saida = mask.substring(0,1); var texto = mask.substring(i)
 if (texto.substring(0,1) != saida) { src.value += texto.substring(0,1); }
    return true; } else { if (_TXT != 8) { return false; }
 else { return true; }
    }
}
/*VALIDA OS CAMPOS*/
function validaForm() {
d = document.sorteio;

//NOME
if (d.nome.value == "") {
	alert("Preencha o campo NOME corretamente");
	d.nome.focus();
	return false;
}

//E-MAIL
if (d.email.value == "" || d.email.value.indexOf('@')==-1 || d.email.value.indexOf('.')==-1 ){
	alert( "Preencha campo E-MAIL corretamente!" );
	d.email.focus();
	return false;
}

//ENDERECO
if (d.endereco.value == "") {
	alert("Preencha o campo ENDERECO corretamente.");
	d.endereco.focus();
	return false;
}

//BAIRRO
if (d.bairro.value == ""){
	alert("Preencha o campo BAIRRO corretamente");
	d.bairro.focus();
	return false;
}

//CIDADE
if (d.cidade.value == ""){
	alert("Preencha o campo CIDADE corretamente");
	d.cidade.focus();
	return false;
}

//ESTADO
if (d.uf.value == ""){
	alert("Preencha o campo ESTADO corretamente");
	d.uf.focus();
	return false;
}

//CEP
if (d.cep.value == ""){
	alert("Preencha o campo CEP corretamente");
	d.cep.focus();
	return false;
}

return true;
}