var menu_hide_timer = null;

$(function () {
    $('#menubar ul').hide();
    $('#menubar li').hover(function () {
        var menu = $(this).children('ul');
        if (menu.length) {
            $(this).siblings().find('ul').hide();
            menu.show();
            if (menu_hide_timer) clearTimeout(menu_hide_timer);
        }
    }, function () {
        var submenus = $('ul', this);
        if (menu_hide_timer) clearTimeout(menu_hide_timer);
        menu_hide_timer = setTimeout(function () {
            submenus.hide();
            menu_hide_timer = null;
        }, 500);
    });
});

Shadowbox.init({
    handleOversize: "drag",
    overlayOpacity: 0.8,
    modal: true
});

