// JavaScript Document

function testaversao() {
  http_request = false;
  if (window.ActiveXObject) { // IE 
    try {    
      http_request = new ActiveXObject("Msxml2.XMLHTTP");} 
    catch (e) { 
      try {    
        http_request = new ActiveXObject("Microsoft.XMLHTTP");} 
      catch (e){ }}}
  else if (window.XMLHttpRequest) { // Mozilla, Safari,...      
    http_request = new XMLHttpRequest(); 
    if (http_request.overrideMimeType) { 
      http_request.overrideMimeType('text/xml');}} 
  return http_request;}

// BUSCA DE CARRO

function ajaxSearchCarro() {
		http_request = testaversao();
		http_request.open("POST", "v2/search/searchVeiculo.asp" ,true);
		http_request.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		http_request.onreadystatechange=function() { 
					document.getElementById('buscaveiculos').innerHTML = '<img src="images/loadingbar.gif" />'//'<select name="select" id="select" disabled="disabled" class="font12preta" disabled="disabled"  style="width:200px;"><option value="">Carregando...</option></select>'
		   if(http_request.readyState == 4){
					document.getElementById('buscaveiculos').innerHTML = http_request.responseText
					ajaxDestaquesHome('destaqueHorizonteAjax.asp')
				}}
			http_request.send('') 
}

function ajaxTipoVeiculo(xtipo) {
		http_request = testaversao();
		var page = "v2/search/marcaSearch.asp?tipoVeiculo="+xtipo;
		http_request.open("POST", page ,true);
		http_request.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		http_request.onreadystatechange=function() { 
					document.getElementById('marcaView').innerHTML = '<select name="select" id="select" disabled="disabled" class="font12preta" disabled="disabled"  style="width:200px;"><option value="">Carregando...</option></select>'//'<img src="images/loadingbar.gif" />'
		   if(http_request.readyState == 4){
					document.getElementById('marcaView').innerHTML = http_request.responseText
					ajaxModeloVeiculo()
				}}
			http_request.send('') 
}

function ajaxModeloVeiculo() {
		http_request = testaversao();
		var page = "v2/search/modeloSearch.asp?tipoVeiculo="+document.getElementById('tpveic').value+"&marca="+document.getElementById('idmarca').value;
		http_request.open("POST", page ,true);
		http_request.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		http_request.onreadystatechange=function() { 
					document.getElementById('modeloView').innerHTML = '<select name="select" id="select" disabled="disabled" class="font12preta" disabled="disabled"  style="width:200px;"><option value="">Carregando...</option></select>'//'<img src="images/loadingbar.gif" />'
		   if(http_request.readyState == 4){
					document.getElementById('modeloView').innerHTML = http_request.responseText
					ajaxMotorModelo()
				}}
			http_request.send('') 
}

function ajaxMotorModelo() {
		http_request = testaversao();
		var page = "v2/search/ajaxMotor.asp?tipoVeiculo="+document.getElementById('tpveic').value+"&marca="+document.getElementById('idmarca').value+"&codmodelo="+document.getElementById('codmodelo').value;
		http_request.open("POST", page ,true);
		http_request.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		http_request.onreadystatechange=function() { 
					document.getElementById('motorView').innerHTML = '<select name="select" id="select" disabled="disabled" class="font12preta" disabled="disabled"  style="width:200px;"><option value="">Carregando...</option></select>'//'<img src="images/loadingbar.gif" />'
		   if(http_request.readyState == 4){
					document.getElementById('motorView').innerHTML = http_request.responseText
					ajaxAnoModelo()
				}}
			http_request.send('') 
}

function ajaxAnoModelo() {
		http_request = testaversao();
		var page = "v2/search/ajaxAnoModelo.asp?tipoVeiculo="+document.getElementById('tpveic').value+"&marca="+document.getElementById('idmarca').value+"&codmodelo="+document.getElementById('codmodelo').value+"&motor="+document.getElementById('motor').value;
		http_request.open("POST", page ,true);
		http_request.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		http_request.onreadystatechange=function() { 
					document.getElementById('anoView').innerHTML = '<select name="select" id="select" disabled="disabled" class="font12preta" disabled="disabled"  style="width:200px;"><option value="">Carregando...</option></select>'//'<img src="images/loadingbar.gif" />'
		   if(http_request.readyState == 4){
					document.getElementById('anoView').innerHTML = http_request.responseText
					ajaxCidadeVeiculo()
				}}
			http_request.send('') 
}

