
$(function() {

    /*
     * Top dropdown nav
     */

    $("#TopMidNav > li").mouseenter(function() {
        $(this).find("ul").stop(true, true).show();
        $(this).toggleClass("selected");
    });

    $("#TopMidNav > li").mouseleave(function() {
        $(this).find("ul").stop(true, true).hide();
        $(this).toggleClass("selected");
    });

    // Toggle on click for touchscreen devices
    $("#TopMidNav > li").click(function() {
        $(this).find("ul").stop(true, true).toggle();
        $(this).toggleClass("selected");
    });


    /*
     * Left sidebar nav:
     * Hover & click open. But only click closes
     */


    $("#SidebarNav .submenu").mouseenter(function() {
        //$(this).find("ul").stop(true, true).slideDown();
    });

    $("#SidebarNav .submenu").mouseleave(function() {
        //$(this).find("ul").stop(true, true).slideUp();
    });

    $("#SidebarNav .submenu").click(function() {

        var menu = $(this).find("ul").stop(true, true);

        if (menu.is(":hidden")) {
            menu.slideDown();
        }
        else {
            menu.slideUp();
        }
    });
});







