// JavaScript Document

function limpaEmail(e){
	if(e.value == "Digite seu e-mail...")
		e.value = "";
}
function retornaEmail(e){
	if(e.value == "")
		e.value = "Digite seu e-mail...";
}
function limpaNome(e){
	if(e.value == "Digite seu nome...")
		e.value = "";
}
function retornaNome(e){
	if(e.value == "")
		e.value = "Digite seu nome...";
}

document.onclick = evento;

function evento(e){
	var target = (e && e.target) || (event && event.srcElement);
	var obj = document.getElementById('area-restrita');
	var obj2 = document.getElementById('clica-area-restrita');
	
	if(target!=obj && target!=obj2)
		document.getElementById('area-restrita-hidden').value = '1';
		
	checkParent(target)?obj.style.display='none':document.getElementById('area-restrita-hidden').value = '0';	
	
	if(document.getElementById('area-restrita-hidden').value == '0'){
		target==obj2?obj.style.display='block':null;
		document.getElementById('area-restrita-hidden').value = '1';
		document.getElementById('img-area').style.background='url(images/seta2.jpg) no-repeat';
	}else{
		if(document.getElementById('area-restrita-hidden').value == '1'){
			target==obj2?obj.style.display='none':null;
			document.getElementById('area-restrita-hidden').value = '0';
			document.getElementById('img-area').style.background='url(images/seta.jpg) no-repeat';
		}
	}
}

function checkParent(t){
	while(t.parentNode){
		if(t==document.getElementById('area-restrita')){
			return false;
		}
		t=t.parentNode
	}
	return true;
		
}

function testeMensagem(){
    alert("testeMensagem");
}

function topMenuHover(elemento){
    elemento.style.background='url(../images/1b.png) no-repeat';
}

function topMenuOut(elemento){
    elemento.style.background='url(../images/1a.png) no-repeat';
}

function meioMenuHover(elemento){
    elemento.style.background='url(../images/2b.jpg) no-repeat';
}

function meioMenuOut(elemento){
    elemento.style.background='url(../images/2a.jpg) no-repeat';
}

function botMenuHover(elemento){
    elemento.style.background='url(../images/3b.png) no-repeat';
}

function botMenuOut(elemento){
    elemento.style.background='url(../images/3a.png) no-repeat';
}

//funcoes clientes

function img1(elemento){
    elemento.style.background='url(../images/marcas/1b.jpg) no-repeat';
    Tip('Criacao de site com painel de Noticias. Publicidade SEO no Google.');
}

function img1Out(elemento){    
    elemento.style.background='url(../images/marcas/1a.jpg) no-repeat';
    UnTip();
}

function img2(elemento){
    elemento.style.background='url(../images/marcas/2b.jpg) no-repeat';
}

function img2Out(elemento){    
    elemento.style.background='url(../images/marcas/2a.jpg) no-repeat';
    UnTip();
}

function img3(elemento){
    elemento.style.background='url(../images/marcas/3b.jpg) no-repeat';
}

function img3Out(elemento){    
    elemento.style.background='url(../images/marcas/3a.jpg) no-repeat';
    UnTip();
}

function img4(elemento){
    elemento.style.background='url(../images/marcas/4b.jpg) no-repeat';
}

function img4Out(elemento){    
    elemento.style.background='url(../images/marcas/4a.jpg) no-repeat';
    UnTip();
}

function img5(elemento){
    elemento.style.background='url(../images/marcas/5b.jpg) no-repeat';
}

function img5Out(elemento){    
    elemento.style.background='url(../images/marcas/5a.jpg) no-repeat';
    UnTip();
}

function img6(elemento){
    elemento.style.background='url(../images/marcas/6b.jpg) no-repeat';
}

function img6Out(elemento){    
    elemento.style.background='url(../images/marcas/6a.jpg) no-repeat';
    UnTip();
}

function img7(elemento){
    elemento.style.background='url(../images/marcas/7b.jpg) no-repeat';
}

function img7Out(elemento){    
    elemento.style.background='url(../images/marcas/7a.jpg) no-repeat';
    UnTip();
}

function img8(elemento){
    elemento.style.background='url(../images/marcas/8b.jpg) no-repeat';
}

function img8Out(elemento){    
    elemento.style.background='url(../images/marcas/8a.jpg) no-repeat';
    UnTip();
}

