	function Teste(){
		
		testando = document.getElementById('teste').style.top;
		
		alert(testando);	
		
	}



//FUNÇÕES DA HOME///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function ActiveAba()
  {
	//alert(document.getElementById('abaNovos').className);
	document.getElementById('abaNovos').className = "aba2";
  }

//window.onload = function ActiveAba();

function ActiveAbaVolta()
  {
	document.getElementById('abaNovos').className = "aba";
  }



function popup(Largura, Altura, Nome, Endereco){

	window.open(Endereco,Nome,'height='+Altura+',width='+Largura+'resizable=no,scrollbars=no,toolbar=no,location=no,status=no,directories=no');

}

function popupscroll(Largura, Altura, Nome, Endereco){

	window.open(Endereco,Nome,'height='+Altura+',width='+Largura+'resizable=no,scrollbars=yes,toolbar=no,location=no,status=no,directories=no');

}

//FUNÇÕES ABAS TOPO///////////////////////////////////////////////////////////////////////////////////////////////////////////////////


		function AbaLojas(){
	
		document.getElementById("oplojas").style.display = "block";
		document.getElementById("oplojas").style.left = "342px";
		
		document.getElementById("opnacionais").style.display = "none";
		document.getElementById("opmotos").style.display = "none";
		document.getElementById("opimportados").style.display = "none";
	}


		function AbaNacionais(){
	
		document.getElementById("opnacionais").style.display = "block";
		document.getElementById("opnacionais").style.left = "433px";
		
		document.getElementById("opimportados").style.display = "none";
		document.getElementById("opmotos").style.display = "none";
		document.getElementById("oplojas").style.display = "none";
		
	}
	
		function AbaImportados(){
	
		document.getElementById("opimportados").style.display = "block";
		document.getElementById("opimportados").style.left = "479px";
		
		document.getElementById("opnacionais").style.display = "none";
		document.getElementById("opmotos").style.display = "none";
		document.getElementById("oplojas").style.display = "none";
	}
	
		function AbaMotos(){
			

		document.getElementById("opmotos").style.display = "block";
		document.getElementById("opmotos").style.left = "515px";
		
		document.getElementById("opimportados").style.display = "none";
		document.getElementById("opnacionais").style.display = "none";
		document.getElementById("oplojas").style.display = "none";
	}
	
		function AbaSemiNovos(){
		
		document.getElementById("opmotos").style.display = "none";
		document.getElementById("opimportados").style.display = "none";
		document.getElementById("opnacionais").style.display = "none";
		document.getElementById("oplojas").style.display = "none";		
		
			
		window.location.replace('Seminovos.aspx');
		
	}
	
		function AbaBlindados(){
			
		document.getElementById("opmotos").style.display = "none";
		document.getElementById("opimportados").style.display = "none";
		document.getElementById("opnacionais").style.display = "none";
		document.getElementById("oplojas").style.display = "none";
		
		window.location.replace('Blindados.aspx');

	}


//HELP///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

		


    
	


//MINHA LISTA/////////////
function Maximizar(){
	
        if(document.getElementById("minimizar").innerHTML == "minimizar lista"){
			
				document.getElementById("minimizar").innerHTML = "maximizar lista";
			
			}
			
		else{
			
				document.getElementById("minimizar").innerHTML = "minimizar lista";
			
			}
		
	}
	
//SEMINOVOS/////////////

function Maximizar2(){
	
        if(document.getElementById("minimizar2").innerHTML == "minimizar seminovos"){
			
				document.getElementById("minimizar2").innerHTML = "maximizar seminovos";
			
			}
			
		else{
			
				document.getElementById("minimizar2").innerHTML = "minimizar seminovos";
			
			}
		
	}



// FUNÇÕES DA BUSCA ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function Financiamento(cod){

	document.getElementById("simular_1" + cod).style.display = "block";
	
	document.getElementById("avista" + cod).style.display = "none";
	document.getElementById("consorcio" + cod).style.display = "none";
	document.getElementById("usado" + cod).style.display = "none";
	document.getElementById("troco" + cod).style.display = "none";

}

