// JavaScript Document

// search menuBusca.html
function startSearchProcedure(pagina) {
	var location2;
	var location;
	
	getSelecionados(function(data){
		var theCodigo = document.getElementById("codigoBox").value;
		var p = pagina + 1;
		if ( theCodigo == "Codigo" ) {
			location = LOCAL + "/busca_lista_imoveis.php?TOKEN=" + token +"&pagina_atual=" + p;
			document.location.href = location;
			
		}
		// busca com filtro
		else {
			if (theCodigo.length == 5) theCodigo = "I" + theCodigo;
			if (theCodigo.length == 4) theCodigo = "I0" + theCodigo;
			if (theCodigo.length == 3) theCodigo = "I00" + theCodigo;
			if (theCodigo.length == 2) theCodigo = "I000" + theCodigo;
			location2 = LOCAL + "/imoveis_exibe.php?TOKEN=" + token +"&CODIMOVEL=" + theCodigo;
			document.location.href = location2;
		}						 
			//alert('location2 = '+location2);
			//alert('location = '+location);
	});
	
	return false;
}


function backSearchProcedure(pagina) {
	var p = pagina-1;
	if (p >=	1) {
	var location = LOCAL + "/busca_lista_imoveis.php?TOKEN=" + token +"&pagina_atual=" + p;
	this.location.href = location;
	}
}

function nextSearchProcedure(pagina,maxpagina) {
	
	var p = pagina+1;
	if (p<=(maxpagina+1)){
	
	var location = LOCAL + "/busca_lista_imoveis.php?TOKEN=" + token +"&pagina_atual=" + p;
	
	this.location.href = location;
	
	}
	
}

function lastSearchProcedure(pagina) {
	var p= pagina+1;
	var location = LOCAL + "/busca_lista_imoveis.php?TOKEN=" + token +"&pagina_atual=" + p;
	this.location.href = location;
}

