/**
 * jquery.dlmenu.js v1.0.1
 * http://www.codrops.com
 *
 * Licensed under the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
 * 
 * Copyright 2013, Codrops
 * http://www.codrops.com
 */
!function(n,i,s){"use strict";var t=i.Modernizr,e=n("body");n.DLMenu=function(i,s){this.$el=n(s),this._init(i)},n.DLMenu.defaults={animationClasses:{classin:"dl-animate-in-1",classout:"dl-animate-out-1"},onLevelClick:function(n,i){return!1},onLinkClick:function(n,i){return!1}},n.DLMenu.prototype={_init:function(i){this.options=n.extend(!0,{},n.DLMenu.defaults,i),this._config();var s={WebkitAnimation:"webkitAnimationEnd",OAnimation:"oAnimationEnd",msAnimation:"MSAnimationEnd",animation:"animationend"},e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd",transition:"transitionend"};this.animEndEventName=s[t.prefixed("animation")]+".dlmenu",this.transEndEventName=e[t.prefixed("transition")]+".dlmenu",this.supportAnimations=t.cssanimations,this.supportTransitions=t.csstransitions,this._initEvents()},_config:function(){this.open=!1,this.$trigger=this.$el.find(".dl-trigger"),this.$menu=this.$el.children("ul.dl-menu"),this.$menuitems=this.$menu.find("li:not(.dl-back)"),this.$el.find("ul.dl-submenu-smart").prepend(
	
	('<li class="dl-back"><a href="#">' + window.deepOptions.deep_back_menu + "</a></li>"))
	
	,this.$back=this.$menu.find("li.dl-back")},_initEvents:function(){var s=this;this.$trigger.on("click.dlmenu",function(){return s.open?s._closeMenu():(s._openMenu(),i.pagePositionY=n(i).scrollTop()),!1}),this.$menuitems.on("click.dlmenu",function(t){t.stopPropagation();var e=n(this),o=e.children("ul.dl-submenu-smart");if(o.length>0){var a=o.closest(".dl-menu").css("top"),l=o.clone().css({opacity:0,top:a,"margin-top":o.css("margin-top")}).insertAfter(s.$menu),r=function(){s.$menu.off(s.animEndEventName).removeClass(s.options.animationClasses.classout).addClass("dl-subview"),e.addClass("dl-subviewopen").parents(".dl-subviewopen:first").removeClass("dl-subviewopen").addClass("dl-subview"),i.maxTransform=0,i.startPoint=n(i).scrollTop(),i.maxTransform=n(".dl-subviewopen").height()-(n(i).height()-(n(".dl-subviewopen").offset().top-n(i).scrollTop()))+25,l.remove()};return setTimeout(function(){l.addClass(s.options.animationClasses.classin),s.$menu.addClass(s.options.animationClasses.classout),s.supportAnimations?s.$menu.on(s.animEndEventName,r):r.call(),s.options.onLevelClick(e,e.children("a:first").text())}),!1}s.options.onLinkClick(e,t)}),this.$back.on("click.dlmenu",function(t){var e=n(this),o=e.parents("ul.dl-submenu-smart:first"),a=o.parent(),l=o.closest(".dl-menu").css("top"),r=o.clone().css("top",l).css("margin-top",o.css("margin-top")).insertAfter(s.$menu),u=function(){s.$menu.off(s.animEndEventName).removeClass(s.options.animationClasses.classin),r.remove()};return setTimeout(function(){r.addClass(s.options.animationClasses.classout),s.$menu.addClass(s.options.animationClasses.classin),s.supportAnimations?s.$menu.on(s.animEndEventName,u):u.call(),a.removeClass("dl-subviewopen");var t=e.parents(".dl-subview:first");t.is("li")&&t.addClass("dl-subviewopen"),t.removeClass("dl-subview"),i.maxTransform=0,i.startPoint=n(i).scrollTop(),i.maxTransform=t.height()-(n(i).height()-(t.offset().top-n(i).scrollTop()))+25}),!1})},closeMenu:function(){this.open&&this._closeMenu()},_closeMenu:function(){var n=this,i=function(){n.$menu.off(n.transEndEventName),n._resetMenu()};this.$menu.removeClass("dl-menuopen"),this.$menu.addClass("dl-menu-toggle"),this.$trigger.removeClass("dl-active"),this.supportTransitions?this.$menu.on(this.transEndEventName,i):i.call(),this.open=!1},openMenu:function(){this.open||this._openMenu()},_openMenu:function(){var s=this;e.off("click").on("click.dlmenu",function(){s._closeMenu()}),this.$menu.addClass("dl-menuopen dl-menu-toggle").on(this.transEndEventName,function(){i.maxTransform=0,n(".dl-menuopen").length&&(i.startPoint=n(i).scrollTop(),i.maxTransform=n(".dl-menuopen").height()-(n(i).height()-(n(".dl-menuopen").offset().top-n(i).scrollTop()))+25),n(this).removeClass("dl-menu-toggle")}),this.$trigger.addClass("dl-active"),this.open=!0},_resetMenu:function(){this.$menu.removeClass("dl-subview"),this.$menuitems.removeClass("dl-subview dl-subviewopen")}};var o=function(n){i.console&&i.console.error(n)};n.fn.dlmenu=function(i){if("string"==typeof i){var s=Array.prototype.slice.call(arguments,1);this.each(function(){var t=n.data(this,"dlmenu");return t?n.isFunction(t[i])&&"_"!==i.charAt(0)?void t[i].apply(t,s):void o("no such method '"+i+"' for dlmenu instance"):void o("cannot call methods on dlmenu prior to initialization; attempted to call method '"+i+"'")})}else this.each(function(){var s=n.data(this,"dlmenu");s?s._init():s=n.data(this,"dlmenu",new n.DLMenu(i,this))});return this}}(jQuery,window);