var NewsTickerAgenda, NewsTickerNoticias;

$(document).ready(function ()
{
    tempoTab = setInterval(MudaTab, 6000);

    //Default Action
    $(".tab_content").hide(); //Hide all content
    $("ul.tabs li:first").addClass("active").show(); //Activate first tab
    $(".tab_content:first").show(); //Show first tab content

    //On Click Event
    $("ul.tabs li").click(function ()
    {
        clearInterval(tempoTab);
        $("ul.tabs li").removeClass("active");
        $(this).addClass("active");
        $(".tab_content").hide();
        var activeTab = $(this).find("a").attr("href");
        $(activeTab).fadeIn();
        return false;
    });

    function MudaTab()
    {
        tabAtual = $("ul.tabs li.active").removeClass("active");
        tabProx = tabAtual.next();

        if (!tabProx.is(":last"))
        {
            tabProx = $("ul.tabs li:first");
        }

        tabProx.addClass("active")

        $(".tab_content").hide();

        var activeTab = tabProx.find("a").attr("href");

        $(activeTab).fadeIn();
    }

    NewsTickerAgenda = new NewsTicker("agenda");
    NewsTickerNoticias = new NewsTicker("noticias");
});
