﻿"use strict";jQuery(function(a){!function(){var b=function(){var a=c.outerWidth(),b=parseInt(c.css("paddingLeft")),d=parseInt(c.css("paddingRight"));e.forEach(function(c){var e=c.$el,f=c.$parent,g=e.data("depth")||0,h=e.data("width")||a,i=e.data("position")||"center",j=e.data("margin")||0,k=e.data("bgColor")||null,l=f.offset().left;"string"==typeof h&&h.indexOf("%")!==-1&&(h=a/100*parseFloat(h));var m={width:h},n=null;if(k&&(m.backgroundColor=k),g){var o=f.parents(".msm-top-level-item"),p=o.offset().left,q=f.parents(".sub-menu"),r=q.offset().top,s=q.width(),t=parseInt(q.css("margin-left")),u=(parseInt(q.css("margin-left")),f.offset().top);"right"===i?(h>p&&(m.width=p+t),m.left="auto",m.right=s):(h>a-p-s&&(m.width=a-p-s-t),m.left=s),m.top=r-u}else h>a||"center_full"===i?(m.width=a-b-d,n=b,j&&(m.width=a-2*j,n+=j)):"center"===i?n=(a-h)/2:"left"===i?(m.left=0,l+h>a&&(m.width=a-l),j&&(m.width-=j)):"left_edge"===i?(n=0,j&&(n=j)):"right"===i?(m.right=0,m.left="auto",h>l&&(m.width=l+f.width()),j&&(m.width-=j)):"right_edge"===i&&(n=a-l-f.width(),j&&(n-=j),h>l&&(m.width=l+f.width()));e.css(m),"null"!=n&&e.offset({left:n})})},c=a("body"),d=a(".msm-menu-item .msm-submenu, .msm-link .msm-submenu"),e=[],f=[];setTimeout(function(){d.each(function(b,d){var g=a(d),h=g.parent(),i=g.parents(".msm-click");c.outerWidth()<msm_mega_submenu.data.mobile_menu_trigger_click_bellow&&!i.length&&(i=g.parents(".msm-hover"),i.length&&i.removeClass("msm-hover").addClass("msm-click")),i.length&&(f.push(i),i.on("click",function(b){b.preventDefault();var c=!1;i.hasClass("open")&&(c=!0),a.each(f,function(a,b){b.removeClass("open")}),c||i.addClass("open")}),g.on("click",function(a){a.stopPropagation()})),e.push({$el:g,$parent:h})}),b()},500),a(window).resize(b)}(),function(){var b=a("#msm-mobile-menu");b.prependTo("body"),b.find(".respmenu-header .respmenu-open").on("click",function(){b.find(".respmenu").slideToggle(200)}),b.find(".respmenu-submenu-toggle").on("click",function(){a(this).siblings(".sub-menu").slideToggle(200)})}()});