﻿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();
        }
}


/******************** Funções para controle do gridview ******************************************/

/*Variavel Global para definição da cor da linha gridviews (quando selecionada).*/
var corLinhaSelecionada = '#cc9933';

/*Variavel Global para definição da cor da linha gridviews (quando passa o mouse em cima).*/
var corLinhaFundoPassarMouse = '#ccff66';

function SelecionarLinha(linha, corNormal, chkSelec) {
    var chk = document.getElementById(chkSelec);
    var linha = document.getElementById(linha);

    if (!chk.checked) {
        linha.style.backgroundColor = corLinhaSelecionada;
        chk.checked = true;
    }
    else {
        linha.style.backgroundColor = corNormal;
        chk.checked = false;
    }
}

function MudarCorLinhaPassarMouse(linha) {
    var linha = document.getElementById(linha);

    linha.style.backgroundColor = corLinhaFundoPassarMouse;
}

function MudarCorLinhaSairMouse(linha, cor, chkSelec) {
    var chk = document.getElementById(chkSelec);
    var linha = document.getElementById(linha);

    if (!chk.checked) {
        linha.style.backgroundColor = cor;
    }
    else {
        linha.style.backgroundColor = corLinhaSelecionada;
    }
}
/******************** FIM - Funções para controle do gridview ******************************************/
