/*! jQuery naaav - v0.2.0 - 2013-03-11 * https://github.com/victornguyen/naaav * Copyright (c) 2013 Victor Nguyen; Licensed MIT */ (function(i,t,n){var a=function(t,n){this.$el=t,this.config=i.extend({},i.fn.naaav.defaults,n||{}),this.animations={fade:{show:"fadeIn",hide:"fadeOut"},slide:{show:"slideUp",hide:"slideDown"}},this._init()};a.prototype={_init:function(){var t=this;this._setElems();var n=i.isFunction(i.easing[this.config.easing]);n||(this.config.easing="swing"),this._setAnimation(this.config.animation),this.$items.bind({mouseenter:function(){var n=i(this),a=t._getSubNav(n),s=i.isFunction(t.config.showFunc)?t.config.showFunc:t._show;s.apply(t,[n,a])},mouseleave:function(){var n=i(this),a=t._getSubNav(n),s=i.isFunction(t.config.hideFunc)?t.config.hideFunc:t._hide;s.apply(t,[n,a])}})},_setAnimation:function(t){this.config.animation=this.animations[t]!==n?t:i.fn.naaav.defaults.animation},_animate:function(t,n){var a=this.config,s=this.animations[a.animation][n];t.stop(!1,!0)[s](a[n],a.easing,function(){i(this)[n]()})},_show:function(i,n){var a=this;this.hideAll(i),i.children("a").addClass(this.config.activeClass),t.clearTimeout(i.data("timeoutId")),i.data("timeoutId",t.setTimeout(function(){a._animate(n,"show")},this.config.delayIn))},_hide:function(i,n){var a=this;i.children("a").removeClass(this.config.activeClass),t.clearTimeout(i.data("timeoutId")),i.data("timeoutId",t.setTimeout(function(){a._animate(n,"hide")},this.config.delayOut))},_getSubNav:function(i){return i.children("ul").first()},_setElems:function(){this.$items=this.$el.children("li"),this.$links=this.$items.children("a"),this.$subnavs=this.$items.children("ul")},hideAll:function(){this.$links.removeClass(this.config.activeClass),this.$subnavs.stop(!1,!0).hide()}},i.fn.naaav=function(t){if(!this.length)return this;var n,s=arguments[1]?Array.prototype.slice.call(arguments,1):null;return this.each(function(){var e=i(this);if(e.find("ul").length)if("string"==typeof t){if(n=e.data("naaav"),n[t])return n[t].apply(n,s);i.error("Method "+t+" does not exist on jQuery.naaav")}else{if(e.data("naaav"))return this;n=new a(e,t),e.data("naaav",n)}}),this},i.fn.naaav.defaults={activeClass:"active",animation:"fade",easing:"swing",show:100,hide:100,delayIn:100,delayOut:200,showFunc:null,hideFunc:null}})(jQuery,window);