(function(a,d){a("*").hover(function(){a(this).data(d,1)},function(){a(this).data(d,0)}).data(d,0);a[d]=function(b){return a(b)[d]()};a.fn[d]=function(b){b=0;a(this).each(function(){b+=a(this).data(d)});return b>0}})(jQuery,"isHovered");(function(a){a.jMenu={defaults:{ulWidth:"auto",absoluteTop:30,absoluteLeft:0,effects:{effectSpeedOpen:350,effectSpeedClose:350,effectTypeOpen:"slide",effectTypeClose:"slide",effectOpen:"linear",effectClose:"linear"},TimeBeforeOpening:200,TimeBeforeClosing:200,animatedText:false,paddingLeft:7},init:function(b){opts=a.extend({},a.jMenu.defaults,b);a("#jMenu a:not(.fNiv)").each(function(){var c=a(this);if(a.jMenu._IsParent(c)){c.addClass("isParent")}if(opts.animatedText){a.jMenu._animateText(c)}c.bind({mouseover:function(){a.jMenu._hide(c);a.jMenu._showNextChild(c)}})});a("#jMenu li a.fNiv").bind({mouseover:function(){var d=a(this);var c=d.next();ULWidth=a.jMenu._returnUlWidth(d);a.jMenu._closeList(a("#jMenu ul"));if(c.is(":hidden")){a.jMenu._showFirstChild(d)}}});a("#jMenu").bind({mouseleave:function(){setTimeout(function(){a.jMenu._closeAll()},opts.TimeBeforeClosing)}})},_showFirstChild:function(d){if(a.jMenu._IsParent(d)){var c=d.next();if(c.is(":hidden")){var b=d.position();c.css({top:b.top+opts.absoluteTop,left:b.left+opts.absoluteLeft,width:ULWidth}).children().css({width:ULWidth});a.jMenu._show(c)}}else{return false}},_showNextChild:function(d){if(a.jMenu._IsParent(d)){var c=d.next();if(c.is(":hidden")){var b=d.position();c.css({top:b.top,left:b.left+ULWidth,width:ULWidth}).children().css({width:ULWidth});a.jMenu._show(c)}}else{return false}},_hide:function(b){if(a.jMenu._IsParent(b)&&!b.next().is(":hidden")){a.jMenu._closeList(b.next())}else{if((a.jMenu._IsParent(b)&&b.next().is(":hidden"))||!a.jMenu._IsParent(b)){a.jMenu._closeList(b.parent().parent().find("ul"))}else{return false}}},_show:function(b){switch(opts.effects.effectTypeOpen){case"slide":b.stop(true,true).delay(opts.TimeBeforeOpening).slideDown(opts.effects.effectSpeedOpen,opts.effects.effectOpen);break;case"fade":b.stop(true,true).delay(opts.TimeBeforeOpening).fadeIn(opts.effects.effectSpeedOpen,opts.effects.effectOpen);break;default:b.stop(true,true).delay(opts.TimeBeforeOpening).show(opts.effects.effectSpeedOpen,opts.effects.effectOpen)}},_closeList:function(b){switch(opts.effects.effectTypeClose){case"slide":b.slideUp(opts.effects.effectSpeedClose,opts.effects.effectClose);break;case"fade":b.fadeOut(opts.effects.effectSpeedClose,opts.effects.effectClose);break;default:b.hide(opts.effects.effectSpeedClose,opts.effects.effectClose)}},_closeAll:function(){if(!a("#jMenu").isHovered()){a("#jMenu ul").each(function(){a.jMenu._closeList(a(this))})}},_IsParent:function(b){if(b.next().is("ul")){return true}else{return false}},_returnUlWidth:function(b){switch(opts.ulWidth){case"auto":ULWidth=parseInt(b.parent().outerWidth());break;default:ULWidth=parseInt(opts.ulWidth)}return ULWidth},_animateText:function(c){var b=parseInt(c.css("padding-left"));c.hover(function(){a(this).stop(true,true).animate({paddingLeft:b+opts.paddingLeft},100)},function(){a(this).stop(true,true).animate({paddingLeft:b},100)})},_isReadable:function(){if(a("a.fNiv").length>0){return true}else{return false}},_error:function(){alert("Please, check you have the '.fNiv' class on your first level links.")}};jQuery.fn.jMenu=function(b){if(a.jMenu._isReadable()){a.jMenu.init(b)}else{a.jMenu._error()}}})(jQuery);