function ajaxCidadeVeiculo() {
		http_request = testaversao();
		var page = "v2/search/ajaxCidade.asp?tipoVeiculo="+document.getElementById('tpveic').value+"&marca="+document.getElementById('idmarca').value+"&codmodelo="+document.getElementById('codmodelo').value+"&motor="+document.getElementById('motor').value+"&anomodel="+document.getElementById('anomodel').value;
		http_request.open("POST", page ,true);
		http_request.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		http_request.onreadystatechange=function() { 
					document.getElementById('cidadeView').innerHTML = '<select name="select" id="select" disabled="disabled" class="font12preta" disabled="disabled"  style="width:200px;"><option value="">Carregando...</option></select>'//'<img src="images/loadingbar.gif" />'
		   if(http_request.readyState == 4){
					document.getElementById('cidadeView').innerHTML = http_request.responseText
				}}
			http_request.send('') 
}

// BUSCA DE MOTO

function ajaxSearchMoto() {
  http_request = testaversao();
  http_request.open("POST", "v2/search/searchMoto.asp" ,true);
  http_request.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8'); 
  http_request.onreadystatechange=function() {   
    document.getElementById('buscaveiculos').innerHTML = '<img src="images/loadingbar.gif" />'//'<select name="select" id="select" disabled="disabled" class="font12preta" disabled="disabled"  style="width:200px;"><option value="">Carregando...</option></select>'
	  if(http_request.readyState == 4){
        document.getElementById('buscaveiculos').innerHTML = http_request.responseText
        //ajaxDestaquesHome('destaqueHorizonteMotoAjax.asp')
      }
    }
  http_request.send('') 
}

function ajaxTipoMoto(xtipoMoto) {
  http_request = testaversao();
  var page = "v2/search/tipoMotoSearch.asp?tipomoto="+xtipoMoto;
  http_request.open("POST", page ,true);
  http_request.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
  http_request.onreadystatechange=function() { 
    document.getElementById('mtipomoto').innerHTML = '<font size="1" face="tahoma"><img src="img/loading3.gif" width="15" height="15" /> Carregando...</font>'
      if(http_request.readyState == 4){
        document.getElementById('mtipomoto').innerHTML = http_request.responseText
      }
    }			
  http_request.send('') 
}

function ajaxModelosMoto() {
  http_request = testaversao();
  http_request.open("POST", "v2/search/modeloMotoSearch.asp?id_marca="+document.getElementById('id_marca').value+"&estado_moto="+document.getElementById('estado_moto').value ,true);
  http_request.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
  http_request.onreadystatechange=function() { 
    document.getElementById('modelMoto').innerHTML = '<font size="1" face="tahoma"><img src="img/loading.gif" width="15" height="15" /> Carregando...</font>'
      if(http_request.readyState == 4){
        document.getElementById('modelMoto').innerHTML = http_request.responseText
        ajaxCilindradas()
      }
    }
  http_request.send('') 
}

function ajaxCilindradas() {
  http_request = testaversao();
  var page = "v2/search/ajaxCilindradas.asp?id_marca="+document.getElementById('id_marca').value+"&estado_moto="+document.getElementById('estado_moto').value+"&id_modelo="+document.getElementById('id_modelo').value; 
  http_request.open("POST", page ,true);
  http_request.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
  http_request.onreadystatechange=function() { 
    document.getElementById('cilindradaView').innerHTML = '<select name="select" id="select" disabled="disabled" class="font12preta" disabled="disabled"  style="width:200px;"><option value="">Carregando...</option></select>'//'<img src="images/loadingbar.gif" />'
      if(http_request.readyState == 4){
        document.getElementById('cilindradaView').innerHTML = http_request.responseText
        ajaxSearchAnoMoto()
      }
    }
  http_request.send('') 
}

function ajaxSearchAnoMoto() {
  http_request = testaversao();
  http_request.open("POST", "v2/search/ajaxAnoModeloMoto.asp?id_marca="+document.getElementById('id_marca').value+"&estado_moto="+document.getElementById('estado_moto').value+"&id_modelo="+document.getElementById('id_modelo').value ,true);
  http_request.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
  http_request.onreadystatechange=function() { 
    document.getElementById('anoView').innerHTML = '<select disabled="disabled" class="font12preta" disabled="disabled"  style="width:200px;"><option value="">todos</option></select>'
      if(http_request.readyState == 4){
          document.getElementById('anoView').innerHTML = http_request.responseText    
          ajaxCidadeModeloMoto()
      }
    }
  http_request.send('') 
}

