	function assis_dados(valor) {
		try {
			ajax = new ActiveXObject("Microsoft.XMLHTTP");
		} catch(e) {
			try {
				ajax = new ActiveXObject("Msxml2.XMLHTTP");
			} catch(ex) {
				try {
					ajax = new XMLHttpRequest();
				} catch(exc) {
					alert("Esse browser não tem recursos para uso do Ajax");
					ajax = null;
				}
			}
		}

		if(ajax) {
			
			ajax.open("POST", "assistente_pesquisa.php", true);
			ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			ajax.onreadystatechange = function() {
			//enquanto estiver processando...emite a msg de carregando
			if(ajax.readyState == 1) {
				document.getElementById('loading').style.display = ''; 
				document.getElementById('pesquisa_profissoes').style.display = 'none';
			}
			if(ajax.readyState == 4 ) {
				document.getElementById('loading').style.display = 'none';//
				if(ajax.responseXML) {
					assis_processXML(ajax.responseXML, valor);
				} else {
					alert('Erro na requisição, por favor tente mais tarde');
				}
			}
		}

		 //passa o código do estado escolhido
	     var params = "pesquisa="+valor;
         ajax.send(params);
      }
   }
	function assis_processXML(obj){

		var dataArray   = obj.getElementsByTagName("ocupacao");
		var div_pesquisa = document.getElementById('pesquisa_profissoes');
		var qtd_divs = document.getElementById('qtd_ocups');
		for(i=0;i<qtd_divs.value;i++){
			var removed = document.getElementById('id_'+i);
			div_pesquisa.removeChild(removed);
		}
		qtd_divs.value = 0;
		div_pesquisa.style.display = '';
		if(dataArray.length > 0) {
			var Url = {
				encode : function (string) {
					return escape(this._utf8_encode(string));
				},
				decode : function (string) {
					return this._utf8_decode(unescape(string));
				},
				_utf8_encode : function (string) {
					string = string.replace(/\r\n/g,"\n");
					var utftext = "";
					for (var n = 0; n < string.length; n++) {
						var c = string.charCodeAt(n);
						if (c < 128) {
							utftext += String.fromCharCode(c);
						}
						else if((c > 127) && (c < 2048)) {
							utftext += String.fromCharCode((c >> 6) | 192);
							utftext += String.fromCharCode((c & 63) | 128);
						}
						else {
							utftext += String.fromCharCode((c >> 12) | 224);
							utftext += String.fromCharCode(((c >> 6) & 63) | 128);
							utftext += String.fromCharCode((c & 63) | 128);
						}
			 
					}
					return utftext;
				},
				_utf8_decode : function (utftext) {
					var string = "";
					var i = 0;
					var c = c1 = c2 = 0;
					while ( i < utftext.length ) {
						c = utftext.charCodeAt(i);
						if (c < 128) {
							string += String.fromCharCode(c);
							i++;
						}
						else if((c > 191) && (c < 224)) {
							c2 = utftext.charCodeAt(i+1);
							string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
							i += 2;
						}
						else {
							c2 = utftext.charCodeAt(i+1);
							c3 = utftext.charCodeAt(i+2);
							string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
							i += 3;
						}
					}
					return string;
				}
			}
			qtd_divs.value = dataArray.length;
			for(var i = 0 ; i < dataArray.length ; i++) {
				var item = dataArray[i];
				var codigo	=  item.getElementsByTagName("codigo")[0].firstChild.nodeValue;
				var valor	=  item.getElementsByTagName("valor")[0].firstChild.nodeValue;
				valor = Url.decode(valor);
				
				var novo = document.createElement("div");
				novo.id = 'id_'+i;
				novo.innerHTML = '<a href="#" onmouseover="div_open_ocup(\''+i+'\').style.display = \'\';"  style="font-size:14px;text-decoration:none;color:#000;">'+valor+'</a><div id="inner_id_'+i+'" style="display:none;"><a href="#" onclick="selectPrincipal(\''+codigo+'\');return false;">Usar esta como Ocupa&ccedil;&atilde;o Principal</a> | <a href="#" onclick="selectOcupacoes(\''+codigo+'\');return false;">Adicionar a lista de ocupa&ccedil;&otilde;es Secund&aacute;rias</div>';
				div_pesquisa.appendChild(novo);
				var ass_ocup = document.getElementById('id_'+i);
				ass_ocup.style.backgroundColor = '#EEE';
				ass_ocup.style.margin = '1px 1px 1px 1px';
				ass_ocup.style.border = '#CCC 1px solid';
				ass_ocup.style.padding = '2px 2px 2px 2px';

			}
		} else {
			alert('nenhuma ocupacao encontrada');
		}	  
	}
