// 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) {
		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
				}}
			xmlhttp.send('') 
}

/// BUSCA AJAX IMÓVEL RESIDĘNCIAL - ALUGUEL/VENDA

function ajaxTipoNegocioRes(xtipo, xtpnegocio) {
		var pageRes = "tipoImovelSearch.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
					ajaxSearchResUf()
				}}
			xmlhttp.send('') 
}
function ajaxSearchResUf() {
		xmlhttp.open("POST", "viewUfSearch.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('viewufres').innerHTML = '<select disabled="disabled" class="form" style="width:100px;"><option value="">carregando...</option></select>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('viewufres').innerHTML = xmlhttp.responseText
					ajaxSearchResCity()
				}}
			xmlhttp.send('') 
}
function ajaxSearchResCity() {
		xmlhttp.open("POST", "viewCitySearch.asp?tipo="+document.formres.tipo.value+"&tpnegocio="+document.formres.tpnegocio.value+"&tpimovel="+document.formres.tpimovel.value+"&uf="+document.formres.uf.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
					ajaxSearchResBairro()
				}}
			xmlhttp.send('') 
}
function ajaxSearchResBairro() {
		xmlhttp.open("POST", "viewBairroSearch.asp?tipo="+document.formres.tipo.value+"&tpnegocio="+document.formres.tpnegocio.value+"&tpimovel="+document.formres.tpimovel.value+"&uf="+document.formres.uf.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
					ajaxSearchResQtoSala()
				}}
			xmlhttp.send('') 
}
function ajaxSearchResQtoSala() {
		xmlhttp.open("POST", "viewQtoSalaSearch.asp?tipo="+document.formres.tipo.value+"&tpnegocio="+document.formres.tpnegocio.value+"&tpimovel="+document.formres.tpimovel.value+"&uf="+document.formres.uf.value+"&cidade="+document.formres.cidade.value+"&bairro="+document.formres.bairro.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", "viewGaragemSearch.asp?tipo="+document.formres.tipo.value+"&tpnegocio="+document.formres.tpnegocio.valuee+"&tpimovel="+document.formres.tpimovel.value+"&uf="+document.formres.uf.value+"&cidade="+document.formres.cidade.value+"&bairro="+document.formres.bairro.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
				}}
			xmlhttp.send('') 
}


/// FIM AJAX BUSCA IMÓVEL RESIDENCIAL - ALUGUEL/VENDA


/// BUSCA AJAX IMÓVEL COMERCIAL - ALUGUEL/VENDA

function ajaxTipoNegocioCom(xtipocom, xtpnegociocom) {
		var pageCom = "tipoImovelSearchCom.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
					ajaxSearchUfCom()
				}}
			xmlhttp.send('') 
}
function ajaxSearchUfCom() {
		xmlhttp.open("POST", "viewUfSearchCom.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('viewufcom').innerHTML = '<select disabled="disabled" class="form" style="width:100px;"><option value="">carregando...</option></select>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('viewufcom').innerHTML = xmlhttp.responseText
					ajaxSearchComCity()
				}}
			xmlhttp.send('') 
}
function ajaxSearchComCity() {
		xmlhttp.open("POST", "viewCitySearchCom.asp?tipo="+document.formcom.tipo.value+"&tpnegocio="+document.formcom.tpnegocio.value+"&tpimovel="+document.formcom.tpimovel.value+"&uf="+document.formcom.uf.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", "viewBairroSearchCom.asp?tipo="+document.formcom.tipo.value+"&tpnegocio="+document.formcom.tpnegocio.value+"&tpimovel="+document.formcom.tpimovel.value+"&uf="+document.formcom.uf.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
					ajaxSearchComQtoSala()
				}}
			xmlhttp.send('') 
}
function ajaxSearchComQtoSala() {
		xmlhttp.open("POST", "viewQtoSalaSearchCom.asp?tipo="+document.formcom.tipo.value+"&tpnegocio="+document.formcom.tpnegocio.value+"&tpimovel="+document.formcom.tpimovel.value+"&uf="+document.formcom.uf.value+"&cidade="+document.formcom.cidade.value+"&bairro="+document.formcom.bairro.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", "viewGaragemSearchCom.asp?tipo="+document.formcom.tipo.value+"&tpnegocio="+document.formcom.tpnegocio.value+"&tpimovel="+document.formcom.tpimovel.value+"&uf="+document.formcom.uf.value+"&cidade="+document.formcom.cidade.value+"&bairro="+document.formcom.bairro.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
				}}
			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
					ajaxSearchUfTer()
				}}
			xmlhttp.send('') 
}
function ajaxSearchUfTer() {
		xmlhttp.open("POST", "viewUfSearchTer.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('viewufter').innerHTML = '<select disabled="disabled" class="form" style="width:100px;"><option value="">carregando...</option></select>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('viewufter').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+"&uf="+document.formter.uf.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+"&uf="+document.formter.uf.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
					ajaxSearchUfTer()
				}}
			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('') 
}

