﻿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)
{
    EtiquetaMaster = CheckboxCabecera.id;
    EtiquetaMaster = EtiquetaMaster.substring(0, EtiquetaMaster.lastIndexOf("_") + 1);

    i=1;
    AuxLista = document.getElementById(EtiquetaMaster + IdChecboxs+"_"+i);
    while(AuxLista != null)
    {
        AuxLista.checked = CheckboxCabecera.checked;
        i++;
        AuxLista = document.getElementById(EtiquetaMaster + IdChecboxs+"_"+i);   
    }
}

function CerrarEstado(ImagenCerrar) {
    document.getElementById(ImagenCerrar).style.display = "none";
}





