$(function(){$("ul.jd_menu").jdMenu({disableLinks:false})});(function(d){function c(e){var f=d.data(d(e).parents().andSelf().filter("ul.jd_menu")[0],"jdMenuSettings");d("> li",e).bind("mouseenter.jdmenu mouseleave.jdmenu",function(g){d(this).toggleClass("jdm_hover");var h=d("> ul",this);if(h.length==1){clearTimeout(this.$jdTimer);var j=(g.type=="mouseenter");var i=(j?b:a);this.$jdTimer=setTimeout(function(){i(h[0],f.onAnimate,f.isVertical)},j?f.showDelay:f.hideDelay)}}).bind("click.jdmenu",function(h){var i=d("> ul",this);if(i.length==1&&(f.disableLinks==true||d(this).hasClass("accessible"))){b(i,f.onAnimate,f.isVertical);return false}if(h.target==this){var j=d("> a",h.target).not(".accessible");if(j.length>0){var g=j[0];if(!g.onclick){window.open(g.href,g.target||"_self")}else{d(g).trigger("click")}}}if(f.disableLinks||(!f.disableLinks&&!d(this).parent().hasClass("jd_menu"))){d(this).parent().jdMenuHide();h.stopPropagation()}}).find("> a").bind("focus.jdmenu blur.jdmenu",function(g){var h=d(this).parents("li:eq(0)");if(g.type=="focus"){h.addClass("jdm_hover")}else{h.removeClass("jdm_hover")}}).filter(".accessible").bind("click.jdmenu",function(g){g.preventDefault()})}function b(h,g,f){var h=d(h);if(h.is(":visible")){return}h.bgiframe();var e=h.parent();h.trigger("jdMenuShow").positionBy({target:e[0],targetPos:(f===true||!e.parent().hasClass("jd_menu")?1:3),elementPos:0,hideAfterPosition:true,positions:[4,3]});if(!h.hasClass("jdm_events")){h.addClass("jdm_events");c(h)}e.addClass("jdm_active").siblings("li").find("> ul:eq(0):visible").each(function(){a(this)});if(g===undefined){h.show()}else{g.apply(h[0],[true])}}function a(f,e){var f=d(f);d(".bgiframe",f).remove();f.filter(":not(.jd_menu)").find("> li > ul:eq(0):visible").each(function(){a(this)}).end();if(e===undefined){f.hide()}else{e.apply(f[0],[false])}f.trigger("jdMenuHide").parents("li:eq(0)").removeClass("jdm_active jdm_hover").end().find("> li").removeClass("jdm_active jdm_hover")}d.fn.jdMenu=function(e){var e=d.extend({showDelay:200,hideDelay:500,disableLinks:true},e);if(!d.isFunction(e.onAnimate)){e.onAnimate=undefined}return this.filter("ul.jd_menu").each(function(){d.data(this,"jdMenuSettings",d.extend({isVertical:d(this).hasClass("jd_menu_vertical")},e));c(this)})};d.fn.jdMenuUnbind=function(){d("ul.jdm_events",this).unbind(".jdmenu").find("> a").unbind(".jdmenu")};d.fn.jdMenuHide=function(){return this.filter("ul").each(function(){a(this)})};d(window).bind("click.jdmenu",function(){d("ul.jd_menu ul:visible").jdMenuHide()})})(jQuery);