function ajaxCidadeModeloMoto() {
  http_request = testaversao();
  http_request.open("POST", "v2/search/ajaxCidadeModeloMoto.asp?id_marca="+document.getElementById('id_marca').value+"&estado_moto="+document.getElementById('estado_moto').value+"&id_modelo="+document.getElementById('id_modelo').value+"&anomodel="+document.getElementById('anomodel').value ,true);
  http_request.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
  http_request.onreadystatechange=function() { 
    document.getElementById('cidadeView').innerHTML = '<select disabled="disabled" class="font12preta" disabled="disabled"  style="width:200px;"><option value="">todos</option></select>'
      if(http_request.readyState == 4){
        document.getElementById('cidadeView').innerHTML = http_request.responseText
      }
    }
  http_request.send('') 
}

function ajaxValorMaximoMoto() {
  http_request = testaversao();
  http_request.open("POST", "viewValorMaximo.asp?valorminimo="+document.formmoto.valorminimo.value ,true);
  http_request.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
  http_request.onreadystatechange=function() { 
    document.getElementById('vlmaximomoto').innerHTML = '<select disabled="disabled" class="font12preta" disabled="disabled"  style="width:200px;"><option value="">indiferente</option></select>'
      if(http_request.readyState == 4){
        document.getElementById('vlmaximomoto').innerHTML = http_request.responseText
      }
    }  
  http_request.send('') 
}

// BUSCA DE CAMINHÃO

function ajaxSearchCaminhao() {
  http_request = testaversao();
  http_request.open("POST", "v2/search/searchCaminhao.asp" ,true);
  http_request.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8'); 
  http_request.onreadystatechange=function() {   
    document.getElementById('buscaveiculos').innerHTML = '<img src="images/loadingbar.gif" />'//'<select name="select" id="select" disabled="disabled" class="font12preta" disabled="disabled"  style="width:200px;"><option value="">Carregando...</option></select>'
	if(http_request.readyState == 4){
    document.getElementById('buscaveiculos').innerHTML = http_request.responseText
	}
  }
  http_request.send('') 
}

function ajaxSelectTipoCaminhao(xtipoCaminhao) {
  http_request = testaversao();
  var page = "v2/search/tipoCaminhaoSearch.asp?tipo_caminhao="+xtipoCaminhao; 
  http_request.open("POST", page ,true);
  http_request.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8'); 
  http_request.onreadystatechange=function() { 
    document.getElementById('mtipocaminhao').innerHTML = '<font size="1" face="tahoma"><img src="img/loading3.gif" width="15" height="15" /> Carregando...</font>'
	if(http_request.readyState == 4){
      document.getElementById('mtipocaminhao').innerHTML = http_request.responseText
	  ajaxModelosCaminhao()
	  }
  }
  http_request.send('') 

}

function ajaxModelosCaminhao() {
  http_request = testaversao();
  var page = "v2/search/modeloCaminhaoSearch.asp?id_marca="+document.getElementById('id_marca').value+"&estado_veiculo="+document.getElementById('estado_veiculo').value;   
  http_request.open("POST", page ,true);
  http_request.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
  http_request.onreadystatechange=function() { 
					document.getElementById('modelCaminhao').innerHTML = '<select disabled="disabled" class="font12preta" disabled="disabled"  style="width:200px;"><option value="">qualquer modelo</option></select>'
		   if(http_request.readyState == 4){
					document.getElementById('modelCaminhao').innerHTML = http_request.responseText
					ajaxTipoCarroceria()					
				}}
			http_request.send('') 
}

function ajaxTipoCarroceria() {
  http_request = testaversao();
  var page = "v2/search/tipoCarroceriaCaminhaoSearch.asp?id_marca="+document.getElementById('id_marca').value+"&id_modelo="+document.getElementById('id_modelo').value+"&estado_veiculo="+document.getElementById('estado_veiculo').value;
		http_request.open("POST", page ,true);
		http_request.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		http_request.onreadystatechange=function() { 
					document.getElementById('tipoCarroceria').innerHTML = '<select disabled="disabled" class="font12preta" disabled="disabled"  style="width:200px;"><option value="">qualquer tipo</option></select>'
		   if(http_request.readyState == 4){
					document.getElementById('tipoCarroceria').innerHTML = http_request.responseText
					ajaxSearchAnoCaminhao()
				}}
			http_request.send('') 
}

