/* NM: Single product script */ (function(b){b.extend(b.nmTheme,{singleProduct_init:function(){var a=this;a.$galleryContainer=b(".woocommerce-product-gallery");a.$galleryWrap=a.$galleryContainer.find(".woocommerce-product-gallery__wrapper");a.galleryThumbnailsSlider="0"!=nm_wp_vars.galleryThumbnailsSlider&&b(".nm-single-product").hasClass("thumbnails-vertical")?!0:!1;a.galleryData=a.$galleryContainer.data("flexslider");a.zoomEnabled=!a.isTouch&&b(".woocommerce-product-gallery").hasClass("zoom-enabled");a.singleProductVariations(); a.quantityInputsBindButtons(b(".summary"));"scrolling"==nm_wp_vars.productLayout&&a.singleProductPinSummary();a.singleProductGalleryInit();a.singleProductGalleryZoomInit();a.singleProductFeaturedVideoInit();var c=b("#nm-comment-form-rating");c.on("click.nmAddParentClass",".stars a",function(){c.children(".stars").addClass("has-active")});"0"!=nm_wp_vars.shopRedirectScroll&&(b("#nm-breadcrumb").find("a").bind("click.nmShopRedirect",function(c){c.preventDefault();a.singleProductRedirectWithHash(this)}), b("#nm-product-meta").find("a").bind("click.nmShopRedirect",function(c){c.preventDefault();a.singleProductRedirectWithHash(this)}))},singleProductPinSummary:function(){var a=this,c=b("#nm-summary-pin"),d=function(){c.pin({minWidth:1063,containerSelector:".nm-single-product-summary-col",padding:{top:c.offset().top+.1}})};a.$window.load(function(){d();var b=null;a.$window.bind("resize.nmProductDetailsPin",function(){b&&clearTimeout(b);b=setTimeout(function(){c.attr("style","").removeData("pin");d(); a.$window.trigger("scroll")},250)})})},singleProductGalleryInit:function(){"0"!=nm_wp_vars.galleryZoom&&b(".woocommerce-product-gallery").prepend('\ud83d\udd0d');var a=this;if(1'),a.$galleryThumbsWrap= b("#nm-product-gallery-thumbs-inner"));a.$window.load(function(){a.singleProductGallerySetHeight()});a.galleryData.vars.before=function(c){a.singleProductGallerySetHeight()};a.singleProductGalleryArrowsOffset();b(".flex-direction-nav").addClass("show");var c=null;a.$window.bind("resize.nmProductGallery",function(){c&&clearTimeout(c);c=setTimeout(function(){a.singleProductGallerySetHeight();a.singleProductGalleryArrowsOffset();b("#nm-variations-form").trigger("click")},250)})}},singleProductGallerySetHeight:function(){var a= this.galleryData.slides.eq(this.galleryData.animatingTo).height();this.$galleryWrap.css("height",a+"px");this.galleryThumbnailsSlider&&this.singleProductGalleryPositionThumbnail(a)},singleProductGalleryPositionThumbnail:function(a){this.$galleryThumbsContainer.css("height",a+"px");var c=this.$galleryThumbsWrap.children().eq(this.galleryData.animatingTo),b=Math.round(c.position().top),e=Math.round(b+c.height()),g=Math.abs(parseInt(this.$galleryThumbsWrap.css("top"))),f=null;50>=b-g?(a=c.prev(),a.length&& (b=Math.round(a.position().top)),f=b):e-g>=a-50&&(b=c.next(),b.length&&(e=Math.round(b.position().top+b.height())),f=e-a);null!==f&&this.$galleryThumbsWrap.css("top","-"+f+"px")},singleProductRedirectWithHash:function(a){a=b(a).attr("href");window.location.href=a+"#shop"},singleProductVariations:function(){var a=this,c=b("#nm-variations-form");a.singleProductVariationsInit(c);c.on("woocommerce_variation_select_change",function(){a.zoomEnabled&&a.singleProductZoomUpdateImage()})},singleProductGalleryArrowsOffset:function(){var a= b(".woocommerce-product-gallery"),c=a.children(".flex-direction-nav").find("a"),d=Math.ceil(a.outerHeight());a=Math.ceil(a.children(".woocommerce-product-gallery__wrapper").height());var e=c.first().outerHeight()/2;c.css("marginTop","-"+(e+(d>a?(d-a)/2:0))+"px")},singleProductGalleryZoomInit:function(){this.zoomEnabled&&this.$window.load(function(){b(".woocommerce-product-gallery__wrapper").children(".woocommerce-product-gallery__image").easyZoom()})},singleProductZoomUpdateImage:function(){var a= b(".woocommerce-product-gallery__wrapper").children(".woocommerce-product-gallery__image").first(),c=a.children("a").attr("href");c&&0', removalDelay:180,type:"iframe",closeOnContentClick:!0,closeBtnInside:!1};"0"==nm_wp_vars.shopYouTubeRelated&&(b.iframe={patterns:{youtube:{src:"//www.youtube.com/embed/%id%?rel=0&autoplay=1"}}});a.$featuredVideoBtn.magnificPopup(b).magnificPopup("open")}))}});b.nmThemeExtensions.singleProduct=b.nmTheme.singleProduct_init})(jQuery);