﻿ function FecharJanela()
{
    window.opener = window
    window.close("#")
}
 
 function AbrirJanela(strPagina, strNmFuncao, 
    strAltura, strLargura)
{
    window.open(strPagina, strNmFuncao, "height = " + strAltura + ", width = " + strLargura +
        ",scrollbars=no, status=no, location=no, menubar=no, toolbar=no");
}

function AbrirJanelaComBarra(strPagina, strNmFuncao, 
    strAltura, strLargura)
{
    window.open(strPagina, strNmFuncao, "height = " + strAltura + ", width = " + strLargura +
        ",scrollbars=yes, status=no, location=no, menubar=no, toolbar=no");
}

function Voltar()
{
    history.go(-1);
}

function SelecionaTodosChecks(spanChk) {
    var oItem = spanChk.children;
    var theBox = (spanChk.type == "checkbox") ? spanChk : spanChk.children.item[0];
    xState = theBox.checked;
    elm = theBox.form.elements;

    for (i = 0; i < elm.length; i++)
        if (elm[i].type == "checkbox" && elm[i].id != theBox.id) {
            if (elm[i].checked != xState)
                elm[i].click();
        }
}

function MudarCorLinha(chkSelec, corNormal) {
    if (chkSelec.checked) {
        chkSelec.parentElement.parentElement.parentElement.style.backgroundColor = '#C2c2c2';
    }
    else
        chkSelec.parentElement.parentElement.parentElement.style.backgroundColor = corNormal;
}

function SelecionarLinha(linha, corNormal, chkSelec) {
    var chk = document.getElementById(chkSelec);
    var linha = document.getElementById(linha);

    if (!chk.checked)
    {
        linha.style.backgroundColor = '#C2C2C2';
        chk.checked = true;
    }
    else 
    {
        linha.style.backgroundColor = corNormal;
        chk.checked = false;
    }
}