// JavaScript Document
function limpaNome(){
	if(document.getElementById("nome").value == "Digite seu nome...")
		document.getElementById("nome").value = "";
}

function retornaNome(){
	if(document.getElementById("nome").value == "")
		document.getElementById("nome").value = "Digite seu nome...";
}

function limpaEmail(){
	if(document.getElementById("email").value == "Digite seu e-mail...")
		document.getElementById("email").value = "";
}

function retornaEmail(){
	if(document.getElementById("email").value == "")
		document.getElementById("email").value = "Digite seu e-mail...";
}

function validaNews(){
	if(document.getElementById("nome").value == "" || document.getElementById("nome").value == "Digite seu nome...")
		alert("Preencha o campo nome!");
	else
	{
	if(document.getElementById("email").value == "" || document.getElementById("email").value == "Digite seu e-mail...")
		alert("Preencha o campo email!");
		else
	return true;
	}
	return false;
}

/* Validador email: */

function echeck() {

 		var str = document.getElementById("email").value;
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		
		if (str.indexOf(at)==-1){
		   alert("Email Invalido!")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Email Invalido!")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		   alert("Email Invalido!")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		   alert("Email Invalido!")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		   alert("Email Invalido!")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		   alert("Email Invalido!")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		   alert("Email Invalido!")
		    return false
		 }

 		 return true					
}


function validaConfiramacao(){
	d = document.confirmacao;
	if (d.nome.value == "")
	{
		alert("Preencha o campo Nome!");
		d.nome.focus();
		return false;	
	}
	
	if (d.data.value == "")
	{
		alert("Preencha o campo Data!");
		d.data.focus();
		return false;	
	}
	
	if (d.convite.value == "")
	{
		alert("Preencha o campo Nome que consta no convite!");
		d.convite.focus();
		return false;	
	}
	
	if (d.ddd.value == "")
	{
		alert("Preencha o campo DDD!");
		d.ddd.focus();
		return false;	
	}
		if (d.tel.value == "")
	{
		alert("Preencha o campo Telefone!");
		d.tel.focus();
		return false;	
	}
	
	if (d.adultos.value == "")
	{
		alert("Preencha o campo Nomes dos Adultos!");
		d.adultos.focus();
		return false;	
	}
	
		var str = d.e_mail.value;
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		
		if (str.indexOf(at)==-1){
		   alert("Email Inválido!")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Email Inválido!")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		   alert("Email Inválido!")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		   alert("Email Inválido!")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		   alert("Email Inválido!")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		   alert("Email Inválido!")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		   alert("Email Inválido!")
		    return false
		 }
		 	 
		return true;
	
}


function validaContato(){
	d = document.contato;
	if (d.nome.value == "")
	{
		alert("Preencha o campo Nome/Empresa!");
		d.nome.focus();
		return false;	
	}
	
	if (d.contato.value == "")
	{
		alert("Preencha o campo Nome para Contato!");
		d.contato.focus();
		return false;	
	}
	
	if (d.mensagem.value == "")
	{
		alert("Preencha o campo Mensagem!");
		d.mensagem.focus();
		return false;	
	}
	
		var str = d.email_contato.value;
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		
		if (str.indexOf(at)==-1){
		   alert("Email Inválido!")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Email Inválido!")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		   alert("Email Inválido!")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		   alert("Email Inválido!")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		   alert("Email Inválido!")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		   alert("Email Inválido!")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		   alert("Email Inválido!")
		    return false
		 }
		 	 
		return true;
	
}

function abreMeses(elemento){
    if (document.getElementById(elemento).style.display == "none") 
        document.getElementById(elemento).style.display = "block";
        
    else
        document.getElementById(elemento).style.display = "none";
  }

function abreArquivos(elemento){
    if (document.getElementById(elemento).style.display == "none")
     
        document.getElementById(elemento).style.display="block";
     
      else
      
     {
        document.getElementById(elemento).style.display="none";
      }
		 
}

function selecione(){
    if (document.getElementById("eventos2").style.display == "none")
        document.getElementById("eventos2").style.display="block";
    else
        document.getElementById("eventos2").style.display="none";
}