function img9(elemento){
    elemento.style.background='url(../images/marcas/9b.jpg) no-repeat';
}

function img9Out(elemento){    
    elemento.style.background='url(../images/marcas/9a.jpg) no-repeat';
    UnTip();
}

function img10(elemento){
    elemento.style.background='url(../images/marcas/10b.jpg) no-repeat';
}

function img10Out(elemento){    
    elemento.style.background='url(../images/marcas/10a.jpg) no-repeat';
    UnTip();
}

function img11(elemento){
    elemento.style.background='url(../images/marcas/11b.jpg) no-repeat';
}

function img11Out(elemento){    
    elemento.style.background='url(../images/marcas/11a.jpg) no-repeat';
    UnTip();
}

function img12(elemento){
    elemento.style.background='url(../images/marcas/12b.jpg) no-repeat';
}

function img12Out(elemento){    
    elemento.style.background='url(../images/marcas/12a.jpg) no-repeat';
    UnTip();
}

function img13(elemento){
    elemento.style.background='url(../images/marcas/13b.jpg) no-repeat';
}

function img13Out(elemento){    
    elemento.style.background='url(../images/marcas/13a.jpg) no-repeat';
    UnTip();
}
function img14(elemento){
    elemento.style.background='url(../images/marcas/14b.jpg) no-repeat';
}

function img14Out(elemento){    
    elemento.style.background='url(../images/marcas/14a.jpg) no-repeat';
    UnTip();
}

function img15(elemento){
    elemento.style.background='url(../images/marcas/15b.jpg) no-repeat';
}

function img15Out(elemento){    
    elemento.style.background='url(../images/marcas/15a.jpg) no-repeat';
    UnTip();
}

function img16(elemento){
    elemento.style.background='url(../images/marcas/16b.jpg) no-repeat';
}

function img16Out(elemento){    
    elemento.style.background='url(../images/marcas/16a.jpg) no-repeat';
    UnTip();
}

function img17(elemento){
    elemento.style.background='url(../images/marcas/17b.jpg) no-repeat';
}

function img17Out(elemento){    
    elemento.style.background='url(../images/marcas/17a.jpg) no-repeat';
    UnTip();
}

function img18(elemento){
    elemento.style.background='url(../images/marcas/18b.jpg) no-repeat';
}

function img18Out(elemento){    
    elemento.style.background='url(../images/marcas/18a.jpg) no-repeat';
    UnTip();
}

function img19(elemento){
    elemento.style.background='url(../images/marcas/19b.jpg) no-repeat';
}

function img19Out(elemento){    
    elemento.style.background='url(../images/marcas/19a.jpg) no-repeat';
    UnTip();
}
function img20(elemento){
    elemento.style.background='url(../images/marcas/20b.jpg) no-repeat';
}

function img20Out(elemento){    
    elemento.style.background='url(../images/marcas/20a.jpg) no-repeat';
    UnTip();
}

function img21(elemento){
    elemento.style.background='url(../images/marcas/21b.jpg) no-repeat';
}

function img21Out(elemento){    
    elemento.style.background='url(../images/marcas/21a.jpg) no-repeat';
    UnTip();
}

function img22(elemento){
    elemento.style.background='url(../images/marcas/22b.jpg) no-repeat';
}

function img22Out(elemento){    
    elemento.style.background='url(../images/marcas/22a.jpg) no-repeat';
    UnTip();
}

function img23(elemento){
    elemento.style.background='url(../images/marcas/23b.jpg) no-repeat';
}

function img23Out(elemento){    
    elemento.style.background='url(../images/marcas/23a.jpg) no-repeat';
    UnTip();
}

function img24(elemento){
    elemento.style.background='url(../images/marcas/24b.jpg) no-repeat';
}

function img24Out(elemento){    
    elemento.style.background='url(../images/marcas/24a.jpg) no-repeat';
    UnTip();
}

function img25(elemento){
    elemento.style.background='url(../images/marcas/25b.jpg) no-repeat';
}

function img25Out(elemento){    
    elemento.style.background='url(../images/marcas/25a.jpg) no-repeat';
    UnTip();
}

function img26(elemento){
    elemento.style.background='url(../images/marcas/26b.jpg) no-repeat';
}

