﻿function ActivarDesactivarFiltros(CheckBox, NombreElemento)
{
    EtiquetaMaster = CheckBox.id;
    EtiquetaMaster = EtiquetaMaster.substring(0, EtiquetaMaster.lastIndexOf("_") + 1);
    var Elemento = document.getElementById(EtiquetaMaster + NombreElemento);
    if(CheckBox.checked)
        Elemento.disabled= false;
    else
    {
        Elemento.disabled= true;
    }
}

function EncontrarElemento(IdElemento)
{
    var frm = document.forms[0];
    var Elem = null;
    for(i=0;i<frm.elements.length;i++)
    {
        if(frm.elements[i].id.match(IdElemento) != null)
        {
            Elem = frm.elements[i];
            break;
        }
    }
    return Elem;
 }

function ComprobarArchivos(file, extArray)
{
    var allowSubmit = false; 

    if(file.length > 0)
    {
        ext = file.substring(file.lastIndexOf(".")).toLowerCase();
        for (var i = 0; i < extArray.length; i++)
        { 
            if (extArray[i] == ext)
            { 
                allowSubmit = true; 
                break; 
            } 
        }  
        
        return allowSubmit;
    }
    else
        return false;
}

function EstiloTablaOnMouseOver(fila)
{
    fila.style.backgroundColor="#CCC";
    fila.style.cursor="pointer";
}

function EstiloTablaOnMouseOut(fila)
{
    fila.style.backgroundColor="";
}

function SeleccionarTodo(CheckboxCabecera, IdChecboxs)
{
    var ElementoTabla = null;
    var Controles = CheckboxCabecera.parentNode;
    while ((ElementoTabla == null) && (Controles.parentNode != null)) {
        if (Controles == '[object HTMLTableElement]') {
            ElementoTabla = Controles;
        }
        Controles = Controles.parentNode;

    }

    if (ElementoTabla != null) {
        ElementoTabla = ElementoTabla.childNodes[0];
        for (i = 1; i < ElementoTabla.rows.length; i++) {
            var cll = ElementoTabla.rows[i].childNodes[0];
            var checkbox = cll.childNodes[0];

            checkbox.checked = CheckboxCabecera.checked;
        }
    }
}

function mostrarplayer(Identificador, IdentificadorLink) {
    document.getElementById(Identificador).style.display = "block";
    document.getElementById(IdentificadorLink).href = "javascript:ocultarplayer('" + Identificador + "', '" + IdentificadorLink + "')";
}

function ocultarplayer(Identificador, IdentificadorLink) {
    document.getElementById(Identificador).style.display = "none";
    document.getElementById(IdentificadorLink).href = "javascript:mostrarplayer('" + Identificador + "', '" + IdentificadorLink + "')";
}




