/**
 * jquery.slimmenu.js
 * http://adnantopal.github.io/slimmenu/
 * Author: @adnantopal
 * Copyright 2013, Adnan Topal (atopal.com)
 * Licensed under the MIT license.
 */
!function(e,i,n,s){var t={resizeWidth:"768",collapserTitle:"Main Menu",animSpeed:"medium",easingEffect:null,indentChildren:!1,childrenIndenter:"&nbsp;&nbsp;"};function l(i,n){this.element=i,this.$elem=e(this.element),this.options=e.extend({},t,n),this.init()}l.prototype={init:function(){var n,s=this.options,t=this.$elem,l='<div class="menu-collapser">'+s.collapserTitle+'<div class="collapse-button"><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></div></div>';t.before(l),n=t.prev(".menu-collapser"),t.on("click",".sub-collapser",(function(i){i.preventDefault(),i.stopPropagation();var n=e(this).closest("li");e(this).hasClass("expanded")?(e(this).removeClass("expanded"),e(this).find("i").html("&#9660;"),n.find(">ul").slideUp(s.animSpeed,s.easingEffect)):(e(this).addClass("expanded"),e(this).find("i").html("&#9650;"),n.find(">ul").slideDown(s.animSpeed,s.easingEffect))})),n.on("click",".collapse-button",(function(e){e.preventDefault(),t.slideToggle(s.animSpeed,s.easingEffect)})),this.resizeMenu({data:{el:this.element,options:this.options}}),e(i).on("resize",{el:this.element,options:this.options},this.resizeMenu)},resizeMenu:function(n){var s=e(i),t=n.data.options,a=e(n.data.el),o=e("body").find(".menu-collapser");a.find("li").each((function(){e(this).has("ul").length&&(e(this).has(".sub-collapser").length?e(this).children(".sub-collapser i").html("&#9660;"):e(this).append('<span class="sub-collapser"><i>&#9660;</i></span>')),e(this).children("ul").hide(),e(this).find(".sub-collapser").removeClass("expanded").children("i").html("&#9660;")})),t.resizeWidth>=s.width()?(t.indentChildren&&a.find("ul").each((function(){var i=e(this).parents("ul").length;e(this).children("li").children("a").has("i").length||e(this).children("li").children("a").prepend(l.prototype.indent(i,t))})),a.find("li").has("ul").off("mouseenter mouseleave"),a.addClass("collapsed").hide(),o.show()):(a.find("li").has("ul").on("mouseenter",(function(){e(this).find(">ul").stop().slideDown(t.animSpeed,t.easingEffect)})).on("mouseleave",(function(){e(this).find(">ul").stop().slideUp(t.animSpeed,t.easingEffect)})),a.find("li > a > i").remove(),a.removeClass("collapsed").show(),o.hide())},indent:function(e,i){for(var n="",s=0;s<e;s++)n+=i.childrenIndenter;return"<i>"+n+"</i>"}},e.fn.slimmenu=function(i){return this.each((function(){e.data(this,"plugin_slimmenu")||e.data(this,"plugin_slimmenu",new l(this,i))}))}}(jQuery,window,document);