function valida(theform){
if(theform.nome.value == "") {
	alert("Digite o seu nome.");
	theform.nome.focus();
	return false;
}
if(theform.sobrenome.value == "") {
	alert("Digite o seu sobrenome.");
	theform.sobrenome.focus();
	return false;
}
if (theform.email.value.indexOf("@") == -1 || theform.email.value.indexOf(".") == -1 || theform.email.value.indexOf(" ") != -1) {
	alert("Desculpe, mas \"" + theform.email.value + "\" não é um e-mail válido!");
	theform.email.focus();
	return false ;
}
if(theform.senha.value == "") {
	alert("Atenção! Digite a sua senha.");
	theform.senha.focus();
	return false;
}
plength = theform.senha.value;
if(plength.length < 5) {
	alert("Atenção! A senha deve ter no mínimo 5 caracteres.");
	theform.senha.focus();
	return false;
}
if(theform.senha.value != theform.confirmasenha.value) {
	alert("Atenção! Confirme a senha corretamente.")
	theform.confirmasenha.focus();
	return false;
}
if(theform.ddd.value == "" && theform.fone.value != "") {
	alert("Digite o seu DDD.");
	theform.ddd.focus();
	return false;
}
if(theform.ddd.value == "" && theform.celular.value != "") {
	alert("Digite o seu DDD.");
	theform.ddd.focus();
	return false;
}
if(theform.cell.checked && (theform.ddd.value == "" || theform.celular.value == "") ) {
	alert("Para receber informações em seu celular,\ndigite o seu ddd e seu número do celular.");
	theform.celular.focus();
	return false;
}

//PARTE 2

if(theform.cep.value == "") {
	alert("Digite o cep do seu endereço.");
	theform.cep.focus();
	return false;
}
if(theform.endereco.value == "") {
	alert("Digite o seu endereço.");
	theform.endereco.focus();
	return false;
}
if(theform.bairro.value == "") {
	alert("Digite o bairro do seu endereço.");
	theform.bairro.focus();
	return false;
}
if(theform.cidade.value == "") {
	alert("Digite a cidade do seu endereço.");
	theform.cidade.focus();
	return false;
}
uf = theform.estado.selectedIndex;
if(theform.estado[uf].value == ""){
	alert("Selecione o estado do seu endereço.");
	return false;
}

return true;
}



