(function(b){b(document).ready(function(){b('[rel="motopressLightbox"]').magnificPopup({type:"image",closeOnContentClick:!0,mainClass:"mfp-img-mobile",image:{verticalFit:!0}});b('[rel="motopressGalleryLightbox"]').magnificPopup({type:"image",mainClass:"mfp-img-mobile",gallery:{enabled:!0,navigateByImgClick:!0,preload:[0,1]}});b('[rel="motopress-modal"]').each(function(){var a=b(this),e=a.attr("data-mfp-show-animation").length?" "+a.attr("data-mfp-show-animation"):"",c=a.attr("data-mfp-hide-animation").length?
" "+a.attr("data-mfp-hide-animation"):"",d=""!==c?500:0,f=a.attr("data-modal-style"),g=" motopress-modal-"+a.attr("data-uniqid");a.magnificPopup({key:"motopress-modal-obj",mainClass:"motopress-modal"+g+" "+f,midClick:!0,closeBtnInside:!1,removalDelay:d,closeMarkup:'<button title="%title%" class="motopress-modal-close"></button>',callbacks:{beforeOpen:function(){a.attr("disabled",!0);if(e){var c=b(this.bgOverlay),d=b(this.wrap);c.add(d).addClass(e).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",
function(){b(this).removeClass(e)})}},beforeClose:function(){if(c){var a=b(this.bgOverlay),d=b(this.wrap);a.add(d).addClass(c).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){b(this).removeClass(c)})}},afterClose:function(){a.removeAttr("disabled")}}})});b(".motopress-popup-trigger").each(function(){var a=b(this),e=a.attr("data-delay").length?parseInt(a.attr("data-delay")):0,c=a.attr("data-mfp-show-animation").length?" "+a.attr("data-mfp-show-animation"):
"",d=a.attr("data-mfp-hide-animation").length?" "+a.attr("data-mfp-hide-animation"):"",f=""!==d?500:0,g=a.attr("data-modal-style"),h=a.attr("data-uniqid"),k=" motopress-modal-"+h,l=a.attr("data-custom-classes");a.waypoint(function(m){this.enabled=!1;clearTimeout(window.motopressPopupTimeout);window.motopressPopupTimeout=setTimeout(function(){a.magnificPopup({key:"motopress-popup-obj"+h,mainClass:"motopress-modal "+g+" "+l+k,closeBtnInside:!1,removalDelay:f,closeMarkup:'<button title="%title%" class="motopress-modal-close"></button>',
items:{src:"#motopress-modal-content-"+h,type:"inline"},callbacks:{beforeOpen:function(){if(c){var a=b(this.bgOverlay),d=b(this.wrap);a.add(d).addClass(c).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){b(this).removeClass(c)})}},beforeClose:function(){if(d){var a=b(this.bgOverlay),c=b(this.wrap);a.add(c).addClass(d).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){b(this).removeClass(d)})}}}}).magnificPopup("open");
clearTimeout(window.motopressPopupTimeout)},e)},{offset:"100%",continuous:!1,group:"motopress-popups"})})})})(jQuery);
