function valida(){
	
	if ( document.theForm.nome.value == "" ) {
		alert("Por favor, preencher o campo 'Nome'.");
		document.theForm.nome.focus();
		return false;
	}
	
	if (document.theForm.mail.value == "" ) {
		alert("Por favor preencher o campo 'E-mail'.");
		document.theForm.mail.focus();
		return false;
	
	}else{
	
		if ( document.theForm.mail.value.indexOf("@") == -1 || document.theForm.mail.value.indexOf(".") == -1 ) {
			alert("Por favor preencher corretamente o campo 'E-mail'.");
			document.theForm.mail.focus();
			return false;
		}   
		if ( document.theForm.mens.value == "" ) {
			alert("Por favor, preencher o campo 'Mensagem'.");
			document.theForm.mens.focus();
			return false;
		} 
	}
   
	return true;
}

function valida_amigo(){
	
	if ( document.theForm.nome.value == "" ) {
		alert("Por favor, preencher o campo 'Nome'.");
		document.theForm.nome.focus();
		return false;
	}
	
	if (document.theForm.mail.value == "" ) {
		alert("Por favor preencher o campo 'E-mail'.");
		document.theForm.mail.focus();
		return false;
	
	}else{
	
		if ( document.theForm.mail.value.indexOf("@") == -1 || document.theForm.mail.value.indexOf(".") == -1 ) {
			alert("Por favor preencher corretamente o campo 'E-mail'.");
			document.theForm.mail.focus();
			return false;
		} 
		
		if ( document.theForm.nome_amigo.value == "" ) {
			alert("Por favor, preencher o campo 'Nome do amigo(a)'.");
			document.theForm.nome_amigo.focus();
			return false;
		}
		
		if (document.theForm.mail_amigo.value == "" ) {
			alert("Por favor preencher o campo 'E-mail do amigo(a)'.");
			document.theForm.mail_amigo.focus();
			return false;
		
		}
		else
		{
			if ( document.theForm.mail_amigo.value.indexOf("@") == -1 || document.theForm.mail_amigo.value.indexOf(".") == -1 ) {
				alert("Por favor preencher corretamente o campo 'E-mail do amigo(a)'.");
				document.theForm.mail_amigo.focus();
				return false;
			} 
		}
	}
   
	return true;
}



function valida_cadastro(){
	
	if ( document.theForm.nome.value == "" ) {
		alert("Por favor, preencher o campo 'Nome'.");
		document.theForm.nome.focus();
		return false;
	}
	
	if (document.theForm.mail.value == "" ) {
		alert("Por favor preencher o campo 'E-mail'.");
		document.theForm.mail.focus();
		return false;
	
	}else{
	
		if ( document.theForm.mail.value.indexOf("@") == -1 || document.theForm.mail.value.indexOf(".") == -1 ) {
			alert("Por favor preencher corretamente o campo 'E-mail'.");
			document.theForm.mail.focus();
			return false;
		} 
		
		if ( document.theForm.dianasc.value == "--" ) {
			alert("Por favor, preencher corretamente o campo 'Data de nascimento'.");
			document.theForm.dianasc.focus();
			return false;
		}
		
		if ( document.theForm.mesnasc.value == "---" ) {
			alert("Por favor, preencher corretamente o campo 'Data de nascimento'.");
			document.theForm.mesnasc.focus();
			return false;
		}
		
		if ( document.theForm.anonasc.value == "----" ) {
			alert("Por favor, preencher corretamente o campo 'Data de nascimento'.");
			document.theForm.anonasc.focus();
			return false;
		}
		
		if ( document.theForm.endereco.value == "" ) {
			alert("Por favor, preencher o campo 'Endereço'.");
			document.theForm.endereco.focus();
			return false;
		}
		
	}
   
	return true;
}

