(function(n){function b(t,i,r){setTimeout(function(){n(t).removeClass("movingout "+i).hide()},r/2)}var t,r=n(window).width(),p,h,w,i,c,u,f,e,o,l,a,v,y,s;n.cssEase={"default":"ease","in":"ease-in",out:"ease-out","in-out":"ease-in-out",snap:"cubic-bezier(0,1,.5,1)",easeOutCubic:"cubic-bezier(.215,.61,.355,1)",easeInOutCubic:"cubic-bezier(.645,.045,.355,1)",easeInCirc:"cubic-bezier(.6,.04,.98,.335)",easeOutCirc:"cubic-bezier(.075,.82,.165,1)",easeInOutCirc:"cubic-bezier(.785,.135,.15,.86)",easeInExpo:"cubic-bezier(.95,.05,.795,.035)",easeOutExpo:"cubic-bezier(.19,1,.22,1)",easeInOutExpo:"cubic-bezier(1,0,0,1)",easeInQuad:"cubic-bezier(.55,.085,.68,.53)",easeOutQuad:"cubic-bezier(.25,.46,.45,.94)",easeInOutQuad:"cubic-bezier(.455,.03,.515,.955)",easeInQuart:"cubic-bezier(.895,.03,.685,.22)",easeOutQuart:"cubic-bezier(.165,.84,.44,1)",easeInOutQuart:"cubic-bezier(.77,0,.175,1)",easeInQuint:"cubic-bezier(.755,.05,.855,.06)",easeOutQuint:"cubic-bezier(.23,1,.32,1)",easeInOutQuint:"cubic-bezier(.86,0,.07,1)",easeInSine:"cubic-bezier(.47,0,.745,.715)",easeOutSine:"cubic-bezier(.39,.575,.565,1)",easeInOutSine:"cubic-bezier(.445,.05,.55,.95)",easeInBack:"cubic-bezier(.6,-.28,.735,.045)",easeOutBack:"cubic-bezier(.175, .885,.32,1.275)",easeInOutBack:"cubic-bezier(.68,-.55,.265,1.55)"};n.fn.menu3d=function(b){t=n(this);var k=n.extend({},n.fn.menu3d.defaults,b);k.easing=n.cssEase[k.easing];p=k.responsive;h=k.clickable;w=k.skin;i=k.speed;c=k.vertical;u=k.easing;f=k.hoverIn;e=k.hoverOut;h&&n(document).click(function(t){var i=n(t.target).parents();n(i).hasClass("open")||n.fn.menu3d.closeDropdown()});k.responsive?t.addClass("responsive"):t.removeClass("responsive");n.fn.menu3d.init(t);n.fn.menu3d.setVertical(t,k.vertical,r);t.removeClass(function(n,t){return(t.match(/\bskin-\S+/g)||[]).join(" ")});t.addClass(k.skin);o=t.outerHeight();l=t.outerWidth();a=t.offset().top;v=t.offset().left;y=v+l;s=a+o;t.find("li > ul.sub").parent().prepend('<span class="arrow-icon"><\/span>');k.clickable?(t.find("> ul > li:not(.menu-non-dropdown):not(.no-link)").find(">a,>span").click(function(){var t=n(this).parent(),i=n(t).hasClass("open");return i?(n.fn.menu3d.closeDropdown(),!1):(n.fn.menu3d.closeDropdown(t),n.fn.menu3d.hoverIn(t),n(t).addClass("open"),!1)}),t.find("li > ul.sub").parent().click(function(){var t=n(this),i=n(t).hasClass("open"),r=n(t).find("> ul");n(r).click(function(){i=!1;n(t).removeClass("open")});i?(n.fn.menu3d.hoverOutSub(this),n(t).removeClass("open"),n(t).find("ul.dropdown-menu").hide()):(n.fn.menu3d.hoverInSub(this),n(t).addClass("open"))})):(t.find("li > ul.sub").parent().hover(function(){n.fn.menu3d.hoverInSub(this)},function(){n.fn.menu3d.hoverOutSub(this)}),t.find("> ul > li:not(.menu-non-dropdown):not(.no-link)").hover(function(){n.fn.menu3d.hoverIn(this)},function(){n.fn.menu3d.hoverOut(this)}))};n.fn.menu3d.init=function(i){t=n(i);t.prepend('<div class="menuToggle">Menu <span class="megaMenuToggle-icon"><\/span><\/div>');t.find(".txtSearch").focus(function(){n(this).val("")}).blur(function(){n(this).val("Search...")});t.find("> ul > li:not(.menu-non-dropdown):not(.no-link):last").addClass("last");t.find("> ul > li:first").addClass("first");t.find(".menuToggle").click(function(){t.find("> ul").toggle()})};n.fn.menu3d.closeDropdown=function(i){var r=t.find(" > ul > .open");i&&(r=t.find(" > ul > .open").not(i));n(r).removeClass("open");n.fn.menu3d.hoverOut(r);n(r).find(".open").removeClass("open");n(r).find("ul.dropdown-menu").hide()};n.fn.menu3d.hoverIn=function(t){var h=n(t).find("> div:not(.movingout)"),a=f,v=e,b;if(n(h).attr("animate-in")!=undefined&&n(h).attr("animate-in").length!=0&&(a=n(h).attr("animate-in")),n(h).attr("animate-out")!=undefined&&n(h).attr("animate-out").length!=0&&(v=n(h).attr("animate-in")),a=="slideDown")n(h).css("z-index",100).removeClass(v).slideDown(i/2).addClass(a);else{n(h).css("z-index",100).show().removeClass(v).css({"animation-fill-mode":"both","animation-duration":i+"ms","animation-timing-function":u}).addClass(a);var l=n(t).find("> .dropdown-menu"),k=n(l).outerWidth(),p=n(l).outerHeight(),d=n(l).parent().offset().left,g=d+k,nt=n(l).parent().offset().top,w=nt+p;n(l).css("left","");r>768&&(c?w>=s&&(b=w-s+1,p>o?(n(t).css("position","static"),n(l).css("top","0px")):n(l).css("top",-b)):g>=y&&n(l).css("right","-1px"))}};n.fn.menu3d.hoverOut=function(t){var c;if(n(t).length>0){var o=n(t).find("> div"),s=f,h=e;n(o).attr("animate-in")!=undefined&&n(o).attr("animate-in").length!=0&&(s=n(o).attr("animate-in"));n(o).attr("animate-out")!=undefined&&n(o).attr("animate-out").length!=0&&(h=n(o).attr("animate-out"));c=n(t).find("> div."+s);h=="none"?n(c).removeClass(s).hide(i/2):h=="slideUp"?n(c).removeClass(s).slideUp(i/2):n(c).css("z-index",1).removeClass(s).css({"animation-fill-mode":"both","animation-duration":i/2+"ms","animation-timing-function":u}).addClass(h+" movingout");b(c,h,i);var l=n(t).find(".dropdown-menu"),a=n(l).offset().left,v=n(l).outerWidth(),y=a+v;r>768&&y>=r&&n(l).css("left","-1px");n(l).parent().width("");n(l).width("")}};n.fn.menu3d.hoverInSub=function(t){n(t).find("> ul").stop(!0,!0).slideDown(100);var i=n(t).find("> ul"),f=n(t).offset().left,r=n(t).outerWidth(),e=f+r+r+80,u=n(window).width();u>768&&(e>u?(n(i).css("left","auto"),n(i).css("right","100%")):(n(i).css("left","100%"),n(i).css("right","auto")))};n.fn.menu3d.hoverOutSub=function(t){n(t).find("> ul").stop(!1,!1).slideUp(100)};n.fn.menu3d.setVertical=function(i,r,u){t=n(i);r&&u>768?(t.addClass("vertical"),t.find("> ul > li").css({float:"none",display:"block"})):t.removeClass("vertical")};n.fn.menu3d.defaults={responsive:!0,clickable:!1,skin:"skin-gray",speed:600,vertical:!1,easing:"default",hoverIn:"flipInX",hoverOut:"slideUp"}})(jQuery)