function validaMail(idmail){
	var emailva,emailar, emailpt, emailln;
	emailva = document.getElementById(idmail).value
	with(document.contato){
		emailar = emailva.indexOf('@',0);
		emailpt = emailva.indexOf('.',emailar);
		emailln = emailva.length;
		if(emailva == ""){
			document.getElementById(idmail).focus();
			document.getElementById(idmail).value = "";
			/*alert('O Campo e-mail deve ser preenchido !');*/
			return false;
		}
		if((emailln<12) || (emailar==-1) || (emailpt==-1) || (emailar<1) || (emailpt-emailar<2) || (emailln-emailpt<3)){
			document.getElementById(idmail).focus();
			document.getElementById(idmail).value = "";
			/*alert('E-mail invalido !');*/
			return false;
		}
		if (emailva.split('@').length > 2){
			document.getElementById(idmail).focus();
			document.getElementById(idmail).value = "";
			/*alert('E-mail invalido !');*/
			return false;
		}
		return true;
	}
}
function ValidaContato()
{
	var msg = "";
	if (document.getElementById('mensagem').value == ""){
		msg+= 'Digite corretamente sua mensagem\n';
		document.getElementById('mensagem').focus();
	}
	if (!validaMail('email')){
		msg+= 'Digite um e-mail valido !\n';
		document.getElementById('email').focus();
	}
	if (document.getElementById('nome').value == ""){
		msg+= 'Digite corretamente seu nome\n';
		document.getElementById('nome').focus();
	}
	if(msg != ""){
		alert(msg);
		return false;
	}
	return true;
}
function ValidaIndicacao()
{
	var msg = "";
	if (!validaMail('email')){
		msg+= 'Digite um e-mail valido !\n';
		document.getElementById('email').focus();
	}
	if (document.getElementById('nome').value == ""){
		msg+= 'Digite corretamente o nome da pessoa indicada \n';
		document.getElementById('nome').focus();
	}
	if (document.getElementById('nome_indicacao').value == ""){
		msg+= 'Digite corretamente seu nome\n';
		document.getElementById('nome_indicacao').focus();
	}
	if(msg != ""){
		alert(msg);
		return false;
	}
	return true;
}
