function Dados(valor,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) {
			 
			 if(combo == "idioma") {
				 
				 document.forms['formajax'].listPais.options.length = 1;
				 
				 idOpcao  = document.getElementById("opcoesPais"); 
			 } 
				 
			 if(combo == "pais") {
				 
			 	 document.forms['formajax'].listCidade.options.length = 1;
	     	 
				 idOpcao  = document.getElementById("opcoesCidade"); 
			 }
			 
			 if(combo == "cidade") {
				 
			 	 
	     	 
				 idOpcao  = document.getElementById("opcoesCurso"); 
			 }
			 
			  if(combo == "curso") {
				 
				 document.forms['formajax'].submit();
				// window.location = "../../content/cursos/index.php?curso="+valor;
/*			 	 idOpcao  = document.getElementById("curso-detalhe"); 
				 idOpcao.style.display="";
*/			 }
			 
			 ajax.open("POST", "../../modulos/cursos/curso_xml.php", 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,combo);
						  
						  if (combo == "idioma") {
						  	idOpcao.innerHTML = "País";
							document.forms['formajax'].listCidade.options.length = 1;
							
							
							/*elemento = document.getElementById("idioma-descricao");
							elemento.className = "display-ativado";
							
							elemento = document.getElementById("pais-descricao");
							elemento.className = "display-desativado";
							
							elemento = document.getElementById("cidade-descricao");
							elemento.className = "display-desativado";*/
							
						  }
						  
						  if (combo == "pais") {
						  	idOpcao.innerHTML = "Cidade";
												
							/*elemento = document.getElementById("pais-descricao");
							elemento.className = "display-ativado";
							
							elemento = document.getElementById("cidade-descricao");
							elemento.className = "display-desativado";*/
						  }
						  
						  		  
						  						  					  
					   }
					   
					 
					   
					   if (ajax.responseText == "erro") {
							if(ajax.status == 200){	
							   idOpcao.innerHTML = "Nenhum registro encontrado...";
							}
							else{	
							   idOpcao.innerHTML = "Erro ao carregar XML...";
							}
					   }
					
				  	  			   
				    }else{
						idOpcao.innerHTML = "Nenhum registro encontrado...";
					}
				}
			 }
			var params = combo+"="+valor;
			ajax.send(params);
		   }
	 }
}

function processXML(obj,combo){
  var dataArray   = obj.getElementsByTagName("curso");
  
  if(dataArray.length > 0) {
	 for(var i = 0; i < (dataArray.length); i++) {
		var item = dataArray[i];
		
		if (combo == "idioma") {
			var pais  		=  item.getElementsByTagName("pais")[0].firstChild.nodeValue;
			var valor  		=  item.getElementsByTagName("value")[0].firstChild.nodeValue;
			
			var novo = document.createElement("option");
				novo.setAttribute("id", "opcoes");
				novo.value = valor;
				novo.text  = pais;
				document.forms['formajax'].listPais.options.add(novo);
		
		}
			
		if (combo == "pais") {
			var cidade 		=  item.getElementsByTagName("cidade")[0].firstChild.nodeValue;
			var valor  		=  item.getElementsByTagName("value")[0].firstChild.nodeValue;
			
				var novo = document.createElement("option");
				novo.setAttribute("id", "opcoes");
				novo.value = valor;
				novo.text  = cidade;
				document.forms['formajax'].listCidade.options.add(novo);
				
				
			var resultadoDescricao 	= obj.getElementsByTagName("cursos");
			var item 				= resultadoDescricao[0];
			
		}
		
		if (combo == "cidade") {
			var nome 		=  item.getElementsByTagName("nome")[0].firstChild.nodeValue;
			var valor  		=  item.getElementsByTagName("value")[0].firstChild.nodeValue;
				
				var novo = document.createElement("option");
				novo.setAttribute("id", "opcoes");
				novo.value = valor;
				novo.text  = nome;
				document.forms['formajax'].listCurso.options.add(novo);
			
			var resultadoDescricao 	= obj.getElementsByTagName("cursos");
			var item 				= resultadoDescricao[0];
			
		}
			
	 }
  }
}

