$(document).ready(function () {


    /* MainNav */
    $("ul.mainNav > li").hover(function () {

        if ($(this).find("ul").length > 0) {
            $("ul.mainNav ul").hide();
            $(this).find("ul").show();
            if ($("ul.mainNav li:first")) {
                $("ul.mainNav li:first ul.mainsubNav").css("left", "-23px");
            }
        }

        var navlength = $(this).width();
        $("<span class='hovericon'></span>").insertAfter($(this).find("a span:first")).css("left", navlength / 2 + "px");


    }, function () {
        $("ul.mainsubNav").hide();
        $("li").not(".selected").find(".hovericon").remove();

    });

    

    /* tab scroll */
    $("div.pageIn table tr:even td, div.pageIn ul li:odd").each(function () {
        $(this).css("background-color", "#0c2131")
    });

    var tabBom = function (tab) {
        $(tab + " .tabContent:first").show();
        $(tab + " .tabs li:first").addClass('selected');

        $(tab + " .tabs li").click(function () {
            var indexpage = $(tab + " .tabs li").index(this);
            $(tab + " .tabContent").hide().eq(indexpage).show();
            $(tab + " .tabs li").removeClass("selected").eq(indexpage).addClass("selected");
        });
    }

    tabBom(".tabbedTable");


    /* chart Tab */

    var tabBom = function (tab) {
        $(tab + " .chartList li.chartBlock:first").show();
        $(tab + " .chartTab ul > li:first").addClass('active');

        $(tab + " .chartTab ul > li").click(function () {
            var indexpage = $(tab + " .chartTab ul > li").index(this);
            $(tab + " .chartList li.chartBlock").hide().eq(indexpage).show();
            $(tab + " .chartTab ul > li").removeClass("active").eq(indexpage).addClass("active");
        });
    }

    tabBom(".hisse2");

});

function fbs_click() { u = location.href; t = document.title; window.open('http://www.facebook.com/sharer.php?u=' + encodeURIComponent(u) + '&t=' + encodeURIComponent(t), 'sharer', 'toolbar=0,status=0,width=626,height=436'); return false; }
