(function(a){a(function(){function d(){var c=a(".mp-row-fluid.mp-row-fullwidth, .mp-row-fluid.mp-row-fullwidth-content, .mp-row-fluid.mp-row-fixed-width-content");a.each(c,function(){var c=a("html"),b=a(this),c=c.width();b.css({width:"","padding-left":"","margin-left":"","padding-right":"","margin-right":""});var d=b.hasClass("mp-row-fullwidth-content"),h=b.hasClass("mp-row-fixed-width-content"),k=b.offset().left;e()&&(k-=CE.LeftBar.myThis.getSpace());var p=c-k-b.width(),l,m;l=m="";h?b.children(".motopress-clmn").length&&
(b.css("max-width",parseInt(MPCEVars.fixed_row_width)),d=b.innerWidth(),b.css("max-width",""),b.css("width",c),l=parseInt(b.css("padding-left")),m=parseInt(b.css("padding-right")),h=(b.innerWidth()-l-m-d)/2,h=0<h?h:0,d=l+h,h=m+h,l=0<d?d:l,m=0<h?h:m):d||(l=k-parseInt(b.css("border-left-width"))+parseInt(b.css("padding-left")),m=p-parseInt(b.css("border-right-width"))-parseInt(b.css("padding-right")));b.css({width:c,"padding-left":l,"margin-left":-k,"padding-right":m,"margin-right":-p})});a(window).trigger("mpce-row-size-update")}
var e=function(){return parent.hasOwnProperty("MP")&&parent.MP.hasOwnProperty("Editor")};d();if(e())parent.MP.Editor.onIfr("Resize EditorLoad LeftBarShow LeftBarHide",function(){d()});var c;a(window).resize(function(){c&&clearTimeout(c);c=setTimeout(function(){d()},500)})})})(jQuery);jQuery(window).load(function(){if("undefined"===typeof jQuery.fn.stellar)return!1;jQuery.stellar({horizontalScrolling:!1,verticalScrolling:!0,responsive:!0})});jQuery(window).load(function(){mpFixBackgroundVideoSize()});
jQuery(window).resize(function(){this.mpResizeTimeout&&clearTimeout(this.mpResizeTimeout);this.mpResizeTimeout=setTimeout(function(){jQuery(this).trigger("mpResizeEnd")},500)});jQuery(window).on("mpResizeEnd mpce-row-size-update",function(){mpFixBackgroundVideoSize()});function onYouTubeIframeAPIReady(){mpInitYouTubePlayers()}
function mpInitYouTubePlayers(a){function d(d){return function(c){$player=jQuery(a[d]);"1"===$player.attr("data-mute")&&c.target.mute()}}"undefined"===typeof a&&(a=jQuery(".mp-video-container>.mp-youtube-container>.mp-youtube-video"));a.each(function(e,c){$player=jQuery(c);var b=new YT.Player(a[e],{videoId:$player.attr("data-src"),events:{onReady:d(e)}});$player.data("ytplayer",b)})}
jQuery(".mp-video-container").on("click",function(a){jQuery(this).children("video").length?(a=jQuery(this).children("video")[0],a.paused?a.play():a.pause()):(a=jQuery(this).find("iframe.mp-youtube-video").data("ytplayer"))&&(2===a.getPlayerState()?a.playVideo():a.pauseVideo())});jQuery(".mp-row-video").on("click",function(a){jQuery(a.target).is(".mp-row-fluid")?jQuery(this).children(".mp-video-container").trigger("click"):jQuery(a.target).is("[class*=mp-span]")&&jQuery(this).closest(".mp-row-video").children(".mp-video-container").trigger("click")});
function mpFixBackgroundVideoSize(a){"undefined"===typeof a&&(a=jQuery(".mp-video-container"));jQuery.each(a,function(d){mpFixVideoSize(a[d])})}function mpRememberOriginalSize(a){a.originalsize||(a.originalsize={width:a.width(),height:a.height()})}
function mpFixVideoSize(a){var d;jQuery(a).children().is("video")?d=jQuery(a).children():(d=jQuery(a).find("iframe"),d.length||(d=jQuery(a).find("img")));mpRememberOriginalSize(d);var e=jQuery(a).width(),c=jQuery(a).height(),e=mpScaleVideo(d.originalsize.width,d.originalsize.height,e,c);jQuery(a).find(".mp-youtube-container").height(e.height);jQuery(a).find(".mp-youtube-container").width(e.width);d.width(e.width);d.height(e.height);d.css("max-width",e.width);jQuery(d).css("left",e.targetleft);jQuery(d).css("top",
e.targettop)}function mpScaleVideo(a,d,e,c){var b={width:0,height:0,fScaleToTargetWidth:!0};if(0>=a||0>=d||0>=e||0>=c)return b;var f=a*c/d;f<=e?(b.width=Math.floor(e),b.height=Math.floor(d*e/a),b.fScaleToTargetWidth=!0):(b.width=Math.floor(f),b.height=Math.floor(c),b.fScaleToTargetWidth=!1);b.targetleft=Math.floor((e-b.width)/2);b.targettop=Math.floor((c-b.height)/2);return b}
(function(a){a(document).ready(function(){var d=parent.hasOwnProperty("MP")&&parent.MP.hasOwnProperty("Editor"),e="undefined"!==typeof a.fn.magnificPopup;!d&&e&&(a('[data-action="motopressLightbox"]').magnificPopup({type:"image",closeOnContentClick:!0,mainClass:"mfp-img-mobile",image:{verticalFit:!0}}),a('[data-action="motopressGalleryLightbox"]').magnificPopup({type:"image",mainClass:"mfp-img-mobile",gallery:{enabled:!0,navigateByImgClick:!0,preload:[0,1]}}),a('[data-action="motopress-modal"]').each(function(){var c=
a(this),b=c.attr("data-mfp-show-animation").length?" "+c.attr("data-mfp-show-animation"):"",d=c.attr("data-mfp-hide-animation").length?" "+c.attr("data-mfp-hide-animation"):"",e=""!==d?500:0,n=c.attr("data-modal-style"),h=" motopress-modal-"+c.attr("data-uniqid");c.magnificPopup({key:"motopress-modal-obj",mainClass:"motopress-modal"+h+" "+n,midClick:!0,closeBtnInside:!1,fixedBgPos:!0,removalDelay:e,closeMarkup:'<button title="%title%" class="motopress-modal-close"></button>',callbacks:{beforeOpen:function(){c.attr("disabled",
!0);if(b){var h=a(this.bgOverlay),d=a(this.wrap);h.add(d).addClass(b).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){a(this).removeClass(b)})}},beforeClose:function(){if(d){var b=a(this.bgOverlay),c=a(this.wrap);b.add(c).addClass(d).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){a(this).removeClass(d)})}},afterClose:function(){c.removeAttr("disabled")}}})}),"undefined"!==typeof a.fn.waypoint&&a(".motopress-popup-trigger").each(function(){var c=
a(this),b=c.attr("data-delay").length?parseInt(c.attr("data-delay")):0,d=c.attr("data-mfp-show-animation").length?" "+c.attr("data-mfp-show-animation"):"",e=c.attr("data-mfp-hide-animation").length?" "+c.attr("data-mfp-hide-animation"):"",n=""!==e?500:0,h=c.attr("data-modal-style"),k=c.attr("data-uniqid"),p=" motopress-modal-"+k,l=c.attr("data-custom-classes");c.waypoint(function(m){this.enabled=!1;clearTimeout(window.motopressPopupTimeout);window.motopressPopupTimeout=setTimeout(function(){c.magnificPopup({key:"motopress-popup-obj"+
k,mainClass:"motopress-modal "+h+" "+l+p,closeBtnInside:!1,fixedBgPos:!0,removalDelay:n,closeMarkup:'<button title="%title%" class="motopress-modal-close"></button>',items:{src:"#motopress-modal-content-"+k,type:"inline"},callbacks:{beforeOpen:function(){if(d){var b=a(this.bgOverlay),c=a(this.wrap);b.add(c).addClass(d).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){a(this).removeClass(d)})}},beforeClose:function(){if(e){var b=a(this.bgOverlay),c=a(this.wrap);
b.add(c).addClass(e).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){a(this).removeClass(e)})}},open:function(){if("undefined"!==typeof MPCECookies){var a=c.attr("data-show-once");"undefined"!==typeof a&&MPCECookies.set(a,"true")}}}}).magnificPopup("open");clearTimeout(window.motopressPopupTimeout)},b)},{offset:"100%",continuous:!1,group:"motopress-popups"})}))})})(jQuery);
jQuery(document).ready(function(){jQuery(window).resize(function(){this.mpGridGalleryResizeTimeout&&clearTimeout(this.mpGridGalleryResizeTimeout);this.mpGridGalleryResizeTimeout=setTimeout(function(){jQuery(this).trigger("mpGridGalleryResizeEnd")},500)});jQuery(window).on("mpGridGalleryResizeEnd",function(){mpRecalcGridGalleryMargins()})});
function mpRecalcGridGalleryMargins(a){"undefined"===typeof a&&(a=jQuery(".motopress-grid-gallery-obj.motopress-grid-gallery-need-recalc"));if(a.length){var d=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;a.each(function(a,c){var b="",f=jQuery(c).find(".mp-row-fluid").not(":first.mp-row-fluid");767<d&&(b=jQuery(jQuery(c).find('[class*="mp-span"]').get(1)).css("margin-left"));f.css("margin-top",b)})}}
jQuery(document).ready(function(){"undefined"!==typeof jQuery.fn.waypoint&&(jQuery(".motopress-cta.motopress-need-animate").waypoint({offset:"85%",handler:function(){this.enabled=!1;var a=jQuery(this.element).data("animation");jQuery(this.element).addClass("motopress-animation-"+a);jQuery(this.element).find("[data-animation]").each(function(){var a=jQuery(this).data("animation");jQuery(this).addClass("motopress-animation-"+a)})}}),jQuery(".motopress-ce-icon-obj.motopress-need-animate").waypoint(function(){this.enabled=
!1;var a=jQuery(this.element).attr("data-animation");jQuery(this.element).addClass("motopress-animation-"+a)},{offset:"98%"}))});
(function(a){a(".motopress-share-buttons a").click(function(){var d=a(this).attr("title"),e=null,c=encodeURIComponent(document.URL);"Facebook"===d?e="https://www.facebook.com/sharer/sharer.php?u=":"Twitter"===d?e="https://twitter.com/share?url=":"Google +"===d?e="https://plus.google.com/share?url=":"Pinterest"===d&&(e="//www.pinterest.com/pin/create/button/?url=");openWindow=window.open(e+c,d,"width=640,height=480,left="+(screen.width-640)/2+",top="+(screen.height-480)/2+",status=no,toolbar=no,menubar=no,resizable=yes");
return!1})})(jQuery);jQuery(document).ready(function(a){a(".motopress-google-map-obj").on("click",function(){a(this).find("iframe").addClass("mpce-clicked")}).on("mouseleave",function(){a(this).find("iframe").removeClass("mpce-clicked")})});
(function(){if("undefined"!==typeof google&&"undefined"!==typeof google.load){google.load("visualization","1");"1"===motopressGoogleChartsPHPData.motopressCE&&(google.motopressDrawChart=function(a){var b,f,g,n;0!==arguments.length&&(b=arguments[1]);f=jQuery(document.getElementById(a));g=jQuery.parseJSON(f.attr("data-chart"))||{};g.height=200;null!==b&&(g.height=b);b={};n=d(g.table);b.chartType=e(g.type);b.dataTable=!0===n?g.table:null;b.options={title:g.title,height:g.height,colors:g.colors};null!==
g.backgroundColor&&(b.options.backgroundColor={fill:"transparent"});"PieChart3D"==g.type&&(b.options.is3D=!0);0!=g.donut&&"false"!==g.donut&&(b.options.pieHole=.5);b.containerId=g.ID;null!==b.dataTable?(g=new google.visualization.ChartWrapper(b),g.draw(),f.addClass("motopress-google-chart-loaded")):f.toggleClass("motopress-empty-chart").text("No Data")});var a=function(){jQuery(".motopress-google-chart").each(function(){var a=jQuery(this),b=jQuery.parseJSON(a.attr("data-chart"))||{},f,g;"0"===motopressGoogleChartsPHPData.motopressCE?
(f=a.parent(),f=f.attr("style"),void 0!==f?(f=f.split("min-height:"),f=f[1].split("px;"),b.height=Number(f[0])):b.height=200):"1"===motopressGoogleChartsPHPData.motopressCE&&(b.height=a.parent().parent().height(),100>b.height&&(b.height=200));f={};g=d(b.table);f.chartType=e(b.type);f.dataTable=!0===g?b.table:null;f.options={title:b.title,height:b.height,colors:b.colors};null!==b.backgroundColor&&(f.options.backgroundColor={fill:"transparent"});"PieChart3D"==b.type&&(f.options.is3D=!0);0!=b.donut&&
"false"!==b.donut&&(f.options.pieHole=.5);f.containerId=b.ID;null!==f.dataTable?(b=new google.visualization.ChartWrapper(f),b.draw(),a.addClass("motopress-google-chart-loaded")):a.addClass("motopress-empty-chart").text("No Data")})},d=function(a){var b=null;if(a){for(i=0;i<a.length;i++)if(b=a[0].length,1===a.length&&null===a[0][0]||b!=a[i].length)return!1;return!0}return!1},e=function(a){"PieChart3D"==a&&(a="PieChart");return a};google.setOnLoadCallback(a);"0"===motopressGoogleChartsPHPData.motopressCE&&
jQuery(document).ready(function(){var c;jQuery(window).resize(function(b){c&&clearTimeout(c);c=setTimeout(a,100)})});"1"===motopressGoogleChartsPHPData.motopressCE&&jQuery(document).ready(function(){var c;jQuery(document).on("resize",".motopress-content-wrapper .ui-resizable",function(a){var d=jQuery(this).find(".motopress-google-chart").attr("id");if(void 0!==d){var e=jQuery(this).find(".motopress-drag-handle").height();c&&clearTimeout(c);c=setTimeout(function(){google.motopressDrawChart(d,e)},100)}});
jQuery(document).on("dragstop",".motopress-content-wrapper .motopress-splitter",function(a){a=jQuery(this).parent().parent().parent().find(".motopress-google-chart");0!==a.length&&a.each(function(){var a=jQuery(this).attr("id");google.motopressDrawChart(a)})});jQuery(window).on("resize",function(){jQuery(".motopress-google-chart").length&&(c&&clearTimeout(c),c=setTimeout(a,100))})})}})();
(function(a){a(function(){function d(b){var c;b=b.children(".motopress-filter").find(".motopress-active-filter");b.length?(c={},b.each(function(){var b=a(this).closest(".motopress-filter-group").attr("data-group"),d=a(this).attr("data-filter");c[b]=""!==d?[d]:[]})):c=!1;return c}function e(c,d){var e=c.attr("data-shortcode-attrs"),f=c.attr("data-post-id");a.post(MPCEPostsGrid.admin_ajax,{action:"motopress_ce_posts_grid_filter",nonce:MPCEPostsGrid.nonces.motopress_ce_posts_grid_filter,shortcode_attrs:e,
filters:d,post_id:f,page_has_presets:0!==a("#motopress-ce-presets-styles").length},function(d){if(d.success){var e=a(d.data.items),f=a(d.data.load_more),k=a(d.data.pagination);c.children(":not(.motopress-filter)").remove().end().append(e,f,k);d.hasOwnProperty("custom_styles")&&b(d.custom_styles)}})}function c(c,d,e){var f=c.attr("data-shortcode-attrs"),g=c.attr("data-post-id");a.post(MPCEPostsGrid.admin_ajax,{action:"motopress_ce_posts_grid_load_more",nonce:MPCEPostsGrid.nonces.motopress_ce_posts_grid_load_more,
shortcode_attrs:f,filters:e,page:d,post_id:g,page_has_presets:0!==a("#motopress-ce-presets-styles").length},function(d){if(d.success){var e=c.children(".motopress-paged-content"),f=parseInt(e.attr("data-columns")),k=d.data.items,g=a(d.data.load_more);c.children(":not(.motopress-filter, .motopress-paged-content)").remove();for(var l=e.children(".motopress-filter-row:last"),m=l.children(".motopress-filter-col").length;m<f;m++)k.length&&l.append(k.shift());var p=l.clone().empty();a.each(k,function(b,
d){p.append(a(d));if(0===(b+1)%f||k.length===b+1)e.append(p.clone()),p.empty()});d.hasOwnProperty("custom_styles")&&b(d.custom_styles);e.after(g)}})}function b(b){var d=a("#motopress-ce-private-styles");if(b.hasOwnProperty("private")){var c=""!==d.attr("data-posts")?d.attr("data-posts").split(","):[];a.each(c,function(a){delete b["private"][a]});var e=d.text();a.each(b["private"],function(a,b){e+=b;c.push(a)});d.text(e);d.attr("data-posts",c.join(","))}b.hasOwnProperty("presets")&&!a("#motopress-ce-presets-styles").length&&
d.before(b.presets)}function f(d,c,e){var f=d.attr("data-shortcode-attrs"),g=d.attr("data-post-id");a.post(MPCEPostsGrid.admin_ajax,{action:"motopress_ce_posts_grid_turn_page",nonce:MPCEPostsGrid.nonces.motopress_ce_posts_grid_turn_page,shortcode_attrs:f,filters:e,page:c,post_id:g,page_has_presets:0!==a("#motopress-ce-presets-styles").length},function(c){if(c.success){var e=a(c.data.items),f=a(c.data.pagination);d.children(":not(.motopress-filter)").remove().end().append(e,f);c.data.hasOwnProperty("custom_styles")&&
b(c.data.custom_styles)}})}function g(a){a.addClass("ui-state-loading")}var n=a(".motopress-posts-grid-obj");n.on("click",".motopress-filter [data-filter]:not(.motopress-active-filter)",function(b){b.preventDefault();b.stopPropagation();b=a(this).closest(".motopress-posts-grid-obj");var c=a(this).closest(".motopress-filter-group");g(b.children(".motopress-paged-content"));c.find(".ui-state-active").removeClass("ui-state-active motopress-active-filter");a(this).addClass("ui-state-active motopress-active-filter");
b.find(".motopress-filter");c=d(b);e(b,c)});n.on("click",".motopress-posts-grid-pagination a[data-page]",function(b){b.preventDefault();b.stopPropagation();g(a(this).parent());b=a(this).closest(".motopress-posts-grid-obj");var c=a(this).attr("data-page"),e=d(b);f(b,c,e)});n.on("click",".motopress-load-more",function(b){b.preventDefault();b.stopPropagation();b=a(this).closest(".motopress-posts-grid-obj");var e=a(this).attr("data-page"),f=d(b);g(a(this).parent());c(b,e,f)})})})(jQuery);
