// 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;}}}

// BUSCA IMOVEL

function ajaxSearchImovel(urlPage, divRefresh, par1, par2, parUrl, parID) {
		xmlhttp.open("POST", urlPage ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById(divRefresh).innerHTML = '<br/><br/><br/><br/><font size="1" face="tahoma"><img src="img/loading.gif" width="15" height="15" /> Carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById(divRefresh).innerHTML = xmlhttp.responseText
					ajaxTipoNegocioX(par1, par2, parUrl, parID)
				}}
			xmlhttp.send('') 
}

function ajaxTipoNegocioX(xpar1, xpar2, xparUrl, xparID) {
		var pageRes = xparUrl+"?tipo="+xpar1+"&tpnegocio="+xpar2;
		xmlhttp.open("POST", pageRes ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById(xparID).innerHTML = '<select disabled="disabled" class="form" style="width:130px;"><option value="">carregando...</option></select>'
		   if(xmlhttp.readyState == 4){
					document.getElementById(xparID).innerHTML = xmlhttp.responseText
					if (xpar1 == '1' ){
						ajaxSearchResQtoSala()
						}
					if (xpar1 == '2' ){
						ajaxSearchComQtoSala()
						}
					if (xpar1 == '3' ){
						ajaxSearchTerCity()
						}
					if (xpar1 == '4' ){
						ajaxSearchUfRur()
						}
				}}
			xmlhttp.send('') 
}



/// BUSCA AJAX IMÓVEL RESIDĘNCIAL - ALUGUEL/VENDA

