
   function SelectHotspot(valor) {
      //verifica se o browser tem suporte a ajax
	  try {
         ajax2 = new ActiveXObject("Microsoft.XMLHTTP");
      } 
      catch(e) {
         try {
            ajax2 = new ActiveXObject("Msxml2.XMLHTTP");
         }
	     catch(ex) {
            try {
               ajax2 = new XMLHttpRequest();
            }
	        catch(exc) {
               alert("Esse browser não tem recursos para uso do Ajax");
               ajax2 = null;
            }
         }
      }
	  //se tiver suporte ajax
	  if(ajax2) {
	     //deixa apenas o elemento 1 no option, os outros são excluídos
		document.forms[0].hotspot_type.options.length = 1;
	     
		 idOpcao2  = document.getElementById("opcoes_hp");
		 
		 document.getElementById("imagem_cidade").src = "images/fundo_select.gif";	
		 
		 id_texto_cidade = document.getElementById("texto_cidade");
		 id_texto_tipo = document.getElementById("texto_tipo");
		 
		 x = document.getElementById("cidade");
		 
		 id_texto_cidade.value = x.options[x.selectedIndex].text;

		 
	     ajax2.open("POST", "classes.php", true);
		 ajax2.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		 
		 ajax2.onreadystatechange = function() {
            //enquanto estiver processando...emite a msg de carregando
			if(ajax2.readyState == 1) {
			   idOpcao.innerHTML = "Carregando...!"; 
			   id_texto_tipo.value = "carregando...";
	        }
			//após ser processado - chama função processXML que vai varrer os dados
            if(ajax2.readyState == 4 ) {
				
			   if(ajax2.responseXML) {
			      processXML_cidade(ajax2.responseXML);
			   }
			   else {
			       //caso não seja um arquivo XML emite a mensagem abaixo
				   idOpcao2.innerHTML = "--Primeiro selecione a cidade--";
				   id_texto_tipo.value = "--Primeiro selecione a cidade--";
			   }
            }
         }
		 //passa o código do estado escolhido
	     var params_2 = "cidade="+document.getElementById("cidade").value+"&acao=listTypes";
         ajax2.send(params_2);
      }
   }
   
   function processXML_cidade(obj){
      //pega a tag cidade
      var dataArray_hp   = obj.getElementsByTagName("hotspot_type");
      
	  //total de elementos contidos na tag cidade
	  if(dataArray_hp.length > 0) {
	     //percorre o arquivo XML paara extrair os dados
		 	
			
         for(var i = 0 ; i < dataArray_hp.length ; i++) {
            var item = dataArray_hp[i];
			//contéudo dos campos no arquivo XML
			var codigo_hp    =  item.getElementsByTagName("codigo")[0].firstChild.nodeValue;
			var nome_hp =  item.getElementsByTagName("nome")[0].firstChild.nodeValue;
			
	        idOpcao2.innerHTML = "Selecione o Local";
			id_texto_tipo.value = "Selecione o Local";
			//cria um novo option dinamicamente  
			
			if(i==0){
					var novo = document.createElement("option");
					//atribui um ID a esse elemento
					novo.setAttribute("id", "opcoes_hp");
					//atribui um valor
					novo.value = "";
					//atribui um texto
					novo.text  = "Todos";
					//finalmente adiciona o novo elemento
					document.getElementById("hotspot_type").options.add(novo);
					
				}
			
			var novo = document.createElement("option");
			    //atribui um ID a esse elemento
			    novo.setAttribute("id", "opcoes_hp");
				//atribui um valor
			    novo.value = codigo_hp;
				//atribui um texto
			    novo.text  = nome_hp;
				//finalmente adiciona o novo elemento
				document.getElementById("hotspot_type").options.add(novo);
				
				
		 }
	  }
	  else {
	    //caso o XML volte vazio, printa a mensagem abaixo
		
		idOpcao2.innerHTML = "--Primeiro selecione o local --";
	  }	  
   }