var peticion = false;
var testPasado = false;
try {
  peticion = new XMLHttpRequest();
  } catch (trymicrosoft) {
  try {
  peticion = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (othermicrosoft) {
  try {
  peticion = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (failed) {
  peticion = false;
  } 
  }
}
if (!peticion)
alert("ERROR AL INICIALIZAR!");
 
function cargarCombo (url, comboAnterior, element_id, numpag) { 
    //Obtenemos el contenido del div
    //donde se cargaran los resultados
		
		if(comboAnterior!="vistos" && comboAnterior!="votados"){
		
		/*document.getElementById('lista2').style.display = "none";*/
		document.getElementById('lista2').className="li2";
		document.getElementById('contenidolista2').innerHTML = "<p style='cursor:pointer;' onclick=\"location.href='index.php'\">Quitar filtro<p>";

		
		document.getElementById('lista3').style.display = "none";
		document.getElementById('contenidolista1').innerHTML = "Filtro Aplicado";
		document.getElementById('lista1').className="li1";
		
		
		
		}
		
    var element =  document.getElementById(element_id);
		//alert("Element: " + element);
    //Obtenemos el valor seleccionado del combo anterior
    var valordepende = document.getElementById(comboAnterior);
		//alert("Valor depende: " + valordepende);
    var x = valordepende.value
		//alert("Valor x: " + x);
    //construimos la url definitiva
    //pasando como parametro el valor seleccionado
    var fragment_url = url+'?ide='+ encodeURIComponent(x)+'&numpag='+numpag;
		//alert("Url : " + fragment_url);
    //abrimos la url
    window.location.href="#inicio";
		peticion.open("GET", fragment_url);
    
		//window.location.href=fragment_url+"#caja";
    
    peticion.onreadystatechange = function() { 
        if (peticion.readyState == 4) {
	//escribimos la respuesta
	element.innerHTML = peticion.responseText;
        } 
    } 
   peticion.send(null); 
	 //document.getElementById('inicio').focus();
	 //window.location.href="index.php#inicio";
} 