function ajaxTipoNegocioRes(xtipo, xtpnegocio) {
		var pageRes = "tipoImovelSearch2.asp?tipo="+xtipo+"&tpnegocio="+xtpnegocio;
		xmlhttp.open("POST", pageRes ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('mtiponegociores').innerHTML = '<select disabled="disabled" class="form" style="width:130px;"><option value="">carregando...</option></select>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('mtiponegociores').innerHTML = xmlhttp.responseText
					ajaxSearchResQtoSala()
				}}
			xmlhttp.send('') 
}
function ajaxSearchResQtoSala() {
		xmlhttp.open("POST", "viewQtoSalaSearch2.asp?tipo="+document.formres.tipo.value+"&tpnegocio="+document.formres.tpnegocio.value+"&tpimovel="+document.formres.tpimovel.value,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('viewqtosalares').innerHTML = '<select disabled="disabled" class="form" style="width:100px;"><option value="">carregando...</option></select>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('viewqtosalares').innerHTML = xmlhttp.responseText
					ajaxSearchResGaragem()
				}}
			xmlhttp.send('') 
}
function ajaxSearchResGaragem() {
		xmlhttp.open("POST", "viewGaragemSearch2.asp?tipo="+document.formres.tipo.value+"&tpnegocio="+document.formres.tpnegocio.value+"&tpimovel="+document.formres.tpimovel.value+"&qto_dts_salas="+document.formres.qto_dts_salas.value,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('viewgaragemres').innerHTML = '<select disabled="disabled" class="form" style="width:100px;"><option value="">carregando...</option></select>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('viewgaragemres').innerHTML = xmlhttp.responseText
					ajaxSearchResCity()
				}}
			xmlhttp.send('') 
}
function ajaxSearchResCity() {
		xmlhttp.open("POST", "viewCitySearch2.asp?tipo="+document.formres.tipo.value+"&tpnegocio="+document.formres.tpnegocio.value+"&tpimovel="+document.formres.tpimovel.value+"&qto_dts_salas="+document.formres.qto_dts_salas.value+"&garagem="+document.formres.garagem.value ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('viewcityres').innerHTML = '<select disabled="disabled" class="form" style="width:100px;"><option value="">carregando...</option></select>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('viewcityres').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxSearchResBairro() {
		xmlhttp.open("POST", "viewBairroSearch2.asp?tipo="+document.formres.tipo.value+"&tpnegocio="+document.formres.tpnegocio.value+"&tpimovel="+document.formres.tpimovel.value+"&qto_dts_salas="+document.formres.qto_dts_salas.value+"&garagem="+document.formres.garagem.value+"&cidade="+document.formres.cidade.value ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('viewbairrores').innerHTML = '<select disabled="disabled" class="form" style="width:100px;"><option value="">carregando...</option></select>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('viewbairrores').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}


/// FIM AJAX BUSCA IMÓVEL RESIDENCIAL - ALUGUEL/VENDA


/// BUSCA AJAX IMÓVEL COMERCIAL - ALUGUEL/VENDA

function ajaxTipoNegocioCom(xtipocom, xtpnegociocom) {
		var pageCom = "tipoImovelSearchCom2.asp?tipo="+xtipocom+"&tpnegocio="+xtpnegociocom;
		xmlhttp.open("POST", pageCom ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('mtiponegociocom').innerHTML = '<select disabled="disabled" class="form" style="width:130px;"><option value="">carregando...</option></select>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('mtiponegociocom').innerHTML = xmlhttp.responseText
					ajaxSearchComQtoSala()
				}}
			xmlhttp.send('') 
}
function ajaxSearchComQtoSala() {
		xmlhttp.open("POST", "viewQtoSalaSearchCom2.asp?tipo="+document.formcom.tipo.value+"&tpnegocio="+document.formcom.tpnegocio.value+"&tpimovel="+document.formcom.tpimovel.value ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('viewqtosalacom').innerHTML = '<select disabled="disabled" class="form" style="width:100px;"><option value="">carregando...</option></select>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('viewqtosalacom').innerHTML = xmlhttp.responseText
					ajaxSearchComGaragem()
				}}
			xmlhttp.send('') 
}
function ajaxSearchComGaragem() {
		xmlhttp.open("POST", "viewGaragemSearchCom2.asp?tipo="+document.formcom.tipo.value+"&tpnegocio="+document.formcom.tpnegocio.value+"&tpimovel="+document.formcom.tpimovel.value+"&qto_dts_salas="+document.formcom.qto_dts_salas.value ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('viewgaragemcom').innerHTML = '<select disabled="disabled" class="form" style="width:100px;"><option value="">carregando...</option></select>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('viewgaragemcom').innerHTML = xmlhttp.responseText
					ajaxSearchComCity()
				}}
			xmlhttp.send('') 
}
function ajaxSearchComCity() {
		xmlhttp.open("POST", "viewCitySearchCom2.asp?tipo="+document.formcom.tipo.value+"&tpnegocio="+document.formcom.tpnegocio.value+"&tpimovel="+document.formcom.tpimovel.value+"&qto_dts_salas="+document.formcom.qto_dts_salas.value+"&garagem="+document.formcom.garagem.value ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('viewcitycom').innerHTML = '<select disabled="disabled" class="form" style="width:100px;"><option value="">carregando...</option></select>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('viewcitycom').innerHTML = xmlhttp.responseText
					ajaxSearchComBairro()
				}}
			xmlhttp.send('') 
}
function ajaxSearchComBairro() {
		xmlhttp.open("POST", "viewBairroSearchCom2.asp?tipo="+document.formcom.tipo.value+"&tpnegocio="+document.formcom.tpnegocio.value+"&tpimovel="+document.formcom.tpimovel.value+"&qto_dts_salas="+document.formcom.qto_dts_salas.value+"&garagem="+document.formcom.garagem.value+"&cidade="+document.formcom.cidade.value ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('viewbairrocom').innerHTML = '<select disabled="disabled" class="form" style="width:100px;"><option value="">carregando...</option></select>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('viewbairrocom').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}


/// FIM AJAX BUSCA IMÓVEL COMERCIAL - ALUGUEL/VENDA


/// BUSCA AJAX IMÓVEL TERRENO - ALUGUEL/VENDA

function ajaxTipoNegocioTer(xtipoter, xtpnegocioter) {
		var pageTer = "tipoImovelSearchTer.asp?tipo="+xtipoter+"&tpnegocio="+xtpnegocioter;
		xmlhttp.open("POST", pageTer ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('mtiponegocioter').innerHTML = '<select disabled="disabled" class="form" style="width:130px;"><option value="">carregando...</option></select>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('mtiponegocioter').innerHTML = xmlhttp.responseText
					ajaxSearchTerCity()
				}}
			xmlhttp.send('') 
}
function ajaxSearchTerCity() {
		xmlhttp.open("POST", "viewCitySearchTer.asp?tipo="+document.formter.tipo.value+"&tpnegocio="+document.formter.tpnegocio.value+"&tpimovel="+document.formter.tpimovel.value ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('viewcityter').innerHTML = '<select disabled="disabled" class="form" style="width:100px;"><option value="">carregando...</option></select>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('viewcityter').innerHTML = xmlhttp.responseText
					ajaxSearchTerBairro()
				}}
			xmlhttp.send('') 
}
function ajaxSearchTerBairro() {
		xmlhttp.open("POST", "viewBairroSearchTer.asp?tipo="+document.formter.tipo.value+"&tpnegocio="+document.formter.tpnegocio.value+"&tpimovel="+document.formter.tpimovel.value+"&cidade="+document.formter.cidade.value ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('viewbairroter').innerHTML = '<select disabled="disabled" class="form" style="width:100px;"><option value="">carregando...</option></select>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('viewbairroter').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}


/// FIM AJAX BUSCA IMÓVEL TERRENO - ALUGUEL/VENDA


/// BUSCA AJAX IMÓVEL TERRENO - ALUGUEL/VENDA

function ajaxTipoNegocioRur(xtiporur, xtpnegociorur) {
		var pageTer = "tipoImovelSearchRur.asp?tipo="+xtiporur+"&tpnegocio="+xtpnegociorur;
		xmlhttp.open("POST", pageTer ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('mtiponegociorur').innerHTML = '<select disabled="disabled" class="form" style="width:130px;"><option value="">carregando...</option></select>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('mtiponegociorur').innerHTML = xmlhttp.responseText
					ajaxSearchUfRur()
				}}
			xmlhttp.send('') 
}
function ajaxSearchUfRur() {
		xmlhttp.open("POST", "viewUfSearchRur.asp?tipo="+document.formrur.tipo.value+"&tpnegocio="+document.formrur.tpnegocio.value+"&tpimovel="+document.formrur.tpimovel.value ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('viewufrur').innerHTML = '<select disabled="disabled" class="form" style="width:100px;"><option value="">carregando...</option></select>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('viewufrur').innerHTML = xmlhttp.responseText
					ajaxSearchRurCity()
				}}
			xmlhttp.send('') 
}
function ajaxSearchRurCity() {
		xmlhttp.open("POST", "viewCitySearchRur.asp?tipo="+document.formrur.tipo.value+"&tpnegocio="+document.formrur.tpnegocio.value+"&tpimovel="+document.formrur.tpimovel.value+"&uf="+document.formrur.uf.value ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('viewcityrur').innerHTML = '<select disabled="disabled" class="form" style="width:100px;"><option value="">carregando...</option></select>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('viewcityrur').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}


/// FIM AJAX BUSCA IMÓVEL TERRENO - ALUGUEL/VENDA



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?id_imovel="+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('') 
}
