﻿/****************************************************************
*
* FUNÇÔES PARA A LISTA DE NOTICIAS
*
*****************************************************************/


/*******************************************
DESDOBRAMENTO NOTICIAS -  PRIMEIRO NIVEL
*******************************************/
var NoticiaSeleccionada = null;

function tdClickNoticias(table_cell) {
    if (NoticiaSeleccionada == null) {
        //nunca executou esta função
        table_cell.className = 'menuNoticiasSel';
        NoticiaSeleccionada = table_cell;
    }
    else {
        if (NoticiaSeleccionada == table_cell) {
            //repor a cor original
            NoticiaSeleccionada.className = 'menuNoticias';
            NoticiaSeleccionada = null;
        }
        else {
            NoticiaSeleccionada.className = 'menuNoticias';
            table_cell.className = 'menuNoticiasSel';
            NoticiaSeleccionada = table_cell;
        }
        //já executou esta função

    }
}

function divNoticiasOver(table_cell) {
    if (table_cell != NoticiaSeleccionada)
    { table_cell.className = 'menuNoticiasOver'; }
}
function divNoticiasOut(table_cell) {
    if (table_cell != NoticiaSeleccionada) {
        table_cell.className = 'menuNoticias';
    }
}


var objLastMenuShownNoticias = null;

function showNoticias(objMenu) {
    if (objMenu == null) return;

    if (objLastMenuShownNoticias != null) {
        ShowDetalheNoticias(objLastMenuShownNoticias, false);
    }
    if (objLastMenuShownNoticias != objMenu) {
        ShowDetalheNoticias(objMenu, true);
        objLastMenuShownNoticias = objMenu;
    }
    else {
        objLastMenuShownNoticias = null;
    }
}

function ShowDetalheNoticias(objMenu, blnShow) {
    if (objMenu == null || objMenu == 'noSub' || blnShow == null) return false;

    if (blnShow) {
        objMenu.style.display = '';
    }
    else {
        objMenu.style.display = 'none';
    }
    return true;
}


/*******************************************
DESDOBRAMENTO NOTICIAS -  SEGUNDO NIVEL
*******************************************/
var NoticiaSeleccionada2 = null;

function tdClickNoticias2(table_cell) {
    if (NoticiaSeleccionada2 == null) {
        //nunca executou esta função
        table_cell.className = 'menuNoticiasSel2';
        NoticiaSeleccionada2 = table_cell;
    }
    else {
        if (NoticiaSeleccionada2 == table_cell) {
            //repor a cor original
            NoticiaSeleccionada2.className = 'menuNoticias2';
            NoticiaSeleccionada2 = null;
        }
        else {
            NoticiaSeleccionada2.className = 'menuNoticias2';
            table_cell.className = 'menuNoticiasSel2';
            NoticiaSeleccionada2 = table_cell;
        }
        //já executou esta função

    }
}

function divNoticiasOver2(table_cell) {
    if (table_cell != NoticiaSeleccionada2)
    { table_cell.className = 'menuNoticiasOver2'; }
}
function divNoticiasOut2(table_cell) {
    if (table_cell != NoticiaSeleccionada2) {
        table_cell.className = 'menuNoticias2';
    }
}


var objLastMenuShownNoticias2 = null;
function showNoticias2(objMenu) {
    if (objMenu == null) return;

    if (objLastMenuShownNoticias2 != null) {
        ShowDetalheNoticias2(objLastMenuShownNoticias2, false);
    }
    if (objLastMenuShownNoticias2 != objMenu) {
        ShowDetalheNoticias2(objMenu, true);
        objLastMenuShownNoticias2 = objMenu;
    }
    else {
        objLastMenuShownNoticias2 = null;
    }
}

function ShowDetalheNoticias2(objMenu, blnShow) {
    if (objMenu == null || objMenu == 'noSub' || blnShow == null) return false;

    if (blnShow) {
        objMenu.style.display = '';
    }
    else {
        objMenu.style.display = 'none';
    }
    return true;
}
