// <![CDATA[

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 cargarReproductor (url, comboAnterior, element_id) {
    //Obtenemos el contenido del div
    //donde se cargaran los resultados
    var element =  document.getElementById(element_id);
    //Obtenemos el valor seleccionado del combo anterior
    var valordepende = document.getElementById(comboAnterior)
    var x = valordepende.value
    //construimos la url definitiva
    //pasando como parametro el valor seleccionado
    var fragment_url = url+'?id='+x;
    element.innerHTML = '<img src="../images/comun/cargando.gif" alt="cargando" />';
    //abrimos la url
    peticion.open("GET", fragment_url);
    peticion.onreadystatechange = function() {
        if (peticion.readyState == 4) {
          //escribimos la respuesta
          element.innerHTML = peticion.responseText;
        }
    }
   peticion.send(null);
}

 function MostrarFilas(Fila) {
 var elementos = document.getElementsByName(Fila);
     for (i = 0; i< elementos.length; i++) {
         if(navigator.appName.indexOf("Microsoft") > -1){
                var visible = 'block';
         } else {
                var visible = 'table-row';
         }
         elementos[i].style.display = visible;
     }
 }

 function OcultarFilas(Fila) {
     var elementos = document.getElementsByName(Fila);
     for (k = 0; k< elementos.length; k++) {
                elementos[k].style.display = "none";
     }
 }

// Ocultar capas
function mostrar(nombreCapa) {
	document.getElementById(nombreCapa).style.display="block";
}
//Mostrar capas
function ocultar(nombreCapa) {
	document.getElementById(nombreCapa).style.display ="none";
}
//Cambia imagenes
function cambiarImg(img) {
	document.imgDetalle.src = img;
}
function cambiarImg2(img) {
	document.imgDetalle2.src = img;
}

// Muestra una alerta para comprobar si realmente se desea borrar
function compDel(url) {
   if (confirm("Desea proceder a eliminar este elemento?")) window.location = url;
}
// Quita el formulario de subir archivos y muestra una precarga
function precarga() {
    mostrar('dvPrecarga');
    ocultar('dvSubeArchivos');
    if (document.getElementById('dvMsgAlerta')) {
        ocultar('dvMsgAlerta');
    }
    frmSubeArchivos.submit();
}

// ]]>
