﻿$(document).ready(function () {

    var year = this.URL.substr(this.URL.length - 9, this.URL.length - 1);

    var currentYear = $('.Timeline li:has(a[href$="' + year + '"])');

    if (currentYear.size() == 0)
        currentYear = $('.Timeline li:has(a[href$="' + '2010.aspx' + '"])');

    currentYear.addClass("Selected CurrentTimeLinePage");

    $(".TopRow ul.Pointer li").not(".CurrentTimeLinePage").hover(
                function () {
                    $(this).addClass("Selected");
                },
                function () {
                    $(this).removeClass("Selected");
                }
            );

    $(".BottomRow ul.Pointer li").not(".CurrentTimeLinePage").hover(
                function () {
                    $(this).addClass("Selected");
                },
                function () {
                    $(this).removeClass("Selected");
                }
            );

    $('.Timeline li:has(a[href*="#.aspx"])').unbind('mouseenter').unbind('mouseenter').css("cursor", "default");
    $('.Timeline a[href*="#.aspx"]').remove();

    $('.Timeline li:contains("#")').text("");

    if ($(".DrawAndResultsContainer").children().size() == 0) {
        $(".DrawAndResultsHider").remove();
    }

    $(".DrawAndResultsHider .Button").click(function () {
        var container = $(this).parent().next(".DrawAndResultsContainer");

        if (container.is(":hidden")) {
            $(this).addClass("ButtonOpen");
            container.slideDown("fast");
        }
        else {
            container.hide();
            $(this).removeClass("ButtonOpen");
        }
    });
});
