   function Dados(valor,combo) {
   
   	seleted = combo;
   	
	if (valor!=0){
	  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 possui recursos para uso do Ajax");
               ajax = null;
            }
         }
      }
	  
	  if(ajax) {
	     document.forms[0].listImovel.options.length = 1;
	     
		 idOpcao  = document.getElementById("opcoes");
		 idResultado  = document.getElementById("detalheimovel");
	 
		 ajax.open("GET", "../../modulos/imoveis/lista_xml.php?tipo="+valor+"&modo=1", true);
		 ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		 
		 ajax.onreadystatechange = function() {
		 
			if(ajax.readyState == 1) {
			   	idOpcao.innerHTML = "Carregando..."; 
	        }
			
            if(ajax.readyState == 4 ) {
			   if (ajax.responseText != "erro"){
				   if(ajax.responseXML) {
					  processXML(ajax.responseXML);
				   }
				   else {
						if(ajax.status == 200){
						   idResultado.style.display="none";	
						   idOpcao.innerHTML = "Nenhum Imóvel cadastrado...";
						}
						else{
						   idResultado.style.display="none";	
						   idOpcao.innerHTML = "Erro ao carregar XML...";
						}
				   }
			    }else{
					idResultado.style.display="none";	
					idOpcao.innerHTML = "Nenhum Imóvel cadastrado nesta sessão...";
				}
            }
         }
         ajax.send(null);
      }
	 }
	 
   }
   
   function processXML(obj){
      var dataArray   = obj.getElementsByTagName("imovel");
	  
		  if(dataArray.length > 0) {
			 for(var i = 1 ; i < dataArray.length ; i++) {
				var item = dataArray[i];
				var tipo      =  item.getElementsByTagName("tipo")[0].firstChild.nodeValue;
				var nometipo  =  item.getElementsByTagName("nometipo")[0].firstChild.nodeValue;
				var codigo    =  item.getElementsByTagName("codigo")[0].firstChild.nodeValue;
				var nome 	  =  item.getElementsByTagName("nome")[0].firstChild.nodeValue;
				if (seleted == "listImovel"){				
					var endereco  	=  item.getElementsByTagName("endereco")[0].firstChild.nodeValue;
					var info  		=  replaceAll(item.getElementsByTagName("info")[0].firstChild.nodeValue,"xxx", "<br />");
					var img_imagem	=  item.getElementsByTagName("img_imagem")[0].firstChild.nodeValue;
					var img_codigo	=  item.getElementsByTagName("img_codigo")[0].firstChild.nodeValue;
					var img_largura	=  item.getElementsByTagName("img_largura")[0].firstChild.nodeValue;
					var img_altura	=  item.getElementsByTagName("img_altura")[0].firstChild.nodeValue;
				}
				
				if (seleted == "listTipo"){
					idOpcao.innerHTML = "Selecione um Imóvel";
				}else{
					if ((i == 1) && seleted == "listImovel"){
						idOpcao.innerHTML = nome;
						idResultado.style.display="";
						
						img_pasta = "../../modulos/imagens/imagens_upload/imoveis/"+img_imagem;
						img_url   = "../../modulos/imagens/popup_imagens.php?codigo="+img_codigo+"&amp;modulo=imoveis"; 
						if (img_imagem == "0")
							idResultado.innerHTML = "<div id=\"imgnaodisponivel\"><p>Imagem não disponível</p></div><h4>"+nome.toUpperCase()+"</h4><small>"+nometipo+"</small><p><strong>Endereço:</strong>"+endereco+"</p><p><strong>Informações:</strong>"+info+"</p>";
						else
							idResultado.innerHTML = "<a href=javascript:abrePopUp('"+img_url+"','150','150')><img src="+img_pasta+" width="+img_largura+" height="+img_altura+" alt='Imagem' title='Imagem' /></a><h4>"+nome.toUpperCase()+"</h4><small>"+nometipo+"</small><p><strong>Endereço:</strong>"+endereco+"</p><p><strong>Informações:</strong>"+info+"</p>";
					}
				}
					
				var novo = document.createElement("option");
					novo.setAttribute("id", "opcoes");
					novo.value = tipo+"x"+codigo;
					novo.text  = nome;
					if ((i != 1) && (seleted == "listImovel"))
						document.forms[0].listImovel.options.add(novo);
					else if (seleted == "listTipo")
							document.forms[0].listImovel.options.add(novo);
			 
			 }
		  }else
				idOpcao.innerHTML = "Primeiro, selecione o tipo";
   }
   


