cBusca = {
	busca_dados: function(type, target, cod) {
		appAjax.request('get', 'busca_rapida.php?'+ type +'='+ cod, null, function() { cBusca.popula_combo(target); }, true);
	},

	popula_combo: function(target) {
		if (appAjax.check_status()) {
			if (appAjax.check_status() == 200) {
				combo = $(target);

				combo.options.length = 0;

				if (appAjax.get_response() != 0) {
					combo.disabled = false;

					response = ",---|"+ appAjax.get_response();

					arr_dados = response.split("|");
					for(i = 0; i < arr_dados.length; i++) {
						opt_dados = arr_dados[i].split(',');

						var option = document.createElement('option');
						option.text = opt_dados[1];
						option.value = opt_dados[0];
						
						try {
							combo.add(option, null); // standards compliant; doesn't work in IE
						}
						catch(ex) {
							combo.add(option); // IE only
						}
					}
				} else {
					combo.disabled = true;
					switch(target) {
						case 'cidade':
							combo.options[0] = new Option("Nenhuma cidade encontrada", 0);
							break;
						case 'bairro':
							combo.options[0] = new Option("Nenhum bairro encontrad", 0);
					}
				}
			}
		}
	}
};