﻿$(document).ready(function() {
    //Menu hiding
    $("ul.top > li > ul").hide()
        .prev("a").click(function() {
            $(this).next("ul").animate({ "height": "toggle", "opacity": "toggle" });
        });

    //Enable opacity FX for every browser except IE
    if (!$.browser.msie) {
        //Attach menu mouse FX
        $("#menu ul img").each(function(i) {
            var imgElement = $(this);
            var aElement = imgElement.siblings("a");

            if (aElement == null)
                return;

            aElement.bind("mouseenter", function() {
                imgElement.animate({ "opacity": "1.0" }, "fast");
            }).bind("mouseleave", function() {
                imgElement.animate({ "opacity": "0.3" }, "slow");
            });
        });

        //Attach sidebars mouse FX
        $("#sidebar .box").css("opacity", "0.5").bind("mouseenter", function() {
            $(this).animate({ "opacity": "1.0" }, "fast");
        }).bind("mouseleave", function() {
            $(this).animate({ "opacity": "0.5" }, "slow");
        });
    }

    //Add pretty code
    //$("code").addClass("prettyprint");
    //prettyPrint();
});