function img26Out(elemento){    
    elemento.style.background='url(../images/marcas/26a.jpg) no-repeat';
    UnTip();
}

function img27(elemento){
    elemento.style.background='url(../images/marcas/27b.jpg) no-repeat';
}

function img27Out(elemento){    
    elemento.style.background='url(../images/marcas/27a.jpg) no-repeat';
    UnTip();
}

function img28(elemento){
    elemento.style.background='url(../images/marcas/28b.jpg) no-repeat';
}

function img28Out(elemento){    
    elemento.style.background='url(../images/marcas/28a.jpg) no-repeat';
    UnTip();
}

function img29(elemento){
    elemento.style.background='url(../images/marcas/29b.jpg) no-repeat';
}

function img29Out(elemento){    
    elemento.style.background='url(../images/marcas/29a.jpg) no-repeat';
    UnTip();
}

function img30(elemento){
    elemento.style.background='url(../images/marcas/30b.jpg) no-repeat';
}

function img30Out(elemento){    
    elemento.style.background='url(../images/marcas/30a.jpg) no-repeat';
    UnTip();
}



//links dos clientes

function linksCliente(numero){    
    if(numero == '1')
        window.open("http://www.qual9.com.br", "_blank");
    
    if(numero == '2')
        window.open("http://www.qual9.com.br", "_blank");    
    
    if(numero == '3')
        window.open("http://www.qual9.com.br", "_blank");
    
    if(numero == '4')
        window.open("http://www.qual9.com.br", "_blank");    

    if(numero == '5')
        window.open("http://www.qual9.com.br", "_blank");
    
    if(numero == '6')
        window.open("http://www.qual9.com.br", "_blank");    

    if(numero == '7')
        window.open("http://www.qual9.com.br", "_blank");
    
    if(numero == '8')
        window.open("http://www.qual9.com.br", "_blank");    

    if(numero == '9')
        window.open("http://www.qual9.com.br", "_blank");
    
    if(numero == '10')
        window.open("http://www.qual9.com.br", "_blank");    

    if(numero == '11')
        window.open("http://www.qual9.com.br", "_blank");
    
    if(numero == '12')
        window.open("http://www.qual9.com.br", "_blank");    
}

function tooltipClientes(elemento){
    config. Width = 150;
    if(elemento == "ideias")
        Tip('Peça realizada para mostrar o poder das ideias da agência com divulgação em revistas.');
    if(elemento == "tabaco")
        Tip('Campanha de incentivo ao dia Mundial sem Tabaco.');
    if(elemento == "novas")
        Tip('Ação desenvolvida para uma rodada de negócios para apresentar o novo portfólio da agência.');
        
    if(elemento == "TeR")
        Tip('Anúncio de primeiro aniversário da T&R.');
    if(elemento == "pachecos")
        Tip('Anúncio para a divulgação das noites no Pachecos Restaurante.');
    if(elemento == "extravagance")
        Tip('Outdoor desenvolvido para a divulgação da nova loja Extravagance.');
        
    if(elemento == "edra")
        Tip('Site desenvolvido para Edra Automotores.');
    if(elemento == "pachecossite")
        Tip('Site desenvolvido para o restaurante Pachecos.');
    if(elemento == "fattos")
        Tip('Site desenvolvido para a empresa Fattos Eventos.');
}

function tooltipClientesOut(){    
    UnTip();
}

function overCases(elemento)
{
    document.getElementById("case-esq-" + elemento).style.background = "#efe4cc";
    document.getElementById("case-meio-" + elemento).style.background = "#f5ecd9";
    document.getElementById("case-dir-" + elemento).style.background = "#f5ecd9";
}

function outCases(elemento)
{
    document.getElementById("case-esq-" + elemento).style.background = "#f7f0df";
    document.getElementById("case-meio-" + elemento).style.background = "#fefaf2";
    document.getElementById("case-dir-" + elemento).style.background = "#fefaf2";
}

function linkCase(elemento){
    if(elemento == '1')
        window.open("../case_alicel/","_parent");

    if(elemento == '2')
        window.open("../case_rc_fones/","_parent");

    if(elemento == '3')
        window.open("../case_ter_shopping_animal/","_parent");

}