function ajaxSearchAnoCaminhao() {
  http_request = testaversao();
		http_request.open("POST", "v2/search/ajaxAnoModeloCaminhao.asp?id_marca="+document.getElementById('id_marca').value+"&estado_veiculo="+document.getElementById('estado_veiculo').value+"&id_modelo="+document.getElementById('id_modelo').value+"&carroceria="+document.getElementById('carroceria').value ,true);
		http_request.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		http_request.onreadystatechange=function() { 
					document.getElementById('anoView').innerHTML = '<select disabled="disabled" class="font12preta" disabled="disabled"  style="width:200px;"><option value="">qualquer ano</option></select>'
		   if(http_request.readyState == 4){
					document.getElementById('anoView').innerHTML = http_request.responseText
					ajaxCidadeModeloCaminhao()
				}}
			http_request.send('') 
}

function ajaxCidadeModeloCaminhao() {
  http_request = testaversao();
		http_request.open("POST", "v2/search/ajaxCidadeModeloCaminhao.asp?id_marca="+document.getElementById('id_marca').value+"&estado_veiculo="+document.getElementById('estado_veiculo').value+"&id_modelo="+document.getElementById('id_modelo').value+"&anomodel="+document.getElementById('anomodel').value+"&carroceria="+document.getElementById('carroceria').value ,true);
		http_request.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		http_request.onreadystatechange=function() { 
					document.getElementById('cidadeView').innerHTML = '<select disabled="disabled" class="font12preta" disabled="disabled"  style="width:200px;"><option value="">qualquer cidade</option></select>'
		   if(http_request.readyState == 4){
					document.getElementById('cidadeView').innerHTML = http_request.responseText
				}}
			http_request.send('') 
}

// BUSCA CARRETA

function ajaxSearchCarreta() {
  http_request = testaversao();
		http_request.open("POST", "v2/search/searchCarreta.asp" ,true);
		http_request.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		http_request.onreadystatechange=function() { 
					document.getElementById('buscaveiculos').innerHTML = '<img src="images/loadingbar.gif" />'//'<select name="select" id="select" disabled="disabled" class="font12preta" disabled="disabled"  style="width:200px;"><option value="">Carregando...</option></select>'
		   if(http_request.readyState == 4){
					document.getElementById('buscaveiculos').innerHTML = http_request.responseText
				}}
			http_request.send('') 
}

function ajaxModelosCarreta() {
  http_request = testaversao();
		http_request.open("POST", "v2/search/modeloCarretaSearch.asp?id_marca="+document.getElementById('id_marca').value ,true);
		http_request.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		http_request.onreadystatechange=function() { 
					document.getElementById('modelCarreta').innerHTML = '<select disabled="disabled" class="font12preta" disabled="disabled"  style="width:200px;"><option value="">qualquer modelo</option></select>'
		   if(http_request.readyState == 4){
					document.getElementById('modelCarreta').innerHTML = http_request.responseText
					ajaxCarretaTipo()
				}}
			http_request.send('') 
}

function ajaxCarretaTipo() {
  http_request = testaversao();
		http_request.open("POST", "v2/search/tipoCarretaSearch.asp?id_marca="+document.getElementById('id_marca').value+"&id_modelo="+document.getElementById('id_modelo').value ,true);
		http_request.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		http_request.onreadystatechange=function() { 
					document.getElementById('tipoCarreta').innerHTML = '<select disabled="disabled" class="font12preta" disabled="disabled"  style="width:200px;"><option value="">qualquer tipo</option></select>'
		   if(http_request.readyState == 4){
					document.getElementById('tipoCarreta').innerHTML = http_request.responseText
					ajaxSearchAnoCarreta()
				}}
			http_request.send('') 
}

function ajaxSearchAnoCarreta() {
  http_request = testaversao();
		http_request.open("POST", "v2/search/ajaxAnoModeloCarreta.asp?id_marca="+document.getElementById('id_marca').value+"&id_modelo="+document.getElementById('id_modelo').value+"&tipo_carreta="+document.getElementById('tipo_carreta').value ,true);
		http_request.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		http_request.onreadystatechange=function() { 
					document.getElementById('anoView').innerHTML = '<select disabled="disabled" class="font12preta" disabled="disabled"  style="width:200px;"><option value="">qualquer ano</option></select>'
		   if(http_request.readyState == 4){
					document.getElementById('anoView').innerHTML = http_request.responseText
					ajaxCidadeModeloCarreta()
				}}
			http_request.send('') 
}