function Avista(cod){

	document.getElementById("avista" + cod).style.display = "block";

	document.getElementById("simular_1" + cod).style.display = "none";
	document.getElementById("consorcio" + cod).style.display = "none";
	document.getElementById("usado" + cod).style.display = "none";
	document.getElementById("troco" + cod).style.display = "none";

}

function Consorcio(cod){

	document.getElementById("consorcio" + cod).style.display = "block";

	document.getElementById("avista" + cod).style.display = "none";
	document.getElementById("simular_1" + cod).style.display = "none";
	document.getElementById("usado" + cod).style.display = "none";
	document.getElementById("troco" + cod).style.display = "none";

}

function Usado(cod){
	
	document.getElementById("usado" + cod).style.display = "block";

	document.getElementById("avista" + cod).style.display = "none";
	document.getElementById("consorcio" + cod).style.display = "none";
	document.getElementById("simular_1" + cod).style.display = "none";
	document.getElementById("troco" + cod).style.display = "none";

}

function Troco(cod){
	
	document.getElementById("troco" + cod).style.display = "block";

	document.getElementById("avista" + cod).style.display = "none";
	document.getElementById("consorcio" + cod).style.display = "none";
	document.getElementById("usado" + cod).style.display = "none";
	document.getElementById("simular_1" + cod).style.display = "none";

}

/* simular_1 */


function Aparece(div){
	
		document.getElementById(div).style.display = "block";

}

function Desaparece(div){
	
		document.getElementById(div).style.display = "none";
}

function DesapareceItens(src)
{
	objs = src.split(",")
	for(i=0; i<objs.length; i++)
	{
		document.getElementById(objs[i]).style.display = "none";
	}
}

function ApareceItens(src)
{
	objs = src.split(",")
	for(i=0; i<objs.length; i++)
	{
		document.getElementById(objs[i]).style.display = "none";
	}
}


function ApareceDetalhe(codDiv){
	
		document.getElementById("normal" + codDiv).style.display = "none";
		document.getElementById("detalhe" + codDiv).style.display = "block";

}


function VoltaDetalhe(codDiv){
	
		document.getElementById("normal" + codDiv).style.display = "block";
		document.getElementById("detalhe" + codDiv).style.display = "none";

}

function DiplayLoja(obj){
	
	if(document.getElementById(obj).style.display == "none")
	{
	    document.getElementById(obj).style.display = "block";
	}
	else
	{
	    document.getElementById(obj).style.display = "none";
	}
		

}

