let init_num=0,charge_num=0;function ttgallery_single_reinit(t,e){charge_num++,setTimeout(function(){1==charge_num&&(jQuery(t+" .tthg_loaded").addClass("tthg_img_loaded"),ttgallery_single(t,e)),charge_num--},1e3)}function ttgallery_single(t,e={}){let o=jQuery;if(!o(t).length)return!1;o(t).each(function(){init_num++;let a,n,i,s,l,r,d,c,u,f,_,h,g,p,m,v,y,w,C,b,x,k,T,z,A,j,Q,E,I,W,M,L,O,X,Y,D,P,q,B,F,G,H,J,K,N=o(this),R=0,S=0,U=0,V=100,Z=0,$=0,tt=0,et=0,ot=[],at=0,nt=0,it=0,st=document.body.clientWidth,lt=0;function rt(t,o){return"true"===e[t]&&(e[t]=1),"false"===e[t]&&(e[t]=0),null!=e[t]?e[t]:o}function dt(){z=1,A=1,j=0,Q=0,E=0,I=0,W=rt("dinamic",0),M=rt("true_dinamic",0),L=rt("force",0),O=rt("dots",1),X=rt("arrows",1),Y=rt("fade",0),D=0,P=rt("is_slider",1),q=rt("lazy",0),B=rt("lazy_attr","data-lazy"),F=rt("speed",300),G=rt("autoplay",0),H=rt("delay",5e3),J=rt("stop_on_hover",1),K=0,H<F&&(H=F)}function ct(){if(e.responsive){let t=0;(v=Object.keys(e.responsive).map(function(t){return{value:t}})).sort(function(t,e){return parseInt(t.value,10)-parseInt(e.value,10)});let a=o(window).width();for(let e=v.length-1;e>-1;e--)v[e].value>=a&&(t=v[e].value);return t}return 0}function ut(t,o,a){return t&&null!=e.responsive[t][o]?e.responsive[t][o]:null!=e[o]?e[o]:a}function ft(t){A=ut(t,"slide_to_view",1),(z=ut(t,"slide_to_scroll",1))>A&&(z=A),j=ut(t,"loop",0),Q=ut(t,"margin",0),E=ut(t,"vertical",0),I=ut(t,"vertical_height",0),W=ut(t,"dinamic",0),M=ut(t,"true_dinamic",0),L=ut(t,"force",0),O=ut(t,"dots",1),X=ut(t,"arrows",1),Y=ut(t,"fade",0),D=ut(t,"group_dots",1),!O||U<A+1?g.hide():g.css("display","flex"),P=ut(t,"is_slider",1),!(X=N.is(".arrows_enable")?1:0)||U<=z||U<=A?(p.hide(),m.hide()):(p.removeAttr("style"),m.removeAttr("style"))}function _t(){k=setInterval(function(){nt&&J||mt(1)},H)}function ht(){clearInterval(k),_t()}function gt(t="",e=0){U=0,Z=0,$=0,(c=N).height(c.height()),t&&c.html(t.html()),o(">div",N).addClass("tthg_one").each(function(){o(this).attr("data-count",U),U++}),c.addClass("tthg_inited"),c.next().is(".tthgpager_cont")||c.after('<div class="tthgpager_cont"><div class="tthgpager"></div></div><span class="tthg_prev"></span><span class="tthg_next"></span>'),t||c.removeAttr("style"),u=c,f=o(".tthg_one",c),h=o(".tthgpager",c.parent()),g=o(".tthgpager_cont",c.parent()),p=o(".tthg_prev",c.parent()),m=o(".tthg_next",c.parent()),u.attr("data-total",U),ft(ct()),P&&(c.addClass("tt_hover_gallery"),o('.tthg_one[data-count="'+e+'"]',u).addClass("active"),b=o('.tthg_one[data-count="'+(S+1==U?0:S+1)+'"]',u),x=o('.tthg_one[data-count="'+(S-1<0?U-1:S-1)+'"]',u),at=-e*V-Q*S,pt(),S=e,function(){let t=o(window).scrollTop(),e=N.offset().top,a=o(window).height(),n=N.height();e>t+a||e<t-n||wt()}(),G&&_t(),t&&c.removeAttr("style"),N.removeClass("tt_product_slide_show_on")),function(t=0){h.html("");let e=U;t>e-1&&(t=e-1,S=e-1,_=e-1);for(var o=0;o<e;o++)h.append('<span class="'+(o!=t?"":"active")+" "+(o%z!=0&&D&&!W&&o+1!=e?"gal_disabled":"")+'" data-id="'+o+'"></span>');y=h.html()}(e),xt(e),P||(N.is(".arrows_enable")&&o('.tthg_one[data-count="'+e+'"]',u).addClass("active"),N.addClass("tt_product_slide_show_on"),c.on("mouseover",".tthg_one",function(){N.is(".arrows_enable")||xt(o(this).attr("data-count"))})),lt=1}function pt(t=T){o('[data-count="'+S+'"]',u).length&&(o('[data-count="'+S+'"]',u)[0].style.left=at*t+"px",x[0].style.left=U>1?"calc("+at*t+"px - 100%)":0,b[0].style.left=U>1?"calc("+at*t+"px + 100%)":0)}function mt(t){ot.push(t),vt(),G&&ht()}function vt(){ot.length&&!tt&&(U>A&&(it++,ot[0]*ot[0]?bt(ot[0]):(0===ot[0].indexOf("p")&&Tt(ot[0].slice(1)),0===ot[0].indexOf("f")&&bt(parseInt(ot[0].slice(1)),0),0===ot[0].indexOf("c")&&(tt++,zt(1)))),ot.shift())}function yt(){return S%U>-1?S%U:U+S%U}function wt(t=null,e=null){q&&(null!=e&&o('[data-count="'+e+'"] img['+B+"]:not(.tthg_loaded)",u).each(function(){o(this).attr("src",o(this).attr(B)).addClass("tthg_loaded")}),null!=t&&o('[data-count="'+t+'"] img['+B+"]:not(.tthg_loaded)",u).each(function(){o(this).attr("src",o(this).attr(B)).addClass("tthg_loaded")}),t=yt(),o('[data-count="'+t+'"] img['+B+"]:not(.tthg_loaded)",u).each(function(){o(this).attr("src",o(this).attr(B)).addClass("tthg_loaded")}))}function Ct(t,e){o(">.active",u).removeClass("active"),o('[data-count="'+e+'"]',u).addClass("active"),wt(e,t),N.trigger("beforeAnim",[t,e])}function bt(t,e=1){tt++,u.addClass("animated");let o=yt();(S+=e?t*z:t)<0&&(S=U-1),S>U-A&&(S=0),Ct(o,yt()),zt(o,t)}function xt(t){t<0&&(t+=U);let e=o('[data-id="'+t+'"]',h);o(".active",h).removeClass("active"),o(".vis_active",h).removeClass("vis_active"),e.addClass("active"),e.is(".gal_disabled")&&o('[data-id="'+(t-t%z)+'"]',h).addClass("vis_active"),W&&!j||W&&j&&!M?(h.addClass("tt_dinamic"),o("[data-to]",h).removeAttr("data-to"),o(".active",h).removeClass("active"),e.addClass("active"),e.prev().attr("data-to",-1).prev().attr("data-to",-2),e.next().attr("data-to",1).next().attr("data-to",2),h.css("transform","translate3d("+32*(U-t-(U+1)/2)*T+"px,0,0")):(h.removeClass("tt_dinamic"),W||h.removeAttr("style"))}function kt(){var t;tt||(u.removeClass("animated"),f.css("transition","left 0s ease-out"),setTimeout(function(){vt()},50)),t=yt(),o(">.active",u).removeClass("active"),o('[data-count="'+t+'"]',u).addClass("active"),f.css("transition","left 0s ease-out"),b=o('[data-count="'+(t+1==U?0:t+1)+'"]',u),(x=o('[data-count="'+(t-1<0?U-1:t-1)+'"]',u))[0].style.left="-100%",b[0].style.left="100%",N.trigger("afterAnimhg",[t])}function Tt(t,e=F){let a=yt(),n=parseInt(o(".active",h).attr("data-id"));_+=t-n,S+=t-n,xt(t),at=j&&U>A?-_*V-Q*_:-S*V-Q*S,Ct(a,yt()),Y?(f.css("transition","opacity "+e/2+"ms linear"),f.css("opacity",0),setTimeout(function(){f.css("opacity",1),pt(),kt()},e/2)):(f.css("transition","left "+e+"ms ease-out"),pt(),setTimeout(function(){f.css("transition","left 0ms ease-out"),kt()},e))}function zt(t=S,e){at=-S*V-Q*S,et=1,xt(S%U<0?U+S%U:S%U),U>2&&(o('[data-count="'+S+'"]',u)[0].style.transition="left "+(L?F/ot.length:F)+"ms ease-out"),o('[data-count="'+S+'"]',u)[0].style.left="0px",x=o('[data-count="'+(S-1<0?U-1:S-1)+'"]',u),b=o('[data-count="'+(S+1==U?0:S+1)+'"]',u),e>0&&(U>2&&(x[0].style.transition="left "+(L?F/ot.length:F)+"ms ease-out"),x[0].style.left="-100%"),e<0&&(U>2&&(b[0].style.transition="left "+(L?F/ot.length:F)+"ms ease-out"),b[0].style.left="100%"),setTimeout(function(){tt--,kt()},L?F/ot.length:F)}dt(),"rtl"==o("body").attr("dir")||o("html").attr("dir"),T=1,X=N.is(".arrows_enable")?1:0,o("img",N).on("load",function(){o(this).addClass("tthg_img_loaded"),setTimeout(function(){N.addClass("tthg_bgr")},1e3)});let At=N.parents("a"),jt=1;function Qt(){if(!lt||!N.is(".tthg_inited")){let t=o(window).scrollTop(),e=N.offset(),a=e.top,n=e.left,i=o(window).height(),s=o(window).width(),l=N.height(),r=N.width();a>0&&n>-1&&n<s&&!(a>t+i||a<t-l)&&(N.is(".show_small_1")||N.is(".show_small_0")&&r>200)&&(N.removeClass("tthg_bgr"),gt(),P&&setTimeout(function(){wt(S+1==U?0:S+1,S-1<0?U-1:S-1)},100))}document.contains(N[0])||(N.trigger("decompose"),window.removeEventListener("scroll",Qt,{passive:!0}),N.replaceWith(""),ttgallery_single_reinit(t,e))}if(At.length&&(At.on("click",function(){if(!jt)return!1}),At.on("dragstart",function(t){return!1})),o(window).resize(function(){if(lt){let t=document.body.clientWidth;st!=t&&(ft(ct()),st=t)}}),N.parent().on("click",".tthg_next",function(t){mt(1*T),jt=0,setTimeout(function(){jt=1},300)}),N.parent().on("click",".tthg_prev",function(t){mt(-1*T),jt=0,setTimeout(function(){jt=1},300)}),N.off("mousedown touchstart").on("mousedown touchstart",function(t){if(lt&&P&&!X){if(3==t.which)return!1;U>A&&(R=1),tt||(it=0);let e=void 0!==t.originalEvent?t.originalEvent.touches:null;r=void 0!==e?e[0].pageX:t.clientX,d=void 0!==e?e[0].pageY:t.clientY,s=Math.round(u.offset().left-u.parent().offset().left),l=Math.round(u.offset().top-u.parent().offset().top),a=r,n=d,w=0,C=0,wt(S+1==U?0:S+1,S-1<0?U-1:S-1),N.addClass("touch_init"),jt=1}}),N.off("mouseup touchend touchcancel mouseleave").on("mouseup touchend touchcancel mouseleave",function(t){lt&&R&&(R=0,Math.abs(a-r)?(i=a-r>0?-1:1,Math.abs(a-r)>(L?50/(1+ot.length):50)&&U>z?mt(i*T):mt("c"),jt=0):u.removeClass("animated"))}),N.off("mousemove touchmove").on("mousemove touchmove",function(t){if(lt){let e=void 0!==t.originalEvent?t.originalEvent.touches:null;if(R&&(a=void 0!==e?e[0].pageX:t.clientX,n=void 0!==e?e[0].pageY:t.clientY,C>50&&C>w?C++:w>50&&w>C?w++:Math.abs(r-a)>Math.abs(d-n)?C++:w++,u.is(".animated")||u.addClass("animated"),tt||it||Y||C>w&&(at=s-r+a,pt(1)),C>w&&!E))return t.preventDefault(),!1}}),N.off("click",".tthgpager>span").on("click",".tthgpager>span",function(t){ot=[],mt("p"+o(this).attr("data-id"))}),window.addEventListener("scroll",Qt,{passive:!0}),N.off("mouseover").on("mouseover",function(){if(nt=1,P){let t=S+1==U?0:S+1,e=S-1<0?U-1:S-1;N.removeClass("tt_product_slide_show_on"),wt(t,e)}else N.addClass("tt_product_slide_show_on"),q&&o("img["+B+"]:not(.tthg_loaded)",N).each(function(){o(this).attr("src",o(this).attr(B)).addClass("tthg_loaded")})}),N.off("mouseout").on("mouseout",function(){nt=0}),N.parents(".tt_inited").length){let o=N.parents(".tt_inited");o.on("afterAnim",function(){Qt()}),o.on("destroyed",function(){N.trigger("decompose"),window.removeEventListener("scroll",Qt,{passive:!0}),N.replaceWith(""),ttgallery_single_reinit(t,e)})}Qt(),N.on("addslide",function(t,e,o=""){e&&tt_add_item(e,o)}),N.on("removeslide",function(t,e){tt_remove_item(e)}),N.on("slideto",function(t,e,o){U>A&&Tt(e,o)}),N.on("next",function(t,e=0){let o=E?1:1*T;mt(e?"f"+o:o)}),N.on("prev",function(t,e=0){let o=E?-1:-1*T;mt(e?"f"+o:o)}),N.on("options",function(t,o){e=o,dt(),clearInterval(k),G&&ht(),ft(ct())}),N.on("decompose",function(t){N.off("mousemove touchmove").off("click",".tthgpager>span").off("mouseup touchend touchcancel mouseleave").off("mousedown touchstart").off("click",".tthg_next").off("click",".tthg_prev").off("addslide").off("removeslide").off("slideto").off("next").off("prev").off("options").off("mouseenter").off("mouseleave").removeClass("tthg_inited").find(".tthg_one").removeAttr("data-count").removeClass("tthg_one"),o(".tthgpager_cont",N.parent()).replaceWith(""),N.parent().off("click",".tthg_prev"),N.parent().off("click",".tthg_next"),o(".tthg_prev",N.parent()).replaceWith(""),o(".tthg_next",N.parent()).replaceWith(""),o(".tthg_loaded",N.parent()).addClass("tthg_img_loaded")}),N.on("dragstart","a",function(t){return!1})})}jQuery(document).ready(function(){let t=jQuery(".arrows_enable").length?1:0;ttgallery_single(".tt_product_slide_show_pics",{slide_to_view:1,slide_to_scroll:1,loop:0,speed:500,lazy:1,lazy_attr:"data-tthg",autoplay:0,delay:2e3,dinamic:0,true_dinamic:0,force:1,dots:1,arrows:1,stop_on_hover:1,is_slider:t,responsive:{1199:{is_slider:1}}}),jQuery("body").on("updateListPrice:init",function(){jQuery(".tt_product_slide_show_pics").trigger("decompose"),ttgallery_single(".tt_product_slide_show_pics",{slide_to_view:1,slide_to_scroll:1,loop:0,speed:500,lazy:1,lazy_attr:"data-tthg",autoplay:0,delay:2e3,dinamic:0,true_dinamic:0,force:1,dots:1,arrows:1,stop_on_hover:1,is_slider:t,responsive:{1199:{is_slider:1}}})}),jQuery("body").on("loadmore_update",function(){jQuery(".tt_product_slide_show_pics").trigger("decompose"),ttgallery_single(".tt_product_slide_show_pics",{slide_to_view:1,slide_to_scroll:1,loop:0,speed:500,lazy:1,lazy_attr:"data-tthg",autoplay:0,delay:2e3,dinamic:0,true_dinamic:0,force:1,dots:1,arrows:1,stop_on_hover:1,is_slider:t,responsive:{1199:{is_slider:1}}})})});