function ajaxCidadeModeloCarreta() {
  http_request = testaversao();
		http_request.open("POST", "v2/search/ajaxCidadeModeloCarreta.asp?id_marca="+document.getElementById('id_marca').value+"&id_modelo="+document.getElementById('id_modelo').value+"&tipo_carreta="+document.getElementById('tipo_carreta').value+"&anomodel="+document.getElementById('anomodel').value ,true);
		http_request.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		http_request.onreadystatechange=function() { 
					document.getElementById('cidadeView').innerHTML = '<select disabled="disabled" class="font12preta" disabled="disabled"  style="width:200px;"><option value="">qualquer cidade</option></select>'
		   if(http_request.readyState == 4){
					document.getElementById('cidadeView').innerHTML = http_request.responseText
				}}
			http_request.send('') 
}

// detalhes do anuncio

function ajaxFotoAnuncioMoto(filtro) {
		var page = "fotoFullMoto.asp?codigo="+filtro
		xmlhttp.open("POST", page ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('imgFull').innerHTML = '<font size="1" face="tahoma"><img src="img/loading.gif" width="15" height="15" /> Carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('imgFull').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}

function ajaxThumbMoto(filtro) {
		var page = "fotoThumbMoto.asp?"+filtro
		xmlhttp.open("POST", page ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('thumbnails').innerHTML = '<img src="img/loading.gif" width="15" height="15" />'
		   if(xmlhttp.readyState == 4){
					document.getElementById('thumbnails').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}

function ajaxCompareMoto(codigo) {
		var urlCompare = "addCompareMoto.asp?action=add&codigo="+codigo
		xmlhttp.open("POST", urlCompare, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('divcompare').innerHTML = '<img src="img/loading2.gif"/>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('divcompare').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}

function ajaxExcluirCompareMoto(codigo) {
		var urlDelCompare = "removeCompareMoto.asp?"+codigo
		xmlhttp.open("POST", urlDelCompare, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('tdcompare').innerHTML = '<img src="img/loading2.gif"/>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('tdcompare').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
// GERAL

// CONTATO ANUNCIO CARRO

function ajaxContato(filtro) {
		var page = "contatoAnuncio.asp?"+filtro
		xmlhttp.open("POST", page ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('contatoAnuncio').innerHTML = '<font size="1" face="tahoma"><img src="img/loading.gif" width="15" height="15" /> Carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('contatoAnuncio').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}

// CONTATO ANUNCIO MOTO

function ajaxContatoMoto(filtro) {
		var page = "contatoAnuncioMoto.asp?"+filtro
		xmlhttp.open("POST", page ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('contatoAnuncio').innerHTML = '<font size="1" face="tahoma"><img src="img/loading.gif" width="15" height="15" /> Carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('contatoAnuncio').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}

// CONTATO ANUNCIO CAMINHÃO

function ajaxContatoCaminhao(filtro) {
		var page = "contatoAnuncioCaminhao.asp?"+filtro
		xmlhttp.open("POST", page ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('contatoAnuncio').innerHTML = '<font size="1" face="tahoma"><img src="img/loading.gif" width="15" height="15" /> Carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('contatoAnuncio').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}

// CONTATO ANUNCIO CARRETA

function ajaxContatoCarreta(filtro) {
		var page = "contatoAnuncioCarreta.asp?"+filtro
		xmlhttp.open("POST", page ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('contatoAnuncio').innerHTML = '<font size="1" face="tahoma"><img src="img/loading.gif" width="15" height="15" /> Carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('contatoAnuncio').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}

// FOTOS DE ANÚNCIO DE VEÍCULO

function ajaxFotoAnuncio(filtro) {
		var page = "fotoFull.asp?codigo="+filtro
		xmlhttp.open("POST", page ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('imgFull').innerHTML = '<font size="1" face="tahoma"><img src="img/loading.gif" width="15" height="15" /> Carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('imgFull').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}

function ajaxThumb(filtro) {
		var page = "fotoThumb.asp?"+filtro
		xmlhttp.open("POST", page ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('thumbnails').innerHTML = '<img src="img/loading.gif" width="15" height="15" />'
		   if(xmlhttp.readyState == 4){
					document.getElementById('thumbnails').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}

// FOTOS DE ANÚNCIO DE CAMINHÃO

function ajaxFotoAnuncioCaminhao(idAnuncio,idImg) {
		var page = "fotoFullCaminhao.asp?id_anuncio_caminhao="+idAnuncio+"&img="+idImg
		xmlhttp.open("POST", page ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('imgFull').innerHTML = '<font size="1" face="tahoma"><img src="img/loading.gif" width="15" height="15" /> Carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('imgFull').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}

function ajaxThumbCaminhao(filtro) {
		var page = "fotoThumbCaminhao.asp?"+filtro
		xmlhttp.open("POST", page ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('thumbnails').innerHTML = '<img src="img/loading.gif" width="15" height="15" />'
		   if(xmlhttp.readyState == 4){
					document.getElementById('thumbnails').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
// FOTOS DE ANÚNCIO DE carreta

function ajaxFotoAnuncioCarreta(idAnuncio,idImg) {
		var page = "fotoFullCarreta.asp?id_anuncio_carreta="+idAnuncio+"&img="+idImg
		xmlhttp.open("POST", page ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('imgFull').innerHTML = '<font size="1" face="tahoma"><img src="img/loading.gif" width="15" height="15" /> Carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('imgFull').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}

function ajaxThumbCarreta(filtro) {
		var page = "fotoThumbCarreta.asp?"+filtro
		xmlhttp.open("POST", page ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('thumbnails').innerHTML = '<img src="img/loading.gif" width="15" height="15" />'
		   if(xmlhttp.readyState == 4){
					document.getElementById('thumbnails').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}

// COMPARAÇÃO DE ANUNCIOS 'CAMINHÃO'

function ajaxCompareCaminhao(codigo,tipoAnuncio) {
		var urlCompare = "addCompareCaminhao.asp?action=add&id_anuncio="+codigo+"&tipo_anuncio="+tipoAnuncio
		xmlhttp.open("POST", urlCompare, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('divcompare').innerHTML = '<img src="img/loading2.gif"/>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('divcompare').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}

function ajaxExcluirCompareCam(idAnuncioCaminhao,idSessionCaminhao,tipoAnuncioCaminhao) {
		xmlhttp.open("POST", "removeCompareCam.asp?id_anuncio="+idAnuncioCaminhao+"&tipo_anuncio="+tipoAnuncioCaminhao+"&session_compare="&idSessionCaminhao, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('tdcompare').innerHTML = '<img src="img/loading2.gif"/>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('tdcompare').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}

// COMPARAÇÃO DE ANUNCIOS 'CARRETA'

function ajaxCompareCarreta(id_anuncio_carreta) {
		xmlhttp.open("POST", "addCompareCarreta.asp?action=add&id_anuncio="+id_anuncio_carreta+"&tipo_anuncio=5", true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('divcompare').innerHTML = '<img src="img/loading2.gif"/>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('divcompare').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}

function ajaxExcluirCompareCarreta(codigo,idSession,tipoAnuncio) {
		xmlhttp.open("POST", "removeCompareCarreta.asp?action=remove&id_anuncio="+codigo+"&tipo_anuncio="+tipoAnuncio+"&session_compare="&idSession, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('tdcompare').innerHTML = '<img src="img/loading2.gif"/>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('tdcompare').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}




// comapra carros


function ajaxCompare(codigo) {
		var urlCompare = "addCompare.asp?action=add&codigo="+codigo
		xmlhttp.open("POST", urlCompare, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('divcompare').innerHTML = '<img src="img/loading2.gif"/>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('divcompare').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxExcluirCompare(codigo) {
		var urlDelCompare = "removeCompare.asp?"+codigo
		xmlhttp.open("POST", urlDelCompare, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('tdcompare').innerHTML = '<img src="img/loading2.gif"/>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('tdcompare').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}

// FECHA JANELAS AJAX
function ajaxCloseWindow() {
		var urlClose = "close.asp"
		xmlhttp.open("POST", urlClose, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('contatoAnuncio').innerHTML = '<img src="img/loading2.gif"/>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('contatoAnuncio').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxClose() {
		var urlClose = "close.asp"
		xmlhttp.open("POST", urlClose, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('vejaAnuncio').innerHTML = '<img src="img/loading2.gif"/>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('vejaAnuncio').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}


