// Valida formulário de fale conosco
function ValidaFale() {
	if (document.fale.nome.value=="") {
		window.alert("Por favor, preencha o campo nome!");
		document.fale.nome.focus();
		return false;
	}
	if (document.fale.email.value=="") {
		window.alert("Por favor, preencha o campo e-mail!");
		document.fale.email.focus();
		return false;
	}
	if (document.fale.email.value.indexOf("@") == -1 || document.fale.email.value.indexOf(".") == -1) {
		window.alert("O e-mail digitado � invalido");
		document.fale.email.focus();
		return false;
	}
	if (document.fale.comentarios.value=="") {
		window.alert("Por favor, preencha o campo comentarios!");
		document.fale.comentarios.focus();
		return false;
	}
}

function ValidaCadastro() {
	if (document.cadastro.z_dado_nome.value=="") {
		window.alert("Por favor, preencha o campo nome!");
		document.cadastro.z_dado_nome.focus();
		return false;
	}
	if (document.cadastro.z_dado_email.value=="") {
		window.alert("Por favor, preencha o campo e-mail!");
		document.cadastro.z_dado_email.focus();
		return false;
	}
	if (document.cadastro.z_dado_email.value.indexOf("@") == -1 || document.cadastro.z_dado_email.value.indexOf(".") == -1) {
		window.alert("O e-mail digitado é invalido");
		document.cadastro.z_dado_email.focus();
		return false;
	}
	if (document.cadastro.z_dado_aniversario.value=="") {
		window.alert("Por favor, preencha o campo data de nascimento!");
		document.cadastro.z_dado_aniversario.focus();
		return false;
	}
	if (document.cadastro.z_dado_sexo.value=="") {
		window.alert("Por favor, preencha o campo sexo!");
		document.cadastro.z_dado_sexo.focus();
		return false;
	}    
}

function ValidaAniversario() {
	if (document.aniversario.nome.value=="") {
		window.alert("Por favor, preencha o campo nome!");
		document.aniversario.nome.focus();
		return false;
	}
	if (document.aniversario.email.value=="") {
		window.alert("Por favor, preencha o campo e-mail!");
		document.aniversario.email.focus();
		return false;
	}
	if (document.aniversario.email.value.indexOf("@") == -1 || document.aniversario.email.value.indexOf(".") == -1) {
		window.alert("O e-mail digitado é invalido");
		document.aniversario.email.focus();
		return false;
	}
	if (document.aniversario.telefone.value=="") {
		window.alert("Por favor, preencha o campo telefone!");
		document.aniversario.telefone.focus();
		return false;
	}
	if (document.aniversario.data.value=="") {
		window.alert("Por favor, preencha o campo data da festa!");
		document.aniversario.data.focus();
		return false;
	} 
	if (document.aniversario.acompanhante.value=="") {
		window.alert("Por favor, preencha o campo acompanhante!");
		document.aniversario.acompanhante.focus();
		return false;
	}    
	if (document.aniversario.convidados.value=="") {
		window.alert("Por favor, preencha o campo convidados!");
		document.aniversario.convidados.focus();
		return false;
	}               
}

function AjustarTelefone(evento,Objeto)
{
	var keypress=(window.event)?event.keyCode:evento.which;
	if ((keypress!=13)&&(keypress!=8)&&(keypress!=0)&&((keypress < 48) || (keypress > 57)))
	{
		if (Objeto.value.indexOf("-") == -1)
	  {
      if ((keypress = 45) && ((Objeto.value.length == 9) || (Objeto.value.length == 8)))
      {
        Objeto.value = Objeto.value + "-";
      }
	  }
		(window.event)?event.returnValue = false:evento.preventDefault();
	} 
	else 
	{	 	  
		if (Objeto.value.length == 0)
		{
			Objeto.value = "(" + Objeto.value;
		}
		else if ((Objeto.value.length == 1) && (Objeto.value.indexOf("(") == -1))
		{
		  Objeto.value = "(" + Objeto.value;
		}
		else if (Objeto.value.length == 3)
		{
			Objeto.value = Objeto.value + ") ";
		}				
		else if (Objeto.value.length == 4)
		{
			Objeto.value = Objeto.value + " ";
		}
		else if ((Objeto.value.length == 9) && (Objeto.value.indexOf("-") == -1))
    {
      Objeto.value = Objeto.value + "-";
    }
    else if ((keypress!=13)&&(keypress!=8)&&(keypress!=0)&&(Objeto.value.length == 13) && (Objeto.value.indexOf("-") == 8))
		{
		  (window.event)?event.returnValue = false:evento.preventDefault();
		}
		else if ((Objeto.value.length == 14)&&(keypress!=13))
		{
		  (window.event)?event.returnValue = false:evento.preventDefault();
		}
	}
}

function AjustarData(evento,Objeto) 
{
	var keypress=(window.event)?event.keyCode:evento.which;
	if ((keypress!=13)&&(keypress!=8)&&(keypress!=0)&&((keypress < 48) || (keypress > 57))) 
	{
		(window.event)?event.returnValue = false:evento.preventDefault(); 
	}
	else 
	{
		if ((Objeto.value.length == 2) || (Objeto.value.length == 5))
		{
			Objeto.value = Objeto.value + "/";
		}
		else if ((Objeto.value.length == 10)&&(keypress!=13))
		{
		  (window.event)?event.returnValue = false:evento.preventDefault();
		}
	}
}



