
function RetornaCEP(f,Obj) {
	if(Obj.value.length=8 && isNaN(Obj.value)==false) {
		f.Acao.value=''; f.onsubmit=''; f.submit();
	}
	else { alert('Informe o CEP corretamente. Apenas números.'); Obj.focus(); Obj.select(); return false;}
}

var verifica = function(f) {

	if(f.Nome.value==''){alert('Informe seu nome completo');f.Nome.focus();f.Nome.select();return false;}
	if(f.Sexo){if(f.Sexo.value==''){alert('Informe o sexo');f.Sexo.focus();return false;}}
	if(f.DataNasc.value==''){
		alert('Informe sua data de nascimento'); f.DataNasc.focus(); return false;
	} else {
		if(!myIsData(f.DataNasc.value)){alert('Data de nascimento inválida.'); f.DataNasc.focus(); return false; }
	}
	if(isEmail(f.Email,'E-mail')==false){f.Email.focus();f.Email.select();return false;}
	
	if(f.RG.value==''){
		alert('Informe seu RG');f.RG.focus();f.RG.select();return false;
	} else { 
		if(f.RG.value.length<=5){alert('RG inválido');f.RG.focus();f.RG.select();return false;}
	}
	if(f.CEP.value==''){alert('Informe seu CEP residencial');f.CEP.focus();f.CEP.select();return false;}
	if(f.Cidade.value==''){alert('Informe a cidade onde reside');f.Cidade.focus();f.Cidade.select();return false;}
	if(f.Estado){if(f.Estado.value==''){alert('Informe o estado onde reside');f.Estado.focus();return false;}}

	return true;
}

var myIsData = function(value){
	ddMMaaaa = new RegExp("^[0-9]{2}/[0-9]{2}/[0-9]{4}$");
	return ddMMaaaa.test(value);
}