/*
var xmlHttp = null;
var boxState01 = 0;
var selectState01 = 0;
var boxState02 = 0;
var selectState02 = 0;
var boxState03 = 0;
var selectState03 = 0;
var currentTipo = 'V';
//var LOCAL = "http://www.valoreimoveis.com.br";
var LOCAL = "http://localhost/valoreimoveis";
var token;
var todosTiposSelectChecked = 0;
var todosBairrosSelectChecked = 0;

//if (token=="")
var url2 = window.location;
if (url2 == LOCAL+"/index.php" || url2 == LOCAL || url2 == LOCAL+"/" || url2 == LOCAL+"/#" || url2 == LOCAL+"/index.php#") {
	
	//token = (Math.floor(Math.random()*1000000000000000000000000)).toString(16);
	var data = new Date();
 	var milis = Number(data);
	token=  milis;
}
else {	
	
	var teste = (window.location.search.split("=")[1]);
	token = teste.split("&")[0];
}

function onLoadPage() {
	//document.getElementById("allBack").style.visibility= 'hidden';
	//document.getElementById("myTipoDeImovelInputText").value = "Tipos";
	//document.getElementById("myBackTipoFundo").onclick = openTipos;
	var url3 = window.location;
	var url = "";
	//if (url3 == LOCAL+"/index.php" || url3 == LOCAL || url3 == LOCAL+"/" || url3 == LOCAL+"/#" || url3 == LOCAL+"/index.php#" ){
		url = "php/mainFile.php";
	//}
	//else url = "./xml/processSearch_" + token + ".xml";
	
	try {
		xmlHttp = new ActiveXObject("MSXML2.XMLHTTP.3.0");
	}
	catch (e) {
		xmlHttp = false;
		console.info("Erro - ActiveXObject - unsoft.js");
	}
		
	if (!xmlHttp) {
		try {
			xmlHttp = new XMLHttpRequest();
		}
		catch (e) {
			xmlHttp = false;
			console.info("Erro - XMLHttpRequest - unsoft.js");
		}
	}
	
	if (document.getElementById("radioTipoAluguel").checked) {
		var params = "TOKEN=" + token + "&TIPO=A";
	}
	else {
		var params = "TOKEN=" + token + "&TIPO=V";
	}
	var executar = true;
	xmlHttp.open( "GET", url + "?" + params, true );
	xmlHttp.onreadystatechange=function() {
		if (executar) {
	    	iniciaPagBusca();
			executar = false;			
	   }
	}
	xmlHttp.send( null );
	
}


//document.writeln(token);


// TIPO PRINCIPAL - A ou V
function alterarTipoImovel(tipo) {

	var url = "php/clearTipos.php";
	if (tipo == 'aluguel') {
			
		try {
			xmlHttp = new ActiveXObject("MSXML2.XMLHTTP.3.0");
		}
		catch (e) {
			xmlHttp = false;
		}
			
		if (!xmlHttp) {
			try {
				xmlHttp = new XMLHttpRequest();
			}
			catch (e) {
				xmlHttp = false;
			}
		}

		var params = "TOKEN=" + token + "&TIPO=A";
		xmlHttp.open( "GET", url + "?" + params, true );
		xmlHttp.send( null );
		
	}
	if (tipo == 'venda') {
		
		try {
			xmlHttp = new ActiveXObject("MSXML2.XMLHTTP.3.0");
		}
		catch (e) {
			xmlHttp = false;
		}
			
		if (!xmlHttp) {
			try {
				xmlHttp = new XMLHttpRequest();
			}
			catch (e) {
				xmlHttp = false;
			}
		}
	
		var params = "TOKEN=" + token + "&TIPO=V";
		xmlHttp.open( "GET", url + "?" + params, true );
		xmlHttp.send( null );
		
	}
	limpaWritten();
}

function limpaWritten() {
	document.getElementById("myTipoDeImovelInputText").value = "Tipos";
	document.getElementById("myQuartosInputText").value = "Qtd.";
	document.getElementById("myBairroInputText").value = "Bairros";
}








// TIPOS
function openTipos() {
	// call box
	var url = "php/getTipos.php";
	
	try {
		xmlHttp = new ActiveXObject("MSXML2.XMLHTTP.3.0");
	}
	catch (e) {
		xmlHttp = false;
	}
		
	if (!xmlHttp) {
		try {
			xmlHttp = new XMLHttpRequest();
		}
		catch (e) {
			xmlHttp = false;
		}
	}

	xmlHttp.onreadystatechange = processRequestTipo;
	if (document.getElementById("radioTipoAluguel").checked) {
		var params = "TIPO=A&TOKEN=" + token;
		xmlHttp.open( "GET", url + "?" + params, true );
		xmlHttp.send( null );
	}
	else if (document.getElementById("radioTipoVenda").checked) {
		var params = "TIPO=V&TOKEN=" + token;
		xmlHttp.open( "GET", url + "?" + params, true );
		xmlHttp.send( null );
	}
	else {
		alert("Favor escolher entre Aluguel ou Venda");
	}
	
}

function processRequestTipo() {
    if ( xmlHttp.readyState == 4 && xmlHttp.status == 200 ) {
		var newdiv = document.createElement("div");
		newdiv.innerHTML = xmlHttp.responseText;
		var container = document.getElementById("myShowUpBox01");
		//container.removeChild(newdiv);
		container.appendChild(newdiv);
		document.getElementById('myShowUpBox01').style.visibility = 'visible';
		document.getElementById("allBack").style.visibility = 'visible';
		document.getElementById("allBack").onclick = hideBackBox01;
		contaTiposBox();
    }
}

function hideBackBox01() {
	document.getElementById('myShowUpBox01').style.visibility = 'hidden';
	document.getElementById("allBack").style.visibility= 'hidden';
	
  	window.location.reload(true);	

	
	
}






// QUARTOS
function openQuartos() {
		
		if (boxState02 == 0) {
			if (selectState02 == 0) {
				var newdiv = document.createElement("div");
				newdiv.innerHTML = "<div id=\"unsoftChecks02\">" 
						+ "<div id=\"realChecks02\"> " 
							+ "<form>"
								+ "<input id=\"oneYell\" type=\"checkbox\" value=\"umQuarto\" onclick=\"startYelling('oneYell')\" >1<br>" 
								+ "<input id=\"twoYells\"  type=\"checkbox\" value=\"doisQuartos\" onclick=\"startYelling('twoYells')\"  >2<br>" 
								+ "<input id=\"threeYells\"  type=\"checkbox\" value=\"tresQuartos\" onclick=\"startYelling('threeYells')\"  >3<br>" 
								+ "<input id=\"fourYells\"  type=\"checkbox\" value=\"quatroQuartos\" onclick=\"startYelling('fourYells')\"  >4<br>"
								+ "<input id=\"fiveYells\"  type=\"checkbox\" value=\"cincoOuMais\" onclick=\"startYelling('fiveYells')\"  >5 ou mais"
							+ "</form>"
						+ "</div>"
						+ "<a href='#' onclick=' document.getElementById(\"myShowUpBox02\").style.visibility = \"hidden\"; document.getElementById(\"allBack\").style.visibility= \"hidden\"; boxState02 = 0; limpaQuartos();' ><img style='margin-top:5px;' src='imagens/btn_busca_limpar.png' /></a>"
			 +"<a href='#' onclick=' document.getElementById(\"myShowUpBox02\").style.visibility = \"hidden\"; document.getElementById(\"allBack\").style.visibility= \"hidden\"; boxState02 = 0;' ><img style='margin-top:5px;' src='imagens/btn_busca_ok.png' /></a>"
					+ "</div>"
				+ "</div>";
				var container = document.getElementById("myShowUpBox02");
				container.appendChild(newdiv);
				boxState02 = 1;
				document.getElementById('myShowUpBox02').style.visibility = 'visible';
				document.getElementById("allBack").style.visibility = 'visible';
				document.getElementById("allBack").onclick = hideBackBox02;
				selectState02 = 1;
			}
			else {
				boxState02 = 1;
				document.getElementById('myShowUpBox02').style.visibility = 'visible';
				document.getElementById("allBack").style.visibility = 'visible';
				document.getElementById("allBack").onclick = hideBackBox02;
			}
		}
		else {
			document.getElementById('myShowUpBox02').style.visibility = 'hidden';
			document.getElementById("allBack").style.visibility = 'hidden';
			boxState02 = 0;
		}
	}
	

function hideBackBox02() {
	document.getElementById('myShowUpBox02').style.visibility = 'hidden';
	document.getElementById("allBack").style.visibility = 'hidden';
	boxState02 = 0;
}

function startYelling(yell) {
	if (document.getElementById(yell).checked) {
		
		document.getElementById('myQuartosInputText').value = 'Ok';	
	
		var url = "php/addQuarto.php";
		
		try {
			xmlHttp = new ActiveXObject("MSXML2.XMLHTTP.3.0");
		}
		catch (e) {
			xmlHttp = false;
		}
			
		if (!xmlHttp) {
			try {
				xmlHttp = new XMLHttpRequest();
			}
			catch (e) {
				xmlHttp = false;
			}
		}
	

		if (document.getElementById("radioTipoAluguel").checked) {
			var params = "QUARTO=" + yell + "&TOKEN=" + token + "&TIPO=A";
			xmlHttp.open( "GET", url + "?" + params, true );
			xmlHttp.send( null );
			
		}
		else if (document.getElementById("radioTipoVenda").checked) {
			var params = "QUARTO=" + yell + "&TOKEN=" + token + "&TIPO=V";
			xmlHttp.open( "GET", url + "?" + params, true );
			xmlHttp.send( null );
		}
		else {
			alert("Favor escolher entre Aluguel ou Venda");
		}

	}
	else {
		document.getElementById('myQuartosInputText').value = '--';

		var url = "php/removeQuarto.php";
		
		try {
			xmlHttp = new ActiveXObject("MSXML2.XMLHTTP.3.0");
		}
		catch (e) {
			xmlHttp = false;
		}
			
		if (!xmlHttp) {
			try {
				xmlHttp = new XMLHttpRequest();
			}
			catch (e) {
				xmlHttp = false;
			}
		}
	
		if (document.getElementById("radioTipoAluguel").checked) {
			var params = "QUARTO=" + yell + "&TOKEN=" + token + "&TIPO=A";
			xmlHttp.open( "GET", url + "?" + params, true );
			xmlHttp.send( null );
		}
		else if (document.getElementById("radioTipoVenda").checked) {
			var params = "QUARTO=" + yell + "&TOKEN=" + token + "&TIPO=V";
			xmlHttp.open( "GET", url + "?" + params, true );
			xmlHttp.send( null );
		}
		else {
			alert("Favor escolher entre Aluguel ou Venda");
		}
		
	}
	
}












// BAIRROS
function openBairros() {
	// call box
	var url = "php/getBairros.php";
	
	try {
		xmlHttp = new ActiveXObject("MSXML2.XMLHTTP.3.0");
	}
	catch (e) {
		xmlHttp = false;
	}
		
	if (!xmlHttp) {
		try {
			xmlHttp = new XMLHttpRequest();
		}
		catch (e) {
			xmlHttp = false;
		}
	}

	xmlHttp.onreadystatechange = processRequestBairros;
	if (document.getElementById("radioTipoAluguel").checked) {
		var params = "TIPO=A&TOKEN=" + token;
		xmlHttp.open( "GET", url + "?" + params, true );
		xmlHttp.send( null );
	}
	else if (document.getElementById("radioTipoVenda").checked) {
		var params = "TIPO=V&TOKEN=" + token;
		xmlHttp.open( "GET", url + "?" + params, true );
		xmlHttp.send( null );
	}
	else {
		alert("Favor escolher entre Aluguel ou Venda");
	}
	
}

function processRequestBairros() {
    if ( xmlHttp.readyState == 4 && xmlHttp.status == 200 ) {
		var newdiv = document.createElement("div");
		newdiv.innerHTML = xmlHttp.responseText;
		var container = document.getElementById("myShowUpBox03");
		container.appendChild(newdiv);
		document.getElementById('myShowUpBox03').style.visibility = 'visible';
		document.getElementById("allBack").style.visibility= 'visible';
		document.getElementById("allBack").onclick = hideBackBox03;
		contaBairrosBox();
    }
}

function hideBackBox03() {
	document.getElementById('myShowUpBox03').style.visibility = 'hidden';
	document.getElementById("allBack").style.visibility= 'hidden';
	window.location.reload(true);	
}






// preco minimo
function gravaMinimo(e) {
	
	// call box
	var url = "php/addMinimo.php";
	
	try {
		xmlHttp = new ActiveXObject("MSXML2.XMLHTTP.3.0");
	}
	catch (e) {
		xmlHttp = false;
	}
		
	if (!xmlHttp) {
		try {
			xmlHttp = new XMLHttpRequest();
		}
		catch (e) {
			xmlHttp = false;
		}
	}

	if (document.getElementById("radioTipoAluguel").checked) {
		var theSmall = document.getElementById("theDePreco").value;
		var params = "TIPO=A&TOKEN=" + token + "&MINIMO=" + theSmall;
		xmlHttp.open( "GET", url + "?" + params, true );
		xmlHttp.send( null );
	}
	else if (document.getElementById("radioTipoVenda").checked) {
		var theSmall = document.getElementById("theDePreco").value;
		var params = "TIPO=V&TOKEN=" + token + "&MINIMO=" + theSmall;
		xmlHttp.open( "GET", url + "?" + params, true );
		xmlHttp.send( null );
	}
	else {
		alert("Favor escolher entre Aluguel ou Venda");
	}
	
}





// preco maximo
function gravaMaximo() {
	
	// call box
	var url = "php/addMaximo.php";
	
	try {
		xmlHttp = new ActiveXObject("MSXML2.XMLHTTP.3.0");
	}
	catch (e) {
		xmlHttp = false;
	}
		
	if (!xmlHttp) {
		try {
			xmlHttp = new XMLHttpRequest();
		}
		catch (e) {
			xmlHttp = false;
		}
	}

	if (document.getElementById("radioTipoAluguel").checked) {
		var theBig = document.getElementById("theAPreco").value;
		var params = "TIPO=A&TOKEN=" + token + "&MAXIMO=" + theBig;
		xmlHttp.open( "GET", url + "?" + params, true );
		xmlHttp.send( null );
	}
	else if (document.getElementById("radioTipoVenda").checked) {
		var theBig = document.getElementById("theAPreco").value;
		var params = "TIPO=V&TOKEN=" + token + "&MAXIMO=" + theBig;
		xmlHttp.open( "GET", url + "?" + params, true );
		xmlHttp.send( null );
	}
	else {
		alert("Favor escolher entre Aluguel ou Venda");
	}
	
}







// codigo
function gravaCodigo() {
	
	// call box
	var url = "php/addCodigo.php";
	
	try {
		xmlHttp = new ActiveXObject("MSXML2.XMLHTTP.3.0");
	}
	catch (e) {
		xmlHttp = false;
	}
		
	if (!xmlHttp) {
		try {
			xmlHttp = new XMLHttpRequest();
		}
		catch (e) {
			xmlHttp = false;
		}
	}

	if (document.getElementById("radioTipoAluguel").checked) {
		var theCodigo = document.getElementById("codigoBox").value;
		var params = "TIPO=A&TOKEN=" + token + "&CODIGO=" + theCodigo;
		xmlHttp.open( "GET", url + "?" + params, true );
		xmlHttp.send( null );
		
	}
	else if (document.getElementById("radioTipoVenda").checked) {
		var theCodigo = document.getElementById("codigoBox").value;
		var params = "TIPO=V&TOKEN=" + token + "&CODIGO=" + theCodigo;
		xmlHttp.open( "GET", url + "?" + params, true );
		xmlHttp.send( null );
	}
	else {
		alert("Favor escolher entre Aluguel ou Venda");
	}
	
}

function limpaTipo(){
var url = "php/limpaTipos.php";
			
			var params = "TOKEN=" + token;
			xmlHttp.open( "GET", url + "?" + params, true );
			xmlHttp.send( null );
			
			boxState01 = 0;
			selectState01 = 0;
			openTipos();
			document.getElementById("myTipoDeImovelInputText").value = "Tipo";
			window.location.reload(true);	
			
}

function limpaQuartos(){
var url = "php/limpaQuartos.php";
			
			var params = "TOKEN=" + token;
			xmlHttp.open( "GET", url + "?" + params, true );
			xmlHttp.send( null );
			
			boxState02 = 0;
			selectState02 = 0;
			openQuartos();
			document.getElementById("myQuartosInputText").value = "Qtd.";
			window.location.reload(true);	
			
}

function limpaBairros() {
var url = "php/limpaBairros.php";
			
			var params = "TOKEN=" + token;
			xmlHttp.open( "GET", url + "?" + params, true );
			xmlHttp.send( null );
			
			boxState03 = 0;
			selectState03 = 0;
			openBairros();
			document.getElementById("myBairroInputText").value = "Bairros";
			window.location.reload(true);	
}












// CONTROLE DE TIPOS
function contaTiposBox() {
	var stringEnvio = "";
	var cont = 0;
	var boxes = document.getElementById("someForm");	
	for (var i=0; i<boxes.length; i++) {
		if (boxes[i].checked == true) {
			stringEnvio += "|" + boxes[i].value;
			cont++;
		}
		boxes[i].onclick = contaTiposBox;
	}
	callTiposAllFor(stringEnvio);
	if (cont == 0) {
		document.getElementById("myTipoDeImovelInputText").value = "Tipos";
	}
	else if (cont == (boxes.length)) {
		document.getElementById("myTipoDeImovelInputText").value = "Todos";
	}
	else if (cont == 1) {
		document.getElementById("myTipoDeImovelInputText").value =  cont + " Tipo de Imovel";
	}
	else {
		document.getElementById("myTipoDeImovelInputText").value = cont + " Tipos de Imoveis";
	}
	
}


function markAllTipos() {
	
	var boxes = document.getElementById("someForm");
	var sendBox = "";

	if (todosTiposSelectChecked == 0) {
		for (var i=0; i<boxes.length; i++) {
			boxes[i].checked = true;
			sendBox += "|" + unescape(boxes[i].value);
		}
		
		callTiposAllFor(sendBox);
		document.getElementById("myTipoDeImovelInputText").value = "Todos";
		todosTiposSelectChecked = 1;
		window.location.reload(true);	
		
	}
	else {
		for (var i=0; i<boxes.length; i++) {
			boxes[i].checked = false;
		}
		
		var url = "php/limpaTipos.php";
		
		try {
			xmlHttp = new ActiveXObject("MSXML2.XMLHTTP.3.0");
		}
		catch (e) {
			xmlHttp = false;
		}
		
		if (!xmlHttp) {
			try {
				xmlHttp = new XMLHttpRequest();
			}
			catch (e) {
				xmlHttp = false;
			}
		}
		
		if (document.getElementById("radioTipoAluguel").checked) {
			var params = "TIPO=V&TOKEN=" + token;
			xmlHttp.open( "GET", url + "?" + params, true );
			xmlHttp.send( null );
		}
		else if (document.getElementById("radioTipoVenda").checked) {
			var params = "TIPO=V&TOKEN=" + token;
			xmlHttp.open( "GET", url + "?" + params, true );
			xmlHttp.send( null );
		}
		else {
			alert("Favor escolher entre Aluguel ou Venda");
		}
		
		document.getElementById("myTipoDeImovelInputText").value = "Tipos";
		todosTiposSelectChecked = 0;
		window.location.reload(true);	
	}
}

function callTiposAllFor(aTipo) {

	var url = "php/addAllTipos.php";
	
	try {
		xmlHttp = new ActiveXObject("MSXML2.XMLHTTP.3.0");
	}
	catch (e) {
		xmlHttp = false;
	}
		
	if (!xmlHttp) {
		try {
			xmlHttp = new XMLHttpRequest();
		}
		catch (e) {
			xmlHttp = false;
		}
	}

	if (document.getElementById("radioTipoAluguel").checked) {
		var params = "TIPO=A&TIPOIMOVEL=" + aTipo + "&TOKEN=" + token;
		xmlHttp.open( "GET", url + "?" + params, true );
		xmlHttp.send( null );
	}
	else if (document.getElementById("radioTipoVenda").checked) {
		var params = "TIPO=V&TIPOIMOVEL=" + aTipo + "&TOKEN=" + token;
		xmlHttp.open( "GET", url + "?" + params, true );
		xmlHttp.send( null );
	}
	else {
		alert("Favor escolher entre Aluguel ou Venda");
	}
	
}


// ROTINA DE BAIRROS
function contaBairrosBox() {
	var cont = 0;
	var sendBairroBox = "";
	var boxes = document.getElementById("bairroForm");	
	for (var i=0; i<boxes.length; i++) {
		if (boxes[i].checked == true) {
			cont++;
			sendBairroBox += "|" + boxes[i].value;
		}
		boxes[i].onclick = contaBairrosBox;
	}
	callBairrosAllFor(sendBairroBox);
	if (cont == 0) {
		document.getElementById("myBairroInputText").value = "Tipos";
	}
	else if (cont == (boxes.length)) {
		document.getElementById("myBairroInputText").value = "Todos";
	}
	else if (cont == 1) {
		document.getElementById("myBairroInputText").value = cont + " Bairro";
	}
	else {
		document.getElementById("myBairroInputText").value = cont + " Bairros";
	}
	
}

//NÃO ESTÀ DANDO RELOAD QUANDO CLICA NO BOTÃO
function markAllBairros() {
	
	var boxes = document.getElementById("bairroForm");
	var sendBox = "";

	if (todosBairrosSelectChecked == 0) {
		for (var i=0; i<boxes.length; i++) {
			boxes[i].checked = true;
			sendBox += "|" + unescape(boxes[i].value);
		}
		
		callBairrosAllFor(sendBairroBox);
		document.getElementById("myBairroInputText").value = "Todos";
		todosBairrosSelectChecked = 1;	
		hideBackBox03();	
	}
	else {
		for (var i=0; i<boxes.length; i++) {
			boxes[i].checked = false;
		}
		
		var url = "php/limpaBairros.php";
		
		try {
			xmlHttp = new ActiveXObject("MSXML2.XMLHTTP.3.0");
		}
		catch (e) {
			xmlHttp = false;
		}
		
		if (!xmlHttp) {
			try {
				xmlHttp = new XMLHttpRequest();
			}
			catch (e) {
				xmlHttp = false;
			}
		}
		
		if (document.getElementById("radioTipoAluguel").checked) {
			var params = "TIPO=V&TOKEN=" + token;
			xmlHttp.open( "GET", url + "?" + params, true );
			xmlHttp.send( null );
		}
		else if (document.getElementById("radioTipoVenda").checked) {
			var params = "TIPO=V&TOKEN=" + token;
			xmlHttp.open( "GET", url + "?" + params, true );
			xmlHttp.send( null );
		}
		else {
			alert("Favor escolher entre Aluguel ou Venda");
		}

		document.getElementById("myBairroInputText").value = "Bairros";
		todosBairrosSelectChecked = 0;
		hideBackBox03();	
	}
	window.location.reload(true);	
	
}

function callBairrosAllFor(aBairro) {

	var url = "php/addAllBairros.php";
	
	try {
		xmlHttp = new ActiveXObject("MSXML2.XMLHTTP.3.0");
	}
	catch (e) {
		xmlHttp = false;
	}
		
	if (!xmlHttp) {
		try {
			xmlHttp = new XMLHttpRequest();
		}
		catch (e) {
			xmlHttp = false;
		}
	}

	if (document.getElementById("radioTipoAluguel").checked) {
		var params = "TIPO=A&BAIRRO=" + aBairro + "&TOKEN=" + token;
		xmlHttp.open( "GET", url + "?" + params, true );
		xmlHttp.send( null );
	}
	else if (document.getElementById("radioTipoVenda").checked) {
		var params = "TIPO=V&BAIRRO=" + aBairro + "&TOKEN=" + token;
		xmlHttp.open( "GET", url + "?" + params, true );
		xmlHttp.send( null );
	}
	else {
		alert("Favor escolher entre Aluguel ou Venda");
	}
	
}
*/