function validaFaleConosco(){
	d = document.faleconosco;
	if(d.btnNome.value == ""){
		alert("Informe o Nome!");
		return false;
	}
	if(d.btnDDD.value == ""){
		alert("Informe o DDD!");
		return false;
	}
	if(d.btnTelefone.value == ""){
		alert("Informe o Telefone!");
		return false;
	}
    if (d.btnEmail.value == "") {
		alert ("Informe o Email!");
		d.btnEmail.focus();
		return false;
	}
	    parte1 = d.btnEmail.value.indexOf("@");
        parte2 = d.btnEmail.value.indexOf(".");
        parte3 = d.btnEmail.value.length;
         if (!(parte1 >= 3 && parte2 >= 2 && parte3 >= 9)) {
                  alert ("Formato de email incorreto!");
                  d.btnEmail.focus();
                   return false;
	}

	if(d.txtMensagem.value == ""){
		alert("Informe a Mensagem!");
		return false;
	}


}

function simCheck()
{
    document.getElementById("qual").style.display = "block";
    document.getElementById("conteudo-int").style.height = "1060px";
    document.getElementById("conteudo-interno-meio").style.height = "890px";
}

function naoCheck()
{
    document.getElementById("qual").style.display = "none";
    document.getElementById("conteudo-int").style.height = "auto";
    document.getElementById("conteudo-interno-meio").style.height = "auto";
}


function validaTrabalheConosco(){
	d = document.trabalheconosco;
	if(d.nome.value == ""){
		alert("Informe o Nome!");
		return false;
	}
    if (d.email.value == "") {
		alert ("Informe o Email!");
		d.email.focus();
		return false;
	}
	    parte1 = d.email.value.indexOf("@");
        parte2 = d.email.value.indexOf(".");
        parte3 = d.email.value.length;
         if (!(parte1 >= 3 && parte2 >= 2 && parte3 >= 9)) {
                  alert ("Formato de email incorreto!");
                  d.email.focus();
                   return false;
	}
	
	if(d.ddd.value == ""){
		alert("Informe o DDD!");
		return false;
	}
	if(d.telefone.value == ""){
		alert("Informe o Telefone!");
		return false;
	}
	if(d.area_interesse.value == ""){
		alert("Informe a Area de interesse!");
		return false;
	}
	if(d.area_atuacao.value == ""){
		alert("Informe a Area de atuacao!");
		return false;
	}	
	
	if(d.sim.checked == true)
    {
    	if(d.qual_agencia.value == ""){
		    alert("Informe Qual?");
		    return false;
	    }
    	if(d.clientes_atendidos.value == ""){
		    alert("Informe clientes atendidos!");
		    return false;
	    }
    	if(d.trabalhos_publicados.value == ""){
		    alert("Informe Links de trabalhos publicados!");
		    return false;
	    }
    	if(d.alguem_falar_trabalhos.value == ""){
		    alert("Informe o Alguem para falar de seus trabalhos!");
		    return false;
	    }
    }
	
	if(d.mensagem.value == ""){
		alert("Informe a Mensagem!");
		return false;
	}


}

function emailContato(){

 		var str = document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").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!")
		   document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").value = ""
		   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!")
		   document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").value = ""
		   return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		   alert("Email Invalido!")
		   document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").value = ""
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		   alert("Email Invalido!")
		   document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").value = ""
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		   alert("Email Invalido!")
		   document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").value = ""
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		   alert("Email Invalido!")
		   document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").value = ""
		    return false
		 }
        
 		 return true					
}

function limpaBusca(e){
	if(e.value == "Pesquisar...")
		e.value = "";
}

function retornaBusca(e){
	if(e.value == "")
		e.value = "Pesquisar...";
}

function validaOrcamento(e){

    if(e.value == "")
        e.style.background = "url(../images/input_orcamento_focus.jpg) no-repeat";
    else
        e.style.background = "url(../images/input_orcamento.jpg) no-repeat";
}

function validaDDD(e){

    if(e.value == "")
        e.style.background = "url(../images/input_ddd_focus.jpg) no-repeat";
    else
        e.style.background = "url(../images/input_ddd.jpg) no-repeat";
}

function validaTel(e){

    if(e.value == "")
        e.style.background = "url(../images/input_tel_focus.jpg) no-repeat";
    else
        e.style.background = "url(../images/input_tel.jpg) no-repeat";
}