function exibirBalaoSiga(obj, display) {
    document.getElementById(obj).style.display = display;
}

	
function exibirJanelaCriterio(criterio) {
            if (window.document.getElementById(criterio)) {
                if (window.document.getElementById(criterio).style.display == "none") {
                    window.document.getElementById(criterio).style.display = "block";
                }
                else {
                    window.document.getElementById(criterio).style.display = "none";
                }
                var h = window.document.getElementById(criterio).clientHeight;
            }
        }
    
        function VerificarChecksCompare() {
            var btnCompare;
            var btnCompareRodape;
            var nRgChkCmp = "chkCompare";
            var IDS_CHK = [];
            if (document.getElementsByTagName('input') != null) {
                var pgInput = document.getElementsByTagName('input');        
                var chcCount = 0;
                for (inp = 0; inp < pgInput.length; inp++) {
                    idPgInput = pgInput[inp].id.toString();
                    if (idPgInput.match(nRgChkCmp) && document.getElementById(idPgInput).checked == true) {++chcCount;}
                }

                for (inp = 0; inp < pgInput.length; inp++) {
                    idPgInput = pgInput[inp].id.toString();
                    if (chcCount>2) {
                        if (idPgInput.match(nRgChkCmp) && document.getElementById(idPgInput).checked == false) {
                            document.getElementById(idPgInput).disabled = true;
                        }
                    }
                    else {
                        if (idPgInput.match(nRgChkCmp)) {
                            document.getElementById(idPgInput).disabled = false;
                        }
                    }
                }  

                btnCompare = document.getElementById("ctl00_Meio_imgBtComparar");
                btnCompareRodape = document.getElementById("ctl00_Meio_imgBtCompararRodape")
                
                if (chcCount>1) { 
                    //DesabilitarBotaoComparar(false);                    
                    btnCompare.src = "Dealers/iNetCar/imagens/resultado-busca/btComparar.gif";
                    btnCompareRodape.src = "Dealers/iNetCar/imagens/resultado-busca/btCompararUp.gif";
                    btnCompare.title = "";                                        
                    btnCompareRodape.title = "";
                    btnCompare.disabled = false;                    
                    btnCompareRodape.disabled = false;
                } else {
                    //DesabilitarBotaoComparar(true); 
                    btnCompare.src = "Dealers/iNetCar/imagens/resultado-busca/btCompararOff.gif";
                    btnCompareRodape.src = "Dealers/iNetCar/imagens/resultado-busca/btCompararUpOff.gif";
                    btnCompare.title = "Selecione mais de um veículo para comparar";                                        
                    btnCompareRodape.title = "Selecione mais de um veículo para comparar";
                    btnCompare.disabled = true;
                    btnCompareRodape.disabled = true;
                }

                function DesabilitarBotaoComparar(acao) {
                    var ID_btCmp = [];
                    for (inp = 0; inp < document.getElementsByTagName('input').length; inp++) {               
                        idbtCmp = document.getElementsByTagName('input')[inp].id;
                        if (idbtCmp.match('imgBtComparar')) {
                            ID_btCmp.push(idbtCmp);
                        }
                    }

                    for (var iId = 0; iId < ID_btCmp.length; iId++) {
                        var nId = ID_btCmp[iId];

                        if (acao) {
                            document.getElementById(nId).disabled = true;
                        }
                        else {
                            document.getElementById(nId).disabled = false;
                        }
                    }
                 }            
             }
         }	

