
/* - index.js - */
/* -*- coding: utf-8 -*-
 *
 * Copyright (C) 2009 Lincoln de Sousa <lincoln@alfaiati.net>
 * Copyright (C) 2009 Central IT
 *
 *   Author:  Lincoln de Sousa
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

/* Funç pra gerenciar a visibilidade de váos componentes visuais
 * da pána inicial. */

jq(document).ready (function () {
  /* blue */
  jq('.index-tab.cjf').hide ();

  /* green */
  jq('.index-tab.tnu').hide ();
  jq('.index-tab.cej').hide ();

  /* red */
  jq('.index-tab.outrasnoticias').hide ();

  /* yellow */
  jq('.index-tab.eventos').hide ();
  jq('.index-tab.publicacoes').hide ();
  jq('.index-tab.radiotv').hide ();

  /* Decidindo qual aba deve ser mostrada */
  if (jq('.index-tab.eventos ul').contents().filter('*').length == 0)
    {
      barPublicacoes ();
      if (jq('.index-tab.publicacoes ul').contents().filter('*').length == 0)
          barRadioTv ();
    }
  else{
    //jq('.index-tab.eventos').show ();
    barEventos ();
  }
/*
  jq(".eventos .slider").easySlider ({
    prevId: 'prev-eventos',
    nextId: 'next-eventos'
  });

  jq(".publicacoes .slider").easySlider ({
    prevId: 'prev-publicacoes',
    nextId: 'next-publicacoes'
  });

  jq(".radiotv .slider").easySlider ({
    prevId: 'prev-radiotv',
    nextId: 'next-radiotv'
  });
*/
  /*
  jq(window).resize (function () {
    var val = jq('td.container').css ('width');
    jq('div.index-tab').css ('width', val);
  });
   */

  jq(window).resize ();

});

/* ---- blue bar ---- */

function
barJf ()
{
  jq('#portalcjf-bluebox .header').css ('background-position', '0 0');
  jq('.index-tab.jf').show ();
  jq('.index-tab.cjf').hide ();
}

function
barCjf ()
{
  jq('#portalcjf-bluebox .header').css ('background-position', '0 -21px');
  jq('.index-tab.jf').hide ();
  jq('.index-tab.cjf').show ();
}

/* ---- green bar ---- */

function
barCorregedoria ()
{
  jq('#portalcjf-greenbox .header').css ('background-position', '0 0');
  jq('.index-tab.corregedoria').show ();
  jq('.index-tab.tnu').hide ();
  jq('.index-tab.cej').hide ();
}

function
barTnu ()
{
  jq('#portalcjf-greenbox .header').css ('background-position', '0 -21px');
  jq('.index-tab.corregedoria').hide ();
  jq('.index-tab.tnu').show ();
  jq('.index-tab.cej').hide ();
}

function
barCej ()
{
  jq('#portalcjf-greenbox .header').css ('background-position', '0 -42px');
  jq('.index-tab.corregedoria').hide ();
  jq('.index-tab.tnu').hide ();
  jq('.index-tab.cej').show ();
}

/* ---- red bar ---- */

function
barNoticiasCjf ()
{
  jq('#portalcjf-redbox .header').css ('background-position', '0 0');
  jq('.index-tab.noticiascjf').show ();
  jq('.index-tab.outrasnoticias').hide ();
}

function
barOutrasNoticias ()
{
  jq('#portalcjf-redbox .header').css ('background-position', '0 -21px');
  jq('.index-tab.noticiascjf').hide ();
  jq('.index-tab.outrasnoticias').show ();
}

/* ---- yellow bar ---- */

function
barEventos ()
{
  jq('#portalcjf-yellowbox .header').css ('background-position', '0 0');

  jq('.index-tab.eventos').show ();
  jq('.index-tab.publicacoes').hide ();
  jq('.index-tab.radiotv').hide ();

  jq(".eventos .slider").easySlider ({
    prevId: 'prev-eventos',
    nextId: 'next-eventos'
  });
}

function
barPublicacoes ()
{
  jq('#portalcjf-yellowbox .header').css ('background-position', '0 -21px');

  jq('.index-tab.eventos').hide ();
  jq('.index-tab.publicacoes').show ();
  jq('.index-tab.radiotv').hide ();

  jq(".publicacoes .slider").easySlider ({
    prevId: 'prev-publicacoes',
    nextId: 'next-publicacoes'
  });

}

function
barRadioTv ()
{
  jq('#portalcjf-yellowbox .header').css ('background-position', '0 -42px');

  jq('.index-tab.eventos').hide ();
  jq('.index-tab.publicacoes').hide ();
  jq('.index-tab.radiotv').show ();

  jq(".radiotv .slider").easySlider ({
    prevId: 'prev-radiotv',
    nextId: 'next-radiotv'
  });
}


