﻿$(document).ready(function () {

    //Set element Opacitys
    $(".feature .imgContainer .shadow").css("opacity", ".5");
    // $("div.subSubNav").css("opacity", "0");

    //Add Sub Sub Level indicator to ListItems

    $("li.childNode:has(div.subSubNav)").addClass("slide");

    //Menu subNav sliding
    $("li.parentNode").hover(function () {

        $(this).children("div.subNav").slideDown(250);
    }, function () {
        var $panel = $(this);
        setTimeout(function () {
            $panel.children().children().children().children("div.subSubNav").css({ visibility: 'hidden' });
            $panel.children("div.subNav").slideUp(250);
        }, 150);
    });

    $("div.subNav").hover(function () { }, function () {
        $("div.subSubNav").css({ visibility: 'hidden' });
    });

    //Menu subSubNav sliding
    $("li.childNode").each(function () {
        $(this).hover(function () {
            $("div.subSubNav").css({ visibility: 'hidden' });

            if ($(this).children("div.subSubNav").length > 0) {
                $(this).children("div.subSubNav").css({ visibility: 'visible' });
            }

        }, function () { });

    });


    //Menu subNav Item width
    $("li.parentNode").each(function () {
        if ($(this).children("div.subNav").length > 0) {
            //alert("div: " + parseInt($(this).children("div.subNav").outerWidth()) + " - li: " + parseInt($(this).outerWidth()));
            if (parseInt($(this).children("div.subNav").outerWidth()) < parseInt($(this).outerWidth())) {
                $(this).children("div.subNav").outerWidth(parseInt($(this).outerWidth()));
            }
        }
    });

    //Home Feature Button arrow rollovers
    $("div.productLinks div.link a").hover(function () {
        $(this).siblings("span.arrow").css({ backgroundPosition: ' 0px top' });
    }, function () {
        $(this).siblings("span.arrow").css({ backgroundPosition: ' 0px bottom' });
    })

});