// Funcao usada no player do detalhes do veiculo
        function animarImagem(id) {
            var hidden = window.document.getElementById(id + "ctl00_Meio_hBtVerAvancarImagem");
            hidden.value = "-1";            
            avancarImagem(id);
        }
        
        function animarImagem2(id) {
            var hidden = window.document.getElementById("ctl00_Meio_hBtVerAvancarImagem");

            if (hidden.value == "") {
                hidden.value = "1";            
                avancarImagem2(id);
            }
            else { return; }
        }
        
        // Funcao usada no player do detalhes do veiculo
        function pausarImagem(id) {
            var hidden = window.document.getElementById("ctl00_Meio_hBtVerAvancarImagem");
            hidden.value = "";
        }

        function iniciarImagem(id) {
            setTimeout("avancarImagem('" + id + "');", 5);
        }

        // Funcao usada no player do detalhes do veiculo
        function avancarImagem(id) {
            var hidden = window.document.getElementById(id + "ctl00_Meio_hBtVerAvancarImagem");
            var imagem = window.document.getElementById(id + "ctl00_Meio_imgThumbGrande");
            var container = window.document.getElementById(id + "dvCarrosselCarros");

            //animação parada
            if (hidden.value == "") return;

            var imagens = container.getElementsByTagName("img");
            var total = imagens.length;
            if (total == 0) return;

            var atual = parseInt(hidden.value);
            atual++;
            if (atual == total) atual = 0;

            hidden.value = atual.toString();
            imagem.src = imagens[atual].src.toLowerCase().replace("w=60", "w=310");            
            setTimeout("avancarImagem('" + id + "');", 2500);
        }
        
        function avancarImagem2(id) {
            var hidden = window.document.getElementById("ctl00_Meio_hBtVerAvancarImagem");
            var animacao = window.document.getElementById("ctl00_Meio_hIndexAnimacaoImagens");
            var container = window.document.getElementById(id);

            //animação parada
            if (hidden.value == "") return;
            
            var imagens = container.getElementsByTagName("img");
            var ampliar = container.getElementsByTagName("span");
            var total = imagens.length;            
            var atual = -1;
            
            if (animacao.value == "") { 
                atual = -1; 
            }
            else {
                atual = parseInt(animacao.value.substring(animacao.value.length - 1, animacao.value.length));
            }
            atual++;
            if (atual == total) {
                atual = 0;
            }
            
            var imgAtual = "ctl00_Meio_imgDestaque" + atual;
            var ampliarAtual = "ctl00_Meio_divAmpliarImg" + atual;
            
            if (imagens.length > 0) {

                for (var i = 0; i < imagens.length; i++) {
                    if (imagens[i].style.display != "none") {
                        imagens[i].style.display = "none";
                    }
                }
                
                for (var i = 0; i < ampliar.length; i++) {
                    if (ampliar[i].style.display != "none") {
                        ampliar[i].style.display = "none";
                    }
                }
                
                exibirImagem(imgAtual, ampliarAtual);
            }
            else { return; }

            animacao.value = imgAtual.toString();
            setTimeout("avancarImagem2('" + id + "');", 2500);
        }
        
        function mostrarImagem(id, imgDestaque, ampliarImg) {

            var container = window.document.getElementById(id);
            var imagens = container.getElementsByTagName("img");
            var ampliar = container.getElementsByTagName("span");
            var animacao = window.document.getElementById("ctl00_Meio_hIndexAnimacaoImagens");
            animacao.value = imgDestaque;           
            
            if (imagens.length > 0) {

                for (var i = 0; i < imagens.length; i++) {
                    if (imagens[i].style.display != "none") {
                        imagens[i].style.display = "none";
                    }
                }
                
                for (var i = 0; i < ampliar.length; i++) {
                    if (ampliar[i].style.display != "none") {
                        ampliar[i].style.display = "none";
                    }
                }
                
                exibirImagem(imgDestaque, ampliarImg);
            }
        }
        
        function exibirImagem(img, ampliar) {
            var imgDestaque = window.document.getElementById(img);
            var ampliarImg = window.document.getElementById(ampliar);
            imgDestaque.style.display = "block";
            if (ampliarImg != null) {
                ampliarImg.style.display = "block";
            }
        }
        
        //Funcao usada no detalhes do veiculo
        function popTelefone(exibir) {

            var dvPopTelefone = window.document.getElementById("ctl00_Meio_dvPopTelefone");
            if (exibir) {
                dvPopTelefone.style.display = "inline";
            }
            else {
                dvPopTelefone.style.display = "none";
            }
        }
        
        //Funcao usada no detalhes do veiculo
        function popLocalizacao(exibir) {

            var dvPopLocalizacao = window.document.getElementById("ctl00_Meio_dvPopLocalizacao");
            if (exibir) {
                dvPopLocalizacao.style.display = "block";
            }
            else {
                dvPopLocalizacao.style.display = "none";
            }
        }

        function formataTelefone(campo, evt) {
            //(00) 0000-0000
            var xPos = PosicaoCursor(campo);
            evt = getEvent(evt);
            var tecla = getKeyCode(evt);
            if (!teclaValida(tecla))
                return;

            vr = campo.value = filtraNumeros(filtraCampo(campo));
            tam = vr.length;

            if (tam == 1)
                campo.value = '(' + vr;
            else if (tam >= 2 && tam < 6)
                campo.value = '(' + vr.substr(0, 2) + ') ' + vr.substr(2);
            else if (tam >= 6)
                campo.value = '(' + vr.substr(0, 2) + ') ' + vr.substr(2, 4) + '-' + vr.substr(6);

            MovimentaCursor(campo, xPos);
        }
            
        function mascFone(obj) {
            var chrDigito = String.fromCharCode(event.keyCode);
            if (isNaN(chrDigito) || chrDigito == " ") { return false; }

            var strTelefone = obj.value.replace("(", "").replace(")", "").replace("-", "").replace(" ", "");
            if (strTelefone.length == 10) { return false; }
            strTelefone = strTelefone + chrDigito;

            var ddd = "";
            var telefone = "";

            if (strTelefone.length > 2) {
                ddd = strTelefone.substring(0, 2);
                telefone = strTelefone.substring(2, strTelefone.length);

                if (telefone.length > 4) {
                    telefone = telefone.substring(0, 4) + "-" + telefone.substring(4, telefone.length);
                }
            }
            else {
                ddd = strTelefone;
            }

            obj.value = "(" + ddd + ") " + telefone;

            return false;
        }               	    

