function Bairros(id_cidade){
	
	xmlHttp = GetXmlHttpObject();
	url="bairros_busca.asp";
	
	var id_cidade = id_cidade;
	
	url = url + "?sid=" + Math.random();
	url = url + "&id_cidade="+ id_cidade;
	
	xmlHttp.onreadystatechange=Achou;
	
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

	if (xmlHttp.readyState == 1) {
	  
	  if(id_cidade != ''){
		   document.getElementById("txt_cidade").innerHTML = id_cidade;
	  }else{
			document.getElementById("txt_cidade").innerHTML = "Cidade";
		}
	 }
}

function Bairros2(id_cidade){
	
	xmlHttp = GetXmlHttpObject();
	url="bairros_busca.asp";
	
	var id_cidade = id_cidade;
	
	url = url + "?sid=" + Math.random();
	url = url + "&id_cidade="+ id_cidade;
	
	xmlHttp.onreadystatechange=Achou;
	
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

	if (xmlHttp.readyState == 1) {
	  
	  if(id_cidade != ''){
		   document.getElementById("txt_Bairro").innerHTML = id_cidade;
	  }else{
			document.getElementById("txt_Bairro").innerHTML = "Bairros";
		}
	 }
}

function Bairros3(id_cidade){
	
	xmlHttp = GetXmlHttpObject();
	url="bairros_busca.asp";
	
	var id_cidade = id_cidade;
	
	url = url + "?sid=" + Math.random();
	url = url + "&id_cidade="+ id_cidade;
	
	xmlHttp.onreadystatechange=Achou;
	
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

	if (xmlHttp.readyState == 1) {
	  
	  if(id_cidade != ''){
		   document.getElementById("txt_Tipo_Imovel").innerHTML = id_cidade;
	  }else{
			document.getElementById("txt_Tipo_Imovel").innerHTML = "Tipo de Im&oacute;vel";
		}
	 }
}

function Achou(){ 
	if (xmlHttp.readyState==4){
		
		if(xmlHttp.responseText.indexOf("#")){
			
			var selects = xmlHttp.responseText.split("#");
			
			for(i=0; i < selects.length; i++){
							
				var option = document.createElement("option");
				option.text = selects[i];
				option.value = selects[i];
				document.getElementById("bairros").add(option);
				
			}
		}
	
	}
}

function GetXmlHttpObject()
	{
	 if (window.XMLHttpRequest) {   
			   a=new XMLHttpRequest(); } //Objeto nativo (FF/Safari/Opera7.6+)  
		   else {  
			 try {   
				a=new ActiveXObject("Msxml2.XMLHTTP");  //activeX (IE5.5+/MSXML2+)  
			 }	 
			 catch(e) {  
			   try {   
				  a=new ActiveXObject("Microsoft.XMLHTTP"); //activeX (IE5+/MSXML1)  
			   }	 
			   catch(e) { /* O navegador não tem suporte */   
				  a=false;   
			   }  
			 }  
		   }   
		   return a;  
	}
