function ajaxGetBairro(num) {
	try{
	    xmlhttp = new XMLHttpRequest();
	}catch(ee){
	    try{
	        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	    }catch(e){
	        try{
	            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	        }catch(E){
	            xmlhttp = false;
	        }
	    }
	}
	
	//Exibe o texto carregando no div conteúdo
    document.getElementById("bairro_id").options.length = 0;
    document.getElementById("bairro_id").options[0] = new Option("Carregando...","Aguarde...");  
    
    //Abre a url
    xmlhttp.open("GET", "../ajax/busca.bairro.busca.php?cid="+num,true);

    //Executada quando o navegador obtiver o código
    xmlhttp.onreadystatechange=function() {

        if (xmlhttp.readyState==4){

            //Lê o texto
            var texto=xmlhttp.responseText
			//alert(xmlhttp.responseText)
            //Desfaz o urlencode
            texto=texto.replace(/\+/g," ")
            texto=unescape(texto)

            //Exibe o texto no div conteúdo
            opt = texto.split("\n");
            var j=0;
            for(var i=0;i<opt.length;i++){
            	val=opt[i].split("|");
				if(val[0]!=''){
						document.getElementById("bairro_id").options[j++] = new Option(val[1],val[0]);
				}
            	
            }
            if (num != 0) {
            	ajaxGetCidadeSegmento(num);
            }
        }
    }
    xmlhttp.send(null)
}
