// JavaScript Document
//	try{
//	xmlhttp = new XMLHttpRequest();}catch(ee){try{
//	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{
//	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");}
//	catch(E){xmlhttp = false;}}}
function ajaxTipoVeiculo(xtipo) {
		var page = "tipoVeiculoSearch.asp?tipo="+xtipo;
		xmlhttp.open("POST", page ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('mtipoveic').innerHTML = '<font size="1" face="tahoma"><img src="img/loading3.gif" width="15" height="15" /> Carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('mtipoveic').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxModelos() {
		xmlhttp.open("POST", "viewModel.asp?idmarca="+document.getElementById('idmarca').value+"&tipoveic="+document.getElementById('tpveic').value ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('model').innerHTML = '<font size="1" face="tahoma"><img src="img/loading.gif" width="15" height="15" /> Carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('model').innerHTML = xmlhttp.responseText
					ajaxSearchAno();
					//ajaxSearchUf();
				}}
			xmlhttp.send('') 
}
function ajaxSearchAno() {
		xmlhttp.open("POST", "viewAnoSearch.asp?idmarca="+document.getElementById('idmarca').value+"&tipoveic="+document.getElementById('tpveic').value+"&idmodelo="+document.getElementById('idmodelo').value ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('viewano').innerHTML = '<select disabled="disabled" class="form" style="width:150px;"><option value="">todos</option></select>'
//					document.getElementById('viewano').innerHTML = '<font size="1" face="tahoma"><img src="img/loading.gif" width="15" height="15" /> Carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('viewano').innerHTML = xmlhttp.responseText
					ajaxSearchUf()
				}}
			xmlhttp.send('') 
}

function ajaxSearchUf() {
		xmlhttp.open("POST", "viewUfSearch.asp?idmarca="+document.formveiculo.idmarca.value+"&tipoveic="+document.getElementById('tpveic').value+"&idmodelo="+document.formveiculo.idmodelo.value+"&anofabx="+document.formveiculo.anofabx.value ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('viewuf').innerHTML = '<select disabled="disabled" class="form" style="width:150px;"><option value="">todos</option></select>'
//					document.getElementById('viewuf').innerHTML = '<font size="1" face="tahoma"><img src="img/loading.gif" width="15" height="15" /> Carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('viewuf').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}

function ajaxValorMaximo() {
		xmlhttp.open("POST", "viewValorMaximo.asp?valorminimo="+document.getElementById('valorminimo').value ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('vlmaximo').innerHTML = '<select disabled="disabled" class="form" style="width:150px;"><option value="">indiferente</option></select>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('vlmaximo').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxValorMaximoMoto() {
		xmlhttp.open("POST", "viewValorMaximo.asp?valorminimo="+document.formmoto.valorminimo.value ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('vlmaximomoto').innerHTML = '<select disabled="disabled" class="form" style="width:150px;"><option value="">indiferente</option></select>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('vlmaximomoto').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}


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('') 
}
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('') 
}
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('') 
}


/// BUSCA MOTOS

function ajaxTipoMoto(xtipoMoto) {
		var page = "tipoMotoSearch.asp?tipomoto="+xtipoMoto;
		xmlhttp.open("POST", page ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('mtipomoto').innerHTML = '<font size="1" face="tahoma"><img src="img/loading3.gif" width="15" height="15" /> Carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('mtipomoto').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxModelosMoto() {
		xmlhttp.open("POST", "viewModelMoto.asp?id_marca="+document.getElementById('id_marca').value+"&tipomoto="+document.getElementById('estado_moto').value ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('modelMoto').innerHTML = '<font size="1" face="tahoma"><img src="img/loading.gif" width="15" height="15" /> Carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('modelMoto').innerHTML = xmlhttp.responseText
					ajaxSearchAnoMoto();
					//ajaxSearchUf();
				}}
			xmlhttp.send('') 
}
function ajaxSearchAnoMoto() {
		xmlhttp.open("POST", "viewAnoSearchMoto.asp?id_marca="+document.getElementById('id_marca').value+"&tipomoto="+document.getElementById('estado_moto').value+"&id_modelo="+document.getElementById('id_modelo').value ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('viewanomoto').innerHTML = '<select disabled="disabled" class="form" style="width:150px;"><option value="">todos</option></select>'
//					document.getElementById('viewano').innerHTML = '<font size="1" face="tahoma"><img src="img/loading.gif" width="15" height="15" /> Carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('viewanomoto').innerHTML = xmlhttp.responseText
					ajaxSearchUfMoto()
				}}
			xmlhttp.send('') 
}

function ajaxSearchUfMoto() {
		xmlhttp.open("POST", "viewUfSearchMoto.asp?id_marca="+document.formmoto.id_marca.value+"&tipomoto="+document.getElementById('estado_moto').value+"&id_modelo="+document.getElementById('id_modelo').value+"&anofabmoto="+document.getElementById('anofabmoto').value ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('viewufmoto').innerHTML = '<select disabled="disabled" class="form" style="width:150px;"><option value="">todos</option></select>'
//					document.getElementById('viewuf').innerHTML = '<font size="1" face="tahoma"><img src="img/loading.gif" width="15" height="15" /> Carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('viewufmoto').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
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('') 
}
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('') 
}

function ajaxSearchCarro() {
		xmlhttp.open("POST", "searchVeiculo.asp" ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('buscaveiculos').innerHTML = '<div align="center"><font size="1" face="tahoma"><img src="img/loading.gif" width="15" height="15" /> Carregando...</font></div>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('buscaveiculos').innerHTML = xmlhttp.responseText
					ajaxDestaquesHome('destaqueHorizonteAjax.asp')
				}}
			xmlhttp.send('') 
}

function ajaxSearchMoto() {
		xmlhttp.open("POST", "searchMoto.asp" ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('buscaveiculos').innerHTML = '<div align="center"><font size="1" face="tahoma"><img src="img/loading.gif" width="15" height="15" /> Carregando...</font></div>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('buscaveiculos').innerHTML = xmlhttp.responseText
					//ajaxDestaquesHome('destaqueHorizonteMotoAjax.asp')
				}}
			xmlhttp.send('') 
}

function ajaxDestaquesHome(filtro) {
		var page = filtro
		xmlhttp.open("POST", page ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('destaqueHome').innerHTML = '<div align="center"><font size="1" face="tahoma"><img src="img/loading.gif" width="15" height="15" /> Carregando...</font></div>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('destaqueHome').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}

