// JavaScript Document

function muda(){
	document.getElementById("galeria1").style.display = "block";
	document.getElementById("galeria2").style.display = "none";
	document.getElementById("galeria-pachecos-esq").style.cursor = "default";
	document.getElementById("galeria-pachecos-dir").style.cursor = "pointer";
}

function muda2(){
	document.getElementById("galeria1").style.display = "none";
	document.getElementById("galeria2").style.display = "block";
	document.getElementById("galeria-pachecos-esq").style.cursor = "pointer";
	document.getElementById("galeria-pachecos-dir").style.cursor = "default";
}

//valida NewsLetter
function validaNews(){
    d = document.newsform;
	if (d.nome.value == "")
	{
		alert("Preencha o campo Nome!");
		d.nome.focus();
		return false;	
	}
        var str = d.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 Incorreto!")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Email Incorreto!")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		   alert("Email Incorreto!")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		   alert("Email Incorreto!")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		   alert("Email Incorreto!")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		   alert("Email Incorreto!")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		   alert("Email Incorreto!")
		    return false
		 }
	
	return true;
}

// JavaScript Document

function efeito(elemento){
	document.getElementById(elemento).style.background = "url(images/menu_h.jpg) no-repeat";
	document.getElementById(elemento + "-sub").style.display = "block";
}

function tiraEfeito(elemento){
	document.getElementById(elemento).style.background = "url(images/fundo_menu_d.jpg) no-repeat";	
	document.getElementById(elemento + "-sub").style.display = "none";
}

function alerta(){
	alert('Você não possui este sistema, entre em contato para contratá-lo!');
}

function validaFale(){

	d = document.contato;
	if (d.nome.value == "")
	{
		alert("Preencha o campo Nome!");
		d.nome.focus();
		return false;	
	}

   	if (d.ddd.value == "")
	{
		alert("Preencha o campo DDD!");
		d.ddd.focus();
		return false;	
	}

    
	if (d.telefone.value == "")
	{
		alert("Preencha o campo Telefone!");
		d.telefone.focus();
		return false;	
	}
    
        if (d.cidade.value == "")
	{
		alert("Preencha o campo Cidade!");
		d.cidade.focus();
		return false;	
	}

    
    	if (d.estado.value == "")
	{
		alert("Preencha o campo Estado!");
		d.estado.focus();
		return false;	
	}
	
	
		var str = d.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 Inválido!")
       	   d.email.focus();
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Email Inválido!")
       	   d.email.focus();
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		   alert("Email Inválido!")
       	   d.email.focus();
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		   alert("Email Inválido!")
       	   d.email.focus();
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		   alert("Email Inválido!")
       	   d.email.focus();
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		   alert("Email Inválido!")
       	   d.email.focus();
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		   alert("Email Inválido!")
       	   d.email.focus();
		    return false
		 }
		 

	if (d.mensagem.value == "")
	{
		alert("Preencha o campo Mensagem!");
		d.mensagem.focus();
		return false;	
	}

	else
		return true;
	
}

function selecione(){
    if (document.getElementById("evento").style.display == "none")
        document.getElementById("evento").style.display="block";
    else
        document.getElementById("evento").style.display="none";
}
