﻿var verificador = 0;

function gE(elemento) {
    return document.getElementById(elemento);
}

function ShowElement(elemento) {
    gE(elemento).style.visibility = "visible";
}
function HideElement(elemento) {
    gE(elemento).style.visibility = "hidden";
}

/* Checa todos os checkboxs da tela */

function ChecarTodos() {
    verificador++;
    var checkboxes = getCheckBoxes();
    if (verificador == 1) {
        for (i = 0; i <= checkboxes.length - 1; i++) checkboxes[i].checked = true;
    }
    else
    {
        verificador = 0;
        for (i = 0; i <= checkboxes.length - 1; i++) checkboxes[i].checked = false;
    }
}

/* Retorna um array com todos os checkboxs da tela */

function getCheckBoxes() {
    var node_list = document.getElementsByTagName('input');
    var checkboxes = [];
    for (var i = 0; i < node_list.length; i++) {
        var node = node_list[i];
        if (node.getAttribute('type') == 'checkbox') {
            checkboxes.push(node);
        }
    }
    return checkboxes;
}

function ConfirmarExclusao() {
    return confirm("Deseja mesmo excluir esta notícia?");
}