﻿$(document).ready(function () {

    $(function () {
        $("#nav LI .selected").hide();
        $("#nav li .hovered").css({ opacity: 0 });
        $(".menu").hide();

        var path = location.pathname.replace('/walkerswindows', '');
        path = path.substring(1);
        path = path.split("?")[0];
        if (path == '')
            path = 'default';
        if (!path.match('.aspx'))
            path += '.aspx';
        $('#nav a[href$="' + path.toLowerCase() + '"]').closest('li').children("a").children(".selected").show();

        var index = 0
    });

    $("#nav li").hover(
        function () {
            $(this).children("a").children(".hovered").stop()
            .animate({ opacity: 1 }, 500);
        },
        function () {
            $(this).children("a").children(".hovered").stop()
            .animate({ opacity: 0 }, 500);
        }
    );

        var config = {
            over: makeTall, // function = onMouseOver callback (REQUIRED)    
            timeout: 300, // number = milliseconds delay before onMouseOut    
            out: makeShort // function = onMouseOut callback (REQUIRED)    
        };

        function makeTall() {
            $(this).children(".hovered").stop().animate({ opacity: 1 }, 500);
            $(this).find(".menu").show();
//           $(this).find(".menu").show("slide", { direction: "up" }, 300);
        }

        function makeShort() {
            $(this).find(".hovered").stop().animate({ opacity: 0 }, 500);
            $(this).find(".menu").hide();
            //$(this).find(".menu").hide("slide", { direction: "up" }, 300);
        }

        $("#nav li").hoverIntent(config);


    $("#tabs li").click(function () {
        var index = $("#tabs li").index(this);
        $('#tabs li').removeClass("selected");
        $(this).addClass("selected");

        $('div.tab-content > div').addClass("hidden");
        $('div.tab-content > div:eq(' + index + ')').removeClass("hidden");
    });

    $('.content-spotlight').spotlight();
})
