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