PageSourceSearch

https://montaleparfums.us/cdn/shop/t/24/assets/theme.min.js?v=182896589416841456351740746181

js montaleparfums.us collected 2026-09-29 23:28:04 UTC 149,122 bytes, 4,686 lines download raw bytes

1"use strict";
2
3var $document = $(document),
4    $window = $(window),
5    $body = $('body'),
6    $html = $('html'),
7    $ttPageContent = $('#tt-pageContent'),
8    $ttFooter = $('footer'),
9    $ttHeader = $('header'),
10    $ttLeftColumnAside = $ttPageContent.find('.leftColumn.aside'),
11    $ttFilterOptions = $ttPageContent.find('.tt-filters-options'),
12
13    /* menu setting*/
14    header_menu_timeout = 200,
15    header_menu_delay = 200,   
16
17    //header
18    $ttTopPanel = $('.tt-top-panel'),
19    //header stuck
20    $stucknav = $ttHeader.find('.tt-stuck-nav'),
21    //header menu
22    $ttDesctopMenu = $ttHeader.find('.tt-desctop-menu'),
23    $ttDesctopParentMenu = $ttHeader.find('.tt-desctop-parent-menu'),
24    $ttMobileParentMenu = $ttHeader.find('.tt-mobile-parent-menu'),
25    $ttMobileParentMenuChildren = $ttMobileParentMenu.children(),
26    $ttStuckParentMenu = $ttHeader.find('.tt-stuck-parent-menu'),
27    //header search
28    $ttSearchObj = $ttHeader.find('.tt-search'),
29    $ttDesctopParentSearch = $ttHeader.find('.tt-desctop-parent-search'),
30    $ttMobileParentSearch = $ttHeader.find('.tt-mobile-parent-search'),
31    $ttStuckParentSearch = $ttHeader.find('.tt-stuck-parent-search'),
32    //header cart
33    $ttcartObj = $ttHeader.find('.tt-cart'),
34    $ttDesctopParentCart = $ttHeader.find('.tt-desctop-parent-cart'),
35    $ttMobileParentCart = $ttHeader.find('.tt-mobile-parent-cart'),
36    $ttStuckParentCart = $ttHeader.find('.tt-stuck-parent-cart'),
37    //header account
38    $ttAccountObj = $ttHeader.find('.tt-account'),
39    $ttDesctopParentAccount = $ttHeader.find('.tt-desctop-parent-account'),
40    $ttMobileParentAccount = $ttHeader.find('.tt-mobile-parent-account'),
41    $ttStuckParentAccount = $ttHeader.find('.tt-stuck-parent-account'),
42    //header langue and currency(*all in one module)
43    $ttMultiObj = $ttHeader.find('.tt-multi-obj'),
44    $ttDesctopParentMulti = $ttHeader.find('.tt-desctop-parent-multi'),
45    $ttMobileParentMulti = $ttHeader.find('.tt-mobile-parent-multi'),
46    $ttStuckParentMulti = $ttHeader.find('.tt-stuck-parent-multi'),
47
48
49    // Template Blocks
50    blocks = {
51      ttCalendarDatepicker: $ttPageContent.find('.calendarDatepicker'),
52      ttSliderBlog: $ttPageContent.find('.tt-slider-blog'),
53      ttSlickMain: $ttPageContent.find('.tt-slick-main'),
54      ttSliderBlogSingle: $ttPageContent.find('.tt-slider-blog-single'),
55      ttVideoBlock: $('.tt-video-block'),
56      ttBlogMasonry: $ttPageContent.find('.tt-blog-masonry'),
57      ttPortfolioMasonry: $ttPageContent.find('.tt-portfolio-masonry'),
58      ttProductMasonry: $ttPageContent.find('.tt-product-listing-masonry'),
59      ttInputCounter: $('.tt-input-counter'),
60      ttCollapseBlock: $('.tt-collapse-block'),
61      modalVideoProduct: $('#modalVideoProduct'),
62      modalAddToCart: $('#modalAddToCartProduct'),
63      ttMobileProductSlider: $('.tt-mobile-product-slider'),
64      ttCollapse: $ttPageContent.find('.tt-collapse'),
65      ttProductListing: $ttPageContent.find('.tt-product-listing'),
66      ttBtnColumnClose: $ttLeftColumnAside.find('.tt-btn-col-close'),
67      ttBtnToggle: $ttFilterOptions.find('.tt-btn-toggle a'),
68      ttBtnAddProduct: $ttPageContent.find('.tt_product_showmore'),
69      ttProductItem: $ttPageContent.find('.tt-product, .tt-product-design02'),
70      ttProductDesign03: $ttPageContent.find('.tt-product-design03'),
71      ttProductDesign02: $ttPageContent.find('.tt-product-design02'),
72      ttProductDesign01: $ttPageContent.find('.tt-product'),
73      ttFilterDetachOption: $ttLeftColumnAside.find('.tt-filter-detach-option'),
74      ttFilterSort: $ttFilterOptions.find('.tt-sort'),
75      ttShopCart: $ttPageContent.find('.tt-shopcart-table, .tt-shopcart-table-02'),
76      ttSliderLookbook: $ttPageContent.find('.tt-slider-lookbook'),
77      ttPortfolioContent: $ttPageContent.find('.tt-portfolio-content'),
78      ttLookbook: $ttPageContent.find('.tt-lookbook'),
79      ttAirSticky: $ttPageContent.find('.airSticky'),
80      ttfooterMobileCollapse: $ttFooter.find('.tt-collapse-title'),
81      ttBackToTop: $('.tt-back-to-top'),
82      ttHeaderDropdown: $ttHeader.find('.tt-dropdown-obj'),
83      mobileMenuToggle: $('.tt-menu-toggle'),
84      ttCarouselProducts: $('.tt-carousel-products'),
85      ttItemsCategories: $ttPageContent.find('.tt-items-categories'),
86      ttDotsAbsolute: $ttPageContent.find('.tt-dots-absolute'),
87      ttAlignmentImg: $ttPageContent.find('.tt-alignment-img'),
88      ttProductSingleBtnZomm: $ttPageContent.find('.tt-product-single-img .tt-btn-zomm'),
89      ttRevolutionPromo: $ttPageContent.find('.tt-revolution-promo'),
90    };
91
92var ttwindowWidth = window.innerWidth || $window.width();
93
94
95if (blocks.ttRevolutionPromo.length) {
96  setTimeout(function(){
97    blocks.ttRevolutionPromo.fadeTo("90", 1);
98  }, 2300);
99  blocks.ttRevolutionPromo.on('click', '.tt-btn-close', function() {
100    $(this).closest('.tt-revolution-promo').hide();
101  });
102};
103
104if (blocks.ttItemsCategories.length) {
105  ttItemsCategories();
106};
107if (blocks.modalAddToCart.length) {
108  modalAddToCart();
109};
110// Mobile Menu
111if ($('.mainmenumob-js').length) {
112  $('.mainmenumob-js').initMM({
113    enable_breakpoint: true,
114    mobile_button: true,
115    breakpoint: 1025,
116    menu_class: 'mobile-main-menu',
117    close_button_name: b_close,
118    back_button_name: b_back
119  });
120};
121//header top panel
122if ($ttTopPanel.length) {
123  ttTopPanel();
124};
125// add product item
126if (blocks.ttBackToTop.length) {
127  ttBackToTop();
128};
129// Slide Column *listing-left-column.html
130if ($ttLeftColumnAside && blocks.ttBtnColumnClose && blocks.ttBtnToggle) {
131  ttToggleCol();
132};
133if (blocks.ttCollapse.length) {
134  ttCollapse();
135};
136//modal video on page product
137if (blocks.modalVideoProduct.length) {
138  ttVideoPopup();
139};
140//calendarDatepicker(blog)
141if (blocks.ttCalendarDatepicker.length) {
142  blocks.ttCalendarDatepicker.datepicker();
143};
144//video(blog listing)
145if (blocks.ttVideoBlock.length) {
146  ttVideoBlock();
147};
148// determination ie
149if (getInternetExplorerVersion() !== -1) {
150  $html.addClass("ie");
151};
152// inputCounter
153if (blocks.ttInputCounter.length) {
154  ttInputCounter();
155};
156// header
157initStuck();
158if ($ttDesctopParentSearch.length) {
159  mobileParentSearch();
160};
161if ($ttcartObj.length) {
162  mobileParentCart();
163};
164if ($ttDesctopParentAccount.length) {
165  mobileParentAccount();
166};
167if ($ttDesctopParentMulti.length) {
168  mobileParentMulti();
169};
170// product item Design01
171if (blocks.ttProductDesign01.length || $('.tt-product-single-info').length) {
172  ttProductHover();
173};
174// product item Design03
175if (blocks.ttProductDesign03.length) {
176  productDesign03();
177}
178if (blocks.ttfooterMobileCollapse.length) {
179  ttFooterCollapse();
180};
181// lookbook.html
182if (blocks.ttLookbook.length) {
183  ttLookbook(ttwindowWidth);
184};
185// shopping_cart.html
186if (blocks.ttShopCart.length) {
187  ttShopCart(ttwindowWidth);
188};
189// carusel
190if (blocks.ttCarouselProducts.length) {
191  blocks.ttCarouselProducts.each( function() {
192    var slick = $(this),
193        item =  $(this).data('item');
194    slick.slick({
195      dots: false,
196      arrows: true,
197      infinite: true,
198      speed: 300,
199       slidesToShow: item || 4,
200       slidesToScroll: item || 4,
201      adaptiveHeight: true,
202      responsive: [{
203        breakpoint: 1025,
204        settings: {
205           slidesToShow: 3,
206           slidesToScroll: 3
207        }
208      },
209                   {
210                     breakpoint: 791,
211                     settings: {
212                       slidesToShow: 2,
213                  		slidesToScroll: 2
214                     }
215                   }]
216    });
217  });
218};
219// lookbook.html
220// slider
221if (blocks.ttSliderLookbook.length) {
222  blocks.ttSliderLookbook.slick({
223    dots: true,
224    arrows: true,
225    infinite: true,
226    speed: 300,
227    slidesToShow: 1,
228    adaptiveHeight: true
229  });
230};
231
232//blog listing slider
233$(document).ready(function(){
234  if (blocks.ttMobileProductSlider.length) {
235    if($(window).width() < 576){
236      initttMobileProductSlider();
237    }
238    else{
239      $(window).bind('resize.ttmobpr', initttMobileProductSlider);
240    }
241  };
242  function initttMobileProductSlider(){
243    $(window).unbind('resize.ttmobpr');
244    blocks.ttMobileProductSlider.on('init', function(event, slick){
245      var event = new CustomEvent('mobile-slider-initialized', { 'detail': $(this) });
246      window.dispatchEvent(event);
247    });
248    var d = blocks.ttMobileProductSlider.attr('data-slickdots') == 'true' ? true : false;
249    blocks.ttMobileProductSlider.slick({
250      lazyLoad: 'progressive',
251      dots: d,
252      arrows: true,
253      infinite: false,
254      speed: 300,
255      slidesToShow: 1,
256      slidesToScroll: 1,
257      adaptiveHeight: true
258    });
259  }
260})
261//slick main (* index-14.html)
262if (blocks.ttSlickMain.length) {
263  blocks.ttSlickMain.slick({
264    dots: true,
265    arrows: true,
266    infinite: true,
267    speed: 300,
268    slidesToShow: 1,
269    adaptiveHeight: true,
270    responsive: [{
271      breakpoint: 1025,
272      settings: {
273        dots: false,
274      }
275    }]
276  });
277};
278//blog listing slider
279if (blocks.ttSliderBlog.length) {
280  blocks.ttSliderBlog.slick({
281    dots: false,
282    arrows: true,
283    infinite: true,
284    speed: 300,
285    slidesToShow: 1,
286    adaptiveHeight: true
287  });
288};
289//blog single post slider
290if (blocks.ttSliderBlogSingle.length) {
291  blocks.ttSliderBlogSingle.slick({
292    dots: false,
293    arrows: false,
294    infinite: true,
295    speed: 300,
296    slidesToShow: 1,
297    adaptiveHeight: true
298  });
299  //total slides
300  var ttSlickQuantity = $('.tt-slick-quantity');
301  if (ttSlickQuantity.length) {
302    ttSlickQuantity.find('.total').html(blocks.ttSliderBlogSingle.slick("getSlick").slideCount);
303    blocks.ttSliderBlogSingle.on('afterChange', function(event, slick, currentSlide){
304      var currentIndex = $('.slick-current').attr('data-slick-index');
305      currentIndex++;
306      ttSlickQuantity.find('.account-number').html(currentIndex);
307    });
308  };
309  //button
310  var ttSlickButton = $('.tt-slick-button');
311  if (ttSlickButton.length) {
312    ttSlickButton.find('.slick-next').click(function(){
313      blocks.ttSliderBlogSingle.slick('slickNext');
314    });
315    ttSlickButton.find('.slick-prev').click(function(){
316      blocks.ttSliderBlogSingle.slick('slickPrev');
317    });
318  };
319};
320
321
322
323
324// portfolio mobile click
325if (blocks.ttPortfolioContent.length && is_touch_device()) {
326  ttPortfolioContentMobile();
327};
328if (blocks.ttDotsAbsolute.length) {
329  ttSlickDots();
330};
331//sticky(product-05.html)
332if (blocks.ttAirSticky.length) {
333  ttAirSticky(ttwindowWidth);
334};
335// header - tt-dropdown-obj
336if (blocks.ttHeaderDropdown.length) {
337  ttHeaderDropdown();
338};
339
340// product single tt-btn-zomm(*magnific popup)
341if (blocks.ttProductSingleBtnZomm.length) {
342  ttProductSingleBtnZomm();
343};
344
345$window.on('load', function () {
346  var ttwindowWidth = window.innerWidth || $window.width();
347  if ($body.length) {
348    $body.addClass('loaded');
349  };
350  // filters options product(definition layout)
351  if ($ttFilterOptions.length) {
352    ttFilterLayout(ttwindowWidth);
353  };
354  if (blocks.ttProductItem.length) {
355    ttProductSmall(ttwindowWidth);
356  };
357  if (blocks.ttProductDesign02.length) {
358    ttOverflowProduct();
359  };
360  // centering arrow
361  if (blocks.ttAlignmentImg.length) {
362    alignmentArrowValue();
363  };
364  if (blocks.ttProductMasonry.length) {
365    gridProductMasonr();
366  };
367  if (blocks.ttBlogMasonry.length) {
368    gridGalleryMasonr();
369  };
370  if (blocks.ttPortfolioMasonry.length) {
371    gridPortfolioMasonr();
372    initPortfolioPopup();
373  };  
374});
375
376var ttCachedWidth = $window.width();
377$window.on('resize', function () {
378  var newWidth = $window.width();
379  if(newWidth !== ttCachedWidth){
380    ttCachedWidth = newWidth;
381
382
383    var ttwindowWidth = window.innerWidth || $window.width();
384
385    // shopping_cart.html
386    if (blocks.ttShopCart.length) {
387      ttShopCart(ttwindowWidth);
388    };
389    // filters options product(definition layout)
390    if ($ttFilterOptions.length) {
391      ttFilterLayout(ttwindowWidth);
392    };
393    if (blocks.ttProductItem.length) {
394      ttProductSmall();
395    };
396    if (blocks.ttProductDesign02.length) {
397      ttOverflowProduct();
398    };
399    // portfolio mobile click
400    if (blocks.ttPortfolioContent.length && is_touch_device()) {
401      ttPortfolioContentMobile();
402    };
403    //sticky(product-05.html)
404    if (blocks.ttAirSticky.length) {
405      ttAirSticky(ttwindowWidth);
406    };
407    if ($ttLeftColumnAside.hasClass('column-open') && $ttLeftColumnAside.length) {
408      $ttLeftColumnAside.find('.tt-btn-col-close a').trigger('click');
409    };
410
411    //header init stuck and detach
412    if ($ttDesctopParentSearch.length) {
413      mobileParentSearch();
414    };
415    if ($ttcartObj.length) {
416      mobileParentCart();
417    };
418    if ($ttDesctopParentAccount.length) {
419      mobileParentAccount();
420    };
421    if ($ttDesctopParentMulti.length) {
422      mobileParentMulti();
423    };
424    if (blocks.ttDotsAbsolute.length) {
425      ttSlickDots();
426    };
427    // centering arrow
428    if (blocks.ttAlignmentImg.length) {
429      alignmentArrowValue();
430    };
431  }
432});
433// Functions
434var cssFix = function() {
435  var u = navigator.userAgent.toLowerCase(),
436      is = function(t) {
437        return (u.indexOf(t) != -1)
438      };
439  $html.addClass([
440    (!(/opera|webtv/i.test(u)) && /msie (\d)/.test(u)) ? ('ie ie' + RegExp.$1) :
441    is('firefox/2') ? 'gecko ff2' :
442    is('firefox/3') ? 'gecko ff3' :
443    is('gecko/') ? 'gecko' :
444    is('opera/9') ? 'opera opera9' : /opera (\d)/.test(u) ? 'opera opera' + RegExp.$1 :
445    is('konqueror') ? 'konqueror' :
446    is('applewebkit/') ? 'webkit safari' :
447    is('mozilla/') ? 'gecko' : '',
448    (is('x11') || is('linux')) ? ' linux' :
449    is('mac') ? ' mac' :
450    is('win') ? ' win' : ''
451  ].join(''));
452}();
453
454function ttTopPanel(){
455  $ttTopPanel.on('click', function(e) {
456    e.preventDefault;
457    var target = e.target;
458    if ($('.tt-btn-close').is(target)){
459      $(this).slideUp(200);
460    };
461  });
462};
463
464//tabs init carusel
465$('a[data-toggle="tab"]').length && $('body').on('shown.bs.tab', 'a[data-toggle="tab"]', function (e) {
466  $('.slick-slider').each(function() {
467    $(this).slick("getSlick").refresh();
468  });
469  if (blocks.ttAlignmentImg.length) {
470    alignmentArrowValue();
471  };
472});
473$('.modal').on('shown.bs.modal', function (e) {
474  var objSlickSlider = $(this).find('.slick-slider');
475  if(objSlickSlider.length){
476    objSlickSlider.each(function() {
477      $(this).slick("getSlick").refresh();
478    });
479  };
480});
481function ttItemsCategories(){
482  blocks.ttItemsCategories.hover(function() {
483    $(this).toggleClass('active');
484  });
485};
486function ttHeaderDropdown(){
487  var dropdownPopup = $('.header-popup-bg');
488  if(!dropdownPopup.length){
489    $body.append('<div class="header-popup-bg"></div>');
490  };
491  $('header').on('click', '.tt-dropdown-obj', function(e) {
492    var ttwindowWidth = window.innerWidth || $window.width(),
493        $this = $(this),
494        target = e.target,
495        objSearch = $('.tt-search'),
496        objSearchInput = objSearch.find('.tt-search-input');
497
498    // search
499    if ($this.hasClass('tt-search') && $('.tt-dropdown-toggle').is(target)){
500      searchPopup();
501    };
502    function searchPopup(){
503      $('body').addClass('tt-open-search');
504      $this.addClass('active');
505      setTimeout(function(){objSearchInput.focus();}, 150)
506      return false;
507    };
508    if (objSearch.find('.tt-btn-close').is(target)){
509      objSearchClose();
510      return false;
511    };
512    function objSearchClose(){
513      $('body').removeClass('tt-open-search');
514      $this.removeClass('active');
515      objSearchInput.blur();
516      return false;
517    };
518
519    // cart, account, multi-ob
520    if (!$(this).hasClass('tt-search') && $('.tt-dropdown-toggle').is(target)){
521      ttwindowWidth <= 1024 ?  popupObjMobile($this) : popupObjDesctop($this);
522    };
523    function popupObjMobile(obj){
524      $('header').find('.tt-dropdown-obj.active').removeClass('active');
525      obj.toggleClass('activetoview');
526      setTimeout(function(){
527      obj.toggleClass('active').find('.tt-dropdown-menu').removeAttr("style");
528      $body.toggleClass('tt-popup-dropdown');
529      $('header .tt-cart .tt-dropdown-menu').perfectScrollbar().addClass('perfectScrollbar');/* cart * / */
530      }, 50)
531    };
532    function popupObjDesctop(obj){
533      var $this = obj,
534          target = e.target;
535
536      if ($this.hasClass('active')){
537        $this.toggleClass('active').find('.tt-dropdown-menu').slideToggle(200);
538        $this.find('.ps-container').removeAttr("style");/* cart * / */
539        return;
540      };
541      $('.tt-desktop-header .tt-dropdown-obj').each( function () {
542        var $this = $(this);
543        if($this.hasClass('active')){
544          $this.removeClass('active').find('.tt-dropdown-menu').css("display", "none");
545        }
546      });
547      if ($('.tt-dropdown-toggle').is(target)){
548        toggleDropdown($this);
549      };
550      if($this.hasClass('tt-cart')){/* cart * / */
551        $.fn.getRealDimensions = function (outer){
552          var $this = $(this);
553          if ($this.length == 0) {
554            return false;
555          }
556          var $clone = $this.clone()
557          .show()
558          .css('visibility','hidden')
559          .insertAfter($this);
560          var result = {
561            width:      (outer) ? $clone.outerWidth() : $clone.innerWidth(),
562            height:     (outer) ? $clone.outerHeight() : $clone.innerHeight(),
563            offsetTop:  $clone.offset().top,
564            offsetLeft: $clone.offset().left
565          };
566          $clone.remove();
567          return result;
568        };
569
570        var dimensions = $('.tt-cart-content').getRealDimensions().height,
571            viewportHeight = window.innerHeight,
572            cartPopup = dimensions + $('.tt-desktop-header').height(),
573            stuckNav = $('.tt-stuck-nav');
574
575        if(stuckNav.hasClass('stuck')){
576          var insertValue = viewportHeight - stuckNav.height();
577        } else{
578          var insertValue = viewportHeight - $('.tt-desktop-header').height();
579        };
580
581        if(viewportHeight <= cartPopup){
582          $('header .tt-dropdown-menu .tt-cart-layout').css({
583            'height' : insertValue  + 'px'
584          }).perfectScrollbar().addClass('perfectScrollbar');
585        };
586        $(window).resize(debouncer(function(e){
587          var ttCart = $('.tt-cart');
588          if(ttCart.hasClass('active')){
589            $('.tt-cart .tt-dropdown-toggle').trigger('click');
590          };
591        }));
592      }
593    };
594    function toggleDropdown(obj){
595      obj.toggleClass('active').find('.tt-dropdown-menu').slideToggle(200);
596    };
597
598    $(document).mouseup(function(e){
599      var ttwindowWidth = window.innerWidth || $window.width();
600
601      if (!$this.is(e.target) && $this.has(e.target).length === 0){
602        $this.each(function(){
603          if($this.hasClass('active') && $this.hasClass('tt-search')){
604            objSearch.find('.tt-btn-close').trigger('click');
605          };
606          if($this.hasClass('active') && !$this.hasClass('tt-search')){
607            if(ttwindowWidth <= 1024){
608              closeObjPopupMobile();
609            } else {
610              $('.tt-dropdown-obj').each( function () {
611                if($(this).hasClass('active')){
612                  $(this).removeClass('active').find('.tt-dropdown-menu').css("display", "none");
613                }
614              });
615            };
616          };
617        });
618      };
619      if ($this.find('.tt-mobile-add .tt-close').is(e.target)){
620        closeObjPopupMobile();
621      };
622    });
623    function closeObjPopupMobile(){
624      $('.tt-dropdown-obj.active').removeClass('active')
625      $('.tt-dropdown-obj.activetoview').length && setTimeout(function(){$('.tt-dropdown-obj.activetoview').removeClass('activetoview');}, 200)
626      $body.removeClass('tt-popup-dropdown');
627      return false;
628    };
629  });
630};
631
632// button back to top
633function ttBackToTop() {
634  blocks.ttBackToTop.on('click',  function(e) {
635    $('html, body').animate({
636      scrollTop: 0
637    }, 500);
638    return false;
639  });
640  $window.scroll(function() {
641    $window.scrollTop() > 500 ? blocks.ttBackToTop.stop(true.false).addClass('tt-show') : blocks.ttBackToTop.stop(true.false).removeClass('tt-show');
642  });
643};
644
645// modal Add ToCart(*close)
646function modalAddToCart() {
647  blocks.modalAddToCart.on('click', '.btn-close-popup',  function(e) {
648    $(this).closest('.modal-content').find('.modal-header .close').trigger('click');
649    return false;
650  });
651};
652
653// Mobile footer collapse
654function ttFooterCollapse() {
655  blocks.ttfooterMobileCollapse.on('click',  function(e) {
656    e.preventDefault;
657    $(this).toggleClass('tt-open');
658  });
659};
660
661//slick slider functional for dots
662function ttSlickDots() {
663  blocks.ttDotsAbsolute.each(function(){
664    var $this = $(this).find('.slick-dots');
665    if($this.is(':visible')){
666      var upperParent = $this.closest('[class ^= container]');
667      if (upperParent.length){
668        upperParent.css({'paddingBottom' : parseInt($this.height(), 10) + parseInt($this.css('marginTop'), 10)});
669      }
670    }
671  });
672};
673// product item Design01 hover (*desctope)
674function ttProductHover() {
675  $document.on('mouseenter mouseleave', '#tt-pageContent .tt-product', function(e) {
676    if($('.tt-product-listing').length && $('.tt-product-listing').hasClass("tt-col-one")) return false;
677
678    var $this = $(this),
679        windW = window.innerWidth,
680        objLiftUp01 = $this.find('.tt-description'),
681        objLiftUp02 = $this.find('.tt-product-inside-hover'),
682        objHeight02 = parseInt(objLiftUp02.height())+3,
683        objCountdown = $this.find('.tt-countdown_box'),
684        target = e.target;
685
686    if($this.hasClass('product-nohover')) return false;
687    
688    if (e.type === 'mouseenter' && windW > 1024) {
689      ttOnHover();
690    } else if (e.type === 'mouseleave' && e.relatedTarget && windW > 1024) {
691      ttOffHover();
692    };
693
694    function ttOnHover(e){
695      $this.stop().css({
696        height: $this.innerHeight()
697      }).addClass('hovered');
698      objLiftUp01.stop().animate({'top': '-' + objHeight02}, 200);
699      objLiftUp02.stop().animate({ 'opacity': 1 }, 400);
700      objCountdown.stop().animate({'bottom': objHeight02}, 200);
701      return false;
702    };
703    function ttOffHover(e){
704      $this.stop().removeClass('hovered').removeAttr('style');
705      objLiftUp01.stop().animate({'top': '0'}, 200, function(){$(this).removeAttr('style')});
706      objLiftUp02.stop().animate({ 'opacity': 0 }, 100, function(){$(this).removeAttr('style')});
707      objCountdown.stop().animate({'bottom': 0}, 200, function(){$(this).removeAttr('style')});
708      return false
709    };
710  });
711};
712
713// product item Design03
714function productDesign03() {
715  let $container = blocks.ttProductDesign03;
716  let sectionId = $container.data('section-id');
717  let productId = $container.data('product-id');
718
719  let $variantSelector = $('#group_' + sectionId);
720  
721  if (!$('#ProductJson-' + sectionId).html()) {
722    return;
723  }
724
725  let productJson = JSON.parse(
726    document.getElementById('ProductJson-' + sectionId).innerHTML
727  );
728
729  let currentVariant = productJson.variants.filter(function(variantItem) {
730    return variantItem.id == $variantSelector.val();
731  })[0] || {};
732
733  $('#group_' + sectionId).on('change', function(e) {
734    let variantId = $(e.target).val();
735    let variant = productJson.variants.filter(function(variantItem) {
736      return variantItem.id == variantId;
737    })[0];
738
739  if (typeof variant === "undefined") return;
740
741  variantSelected(variant);
742
743  });
744  
745  function variantSelected(variant) {
746    updatePrice(variant);
747    updateImage(variant);
748    updateAvailability(variant);
749    updateHistoryState(variant);
750    currentVariant = variant;
751  };
752
753  function updatePrice(variant) {
754    let $priceContainer = $('.product-price .product-detail-value', $container);
755
756    if (!$priceContainer.length) return;
757    
758    if (variant.compare_at_price > variant.price) {
759      let salePrice = $('<span class="sale-price">' + Shopify.formatMoney(variant.price, money_format) + '</span>');
760      let oldPrice = $('<span class="old-price">' + Shopify.formatMoney(variant.compare_at_price, money_format) + '</span>');
761
762      $priceContainer
763        .html([salePrice, oldPrice]);
764    } else {
765      let newPrice = $('<span class="new-price">' + Shopify.formatMoney(variant.price, money_format) + '</span>');
766
767      $priceContainer
768        .html(newPrice);
769    }
770    
771  };
772
773  function updateImage(variant) {
774    var variantImage = variant.featured_image || {};
775    var currentVariantImage = currentVariant.featured_image || {};
776
777    if (
778      !variant.featured_image ||
779      variantImage.src === currentVariantImage.src
780    ) {
781      return;
782    }
783    
784    let $productImages = $('[data-product-images]', $container);
785    let $productImage = $('[data-product-image]', $productImages);
786
787    let imageId = productId + '-' + variantImage.id;
788
789    $('[data-product-image][data-image-id="' + imageId + '"]', $productImages)
790      .show();
791    
792    $productImage.not('[data-image-id="' + imageId + '"]', $productImages)
793      .hide();
794    
795  };
796
797  function updateAvailability(variant) {
798    updateAddToCart(variant);
799    
800  };
801
802  function updateAddToCart(variant) {
803    console.log('here')
804    let $addToCart = $('[data-product-add-to-cart]', $container);
805    
806    if (variant) {
807        if (variant.available) {
808          var inventory_management = variant.inventory_management;
809          var inventory_quantity = String(global_quantity[variant.id]);
810          var iq = Number(inventory_quantity.split('continue').pop());
811
812          $addToCart
813            .prop('disabled', false)
814            .removeAttr('aria-disabled')
815            .removeClass('disable');
816          
817          if(inventory_management == null){
818            $addToCart
819              .html(addtocart_text);
820            
821          } else {
822            if(iq <= 0){
823              $addToCart
824                .html(preorderhtml_text);
825            }
826            else{
827              $addToCart
828                .html(addtocart_text);
829            }
830          }
831        } else {
832          // Variant is sold out, disable submit button and change the text.
833          $addToCart
834            .prop('disabled', true)
835            .attr('aria-disabled', true)
836            .addClass('disable')
837            .html(unavailable_text);
838        }
839      } else {
840        // The variant doesn't exist, disable submit button and change the text.
841        $addToCart
842          .prop('disabled', true)
843          .attr('aria-disabled', true)
844          .addClass('disable')
845          .html(unavailable_text);
846      }
847  };
848  
849  function updateHistoryState(variant) {
850    if (!variant) return;
851  
852    var newurl =
853      window.location.protocol +
854      '//' +
855      window.location.host +
856      window.location.pathname +
857      '?variant=' +
858      variant.id;
859    window.history.replaceState({ path: newurl }, '', newurl);
860  };
861  
862}
863
864// shopping_cart.html
865function ttShopCart(ttwindowWidth) {
866  var desctopQuantity = blocks.ttShopCart.find(".detach-quantity-desctope"),
867      mobileQuantity = blocks.ttShopCart.find(".detach-quantity-mobile");
868
869  ttwindowWidth <= 789 ?  insertDesctopeObj() : insertMobileObj();
870
871  function insertDesctopeObj(){
872    desctopQuantity.each(function(){
873      var objDesctope = $(this).find('.tt-input-counter').detach().get(0);
874      $(this).closest('tr').find('.detach-quantity-mobile').append(objDesctope);
875    })
876  };
877  function insertMobileObj(){
878    mobileQuantity.each(function(){
879      var objMobile = $(this).find('.tt-input-counter').detach().get(0);
880      $(this).closest('tr').find('.detach-quantity-desctope').append(objMobile);
881    })
882  };
883};
884
885// product Small
886function ttProductSmall(){
887  var currentW = parseInt(blocks.ttProductItem.width(), 10),
888      objProduct = $(".tt-product, .tt-product-design02");
889  currentW <= 210 ? objProduct.addClass("tt-small") : objProduct.removeClass("tt-small");
890};
891
892function debouncer(func, timeout) {
893  var timeoutID, timeout = timeout || 500;
894  return function() {
895    var scope = this,
896        args = arguments;
897    clearTimeout(timeoutID);
898    timeoutID = setTimeout(function() {
899      func.apply(scope, Array.prototype.slice.call(args));
900    }, timeout);
901  }
902};
903
904// centering arrow
905function alignmentArrowValue(){
906  if(!$ttPageContent.find('.tt-alignment-img').length) return false;
907    
908  var ttwindowWidth = window.innerWidth || $window.width();
909
910  if(ttwindowWidth > 1024){
911    setTimeout(function() {
912      $ttPageContent.find('.tt-alignment-img').each(function() {
913        $(this).find('.slick-arrow').removeAttr("style");
914      });
915    }, 225);
916  } else {
917    setTimeout(function() {
918      $ttPageContent.find('.tt-alignment-img').each(function() {
919        var ttObj = $(this),
920            $objParentArrow = ttObj.find('.slick-arrow');
921        if(ttObj.find('.tt-image-box').length == 0 || $objParentArrow.length == 0) return;
922        var $obj = ttObj.find('.tt-image-box').first();
923        $objParentArrow.css({
924          'top' : $obj.findHeight() - $objParentArrow.findHeight() - parseInt(ttObj.css('marginTop'), 10) + 'px'
925        });
926
927        ttObj.find('.tt-product').length && ttProductSmall();
928      });
929    }, 225);
930  };
931
932};
933$.fn.findHeight = function (){
934  var $blocks = $(this),
935      maxH    = $blocks.eq(0).innerHeight();
936
937  $blocks.each(function(){
938    maxH = ( $(this).innerHeight() > maxH ) ? $(this).innerHeight() : maxH;
939  });
940
941  return maxH/2;
942};
943// tt-hotspot
944function ttLookbook(ttwindowWidth){
945  //add lookbook popup
946  var objPopup = $('.tt-lookbook-popup');
947  if(!objPopup.length){
948    $body.append('<div class="tt-lookbook-popup"><div class="tt-lookbook-container"></div></div>');
949  };
950
951  var events = 'ontouchstart' in window ? "click" : "mouseenter";
952  blocks.ttLookbook.on(events, '.tt-hotspot' , function(e) {
953    $(this).hasClass('emptycontent') ? loadHotspotContent(this, e) : showMessage(this, e);
954  });
955  function loadHotspotContent(_this, e){
956    var $this = $(_this),
957        lurl = '/products/'+$(_this).attr('data-prhandle')+'?view=getproductlookbook';
958    $this.removeClass('emptycontent');
959    var params = {
960      type: "get",
961      url: lurl,
962      success: function(data) {
963        $this.find('.tt-content-parent').append(data);
964        setTimeout(showMessage(_this, e), 200);
965      }
966    };
967    jQuery.ajax(params);
968  }
969  function showMessage(_this, e){
970    var $this = $(_this),
971        target = e.target,
972        ttHotspot = $('.tt-hotspot'),
973        ttwindowWidth = window.innerWidth || $window.width(),
974        ttCenterBtn = $('.tt-btn').innerHeight() / 2,
975        ttWidthPopup = $('.tt-hotspot-content').innerWidth();
976
977
978    ttwindowWidth <= 789 ?  ttLookbookMobile($this) : ttLookbookDesktop($this);
979
980    //ttLookbookDesktop
981    function ttLookbookDesktop($this){
982
983      if ($this.hasClass('active')) return;
984
985      var objTop = $this.offset().top + ttCenterBtn,
986          objLeft = $this.offset().left,
987          objContent = $this.find('.tt-hotspot-content').detach();
988
989      //check if an open popup
990      var checkChildren = $('.tt-lookbook-container').children().size();
991      if(checkChildren > 0){
992        if(ttwindowWidth <= 789){
993          closePopupMobile();
994        } else {
995          closePopupDesctop();
996        };
997      }
998
999      //open popup
1000      popupOpenDesktop(objContent, objTop, objLeft);
1001
1002    };
1003    function popupOpenDesktop(objContent, objTop, objLeft){
1004      //check out viewport(left or right)
1005      var halfWidth =  ttwindowWidth / 2,
1006          objLeftFinal = 0;
1007
1008      if(halfWidth < objLeft){
1009        objLeftFinal = objLeft - ttWidthPopup - 7;
1010        popupShowLeft(objLeftFinal);
1011      } else{
1012        objLeftFinal = objLeft + 45;
1013        popupShowRight(objLeftFinal);
1014      };
1015
1016      $('.tt-lookbook-popup').find('.tt-lookbook-container').append(objContent);
1017      $this.addClass('active').siblings().removeClass('active');
1018
1019      function popupShowLeft(objLeftFinal){
1020        $('.tt-lookbook-popup').css({
1021          'top' : objTop,
1022          'left' : objLeftFinal,
1023          'display' : 'block'
1024        }, 300).animate({
1025          marginLeft: 26 + 'px',
1026          opacity: 1
1027        }, 300);
1028      };
1029      function popupShowRight(objLeftFinal){
1030        $('.tt-lookbook-popup').css({
1031          'top' : objTop,
1032          'left' : objLeftFinal,
1033          'display' : 'block'
1034        }).animate({
1035          marginLeft: -26 + 'px',
1036          opacity: 1
1037        });
1038      };
1039    };
1040    //ttLookbookMobile
1041    function ttLookbookMobile($this){
1042      var valueTop = $this.attr('data-top') + '%',
1043          valueLeft = $this.attr('data-left') + '%';
1044
1045      $this.find('.tt-btn').css({
1046        'top' : valueTop,
1047        'left' : valueLeft
1048      });
1049      $this.css({
1050        'top' : '0px',
1051        'left' : '0px',
1052        'width' : '100%',
1053        'height' : '100%'
1054      });
1055      $this.addClass('active').siblings().removeClass('active');
1056      $this.find('.tt-content-parent').fadeIn(200);
1057    };
1058    //Close mobile
1059    if(ttwindowWidth <= 789){
1060      if ($('.tt-btn-close').is(e.target)){
1061        e.preventDefault();
1062        closePopupMobile();
1063        return false;
1064      };
1065      if ($('.tt-hotspot').is(e.target)){
1066        closePopupMobile();
1067      };
1068      $(document).mouseup(function(e){
1069        if (!$('.tt-lookbook-popup').is(e.target) && $('.tt-lookbook-popup').has(e.target).length === 0 && !$('.tt-hotspot').is(e.target) && $('.tt-hotspot').has(e.target).length === 0){
1070          closePopupDesctop();
1071        };
1072      });
1073    };
1074    //Close desctope
1075    if(ttwindowWidth > 789){
1076      //ttLookbookClose
1077      $(document).mouseup(function(e){
1078        var ttwindowWidth = window.innerWidth || $window.width();
1079        if ($('.tt-btn-close').is(e.target)){
1080          closePopupDesctop();
1081          return false;
1082        };
1083        if (!$('.tt-lookbook-popup').is(e.target) && $('.tt-lookbook-popup').has(e.target).length === 0 && !$('.tt-hotspot').is(e.target) && $('.tt-hotspot').has(e.target).length === 0){
1084          closePopupDesctop();
1085        };
1086      });
1087    };
1088
1089    function closePopupDesctop(){
1090      //detach content popup
1091      var detachContentPopup = $('.tt-lookbook-popup').removeAttr("style").find('.tt-hotspot-content').detach();
1092      $('.tt-hotspot.active').removeClass('active').find('.tt-content-parent').append(detachContentPopup);
1093    };
1094    function closePopupMobile(){
1095      if($('.tt-lookbook-container').is(':has(div)')){
1096        var checkPopupContent = $('.tt-lookbook-container').find('.tt-hotspot-content').detach();
1097        $('.tt-hotspot.active').find('.tt-content-parent').append(checkPopupContent);
1098      };
1099      $('.tt-lookbook').find('.tt-hotspot.active').each(function(index) {
1100        var $this = $(this),
1101            valueTop = $this.attr('data-top') + '%',
1102            valueLeft = $this.attr('data-left') + '%';
1103
1104        $this.removeClass('active').removeAttr("style").css({
1105          'top' : valueTop,
1106          'left' : valueLeft,
1107        }).find('.tt-btn').removeAttr("style").next().removeAttr("style");
1108      });
1109    };
1110    function checkclosePopupMobile(){
1111      $('.tt-hotspot').find('.tt-content-parent').each(function() {
1112        var $this = $(this);
1113        if($this.css('display') == 'block'){
1114          var $thisParent = $this.closest('.tt-hotspot'),
1115              valueTop = $thisParent.attr('data-top') + '%',
1116              valueLeft = $thisParent.attr('data-left') + '%';
1117
1118          $this.removeAttr("style").prev().removeAttr("style");
1119          $thisParent.removeAttr("style").css({
1120            'top' : valueTop,
1121            'left' : valueLeft,
1122          });
1123        };
1124      });
1125    };
1126    $(window).resize(debouncer(function(e) {
1127      var ttwindowWidth = window.innerWidth || $window.width();
1128      if(ttwindowWidth <= 789){
1129        closePopupMobile();
1130      } else {
1131        closePopupDesctop();
1132        checkclosePopupMobile();
1133      };
1134    }));
1135    // return false;
1136  };
1137};
1138("undefined"==typeof eac||null===eac)&&$("body").empty();
1139// Overflow Product
1140function ttOverflowProduct(){
1141  blocks.ttProductDesign02.hover(function() {
1142    if($('.tt-product-listing').length && $('.tt-product-listing').hasClass("tt-col-one")) return false;
1143
1144    if (window.innerWidth < 1024) return;
1145    var objImgHeight = $(this).find('.tt-image-box').height(),
1146        objScroll = $(this).find('.tt-description'),
1147        objScrollHeight = objScroll.height() + 25;
1148
1149    if (objImgHeight > objScrollHeight) return;
1150    $(this).addClass('tt-small');
1151    objScroll.height(objImgHeight).perfectScrollbar();
1152
1153  }, function() {
1154    if (window.innerWidth < 1024) return;
1155    $(this).removeClass('tt-small').find('.tt-description').removeAttr('style').perfectScrollbar('destroy');
1156  });
1157};
1158function ttReinitflowProduct(){
1159  if (window.innerWidth < 1024 || $ttPageContent.find('.tt-product-design02').length == 0) return;
1160  $ttPageContent.find('.tt-product-design02').each(function() {
1161    $(this).perfectScrollbar('destroy');
1162    var objImgHeight = $(this).find('.tt-image-box').height(),
1163        objScroll = $(this).find('.tt-description'),
1164        objScrollHeight = objScroll.height() + 25;
1165
1166    if (objImgHeight > objScrollHeight) return;
1167    $(this).addClass('tt-small');
1168    objScroll.height(objImgHeight).perfectScrollbar();
1169  });
1170}
1171
1172// portfolio mobile click
1173function ttPortfolioContentMobile(){
1174  blocks.ttPortfolioContent.on('click', 'figure img', function() {
1175    $(this).closest(".tt-portfolio-content").find('figure').removeClass('gallery-click');
1176    $(this).closest("figure").addClass('gallery-click');
1177  });
1178};
1179
1180//toggle col (listing-left-column.html)
1181function ttToggleCol() {
1182  var $btnClose = $ttLeftColumnAside.find('.tt-btn-col-close a');
1183
1184  $('.tt-btn-toggle').on('click', function (e) {
1185    e.preventDefault();
1186    var ttScrollValue = $body.scrollTop() || $html.scrollTop();
1187    $ttLeftColumnAside.toggleClass('column-open');
1188    !$ttLeftColumnAside.find('.ttpricefilter-js').length && $ttLeftColumnAside.perfectScrollbar();
1189    $body.css("top", - ttScrollValue).addClass("no-scroll").append('<div class="modal-filter"></div>');
1190    var modalFilter = $('.modal-filter').fadeTo('fast',1);
1191    if (modalFilter.length) {
1192      modalFilter.click(function() {
1193        $btnClose.trigger('click');
1194      })
1195    }
1196    return false;
1197  });
1198  blocks.ttBtnColumnClose.on('click', function(e) {
1199    e.preventDefault();
1200    $ttLeftColumnAside.removeClass('column-open');
1201    !$ttLeftColumnAside.find('.ttpricefilter-js').length && $ttLeftColumnAside.perfectScrollbar('destroy');
1202    var top = parseInt($body.css("top").replace("px", ""), 10) * -1;
1203    $body.removeAttr("style").removeClass("no-scroll").scrollTop(top);
1204    $html.removeAttr("style").scrollTop(top);
1205    $(".modal-filter").unbind().remove();
1206  });
1207};
1208function getInternetExplorerVersion() {
1209  var rv = -1;
1210  if (navigator.appName === 'Microsoft Internet Explorer') {
1211    var ua = navigator.userAgent;
1212    var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
1213    if (re.exec(ua) != null)
1214      rv = parseFloat(RegExp.$1);
1215  } else if (navigator.appName === 'Netscape') {
1216    var ua = navigator.userAgent;
1217    var re = new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})");
1218    if (re.exec(ua) != null)
1219      rv = parseFloat(RegExp.$1);
1220  }
1221  return rv;
1222};
1223// identify touch device
1224function is_touch_device() {
1225  return !!('ontouchstart' in window) || !!('onmsgesturechange' in window);
1226};
1227if (is_touch_device()) {
1228  $body.addClass('touch-device');
1229  $html.addClass('touch-device');
1230};
1231if (/Edge/.test(navigator.userAgent)) {
1232  $html.addClass('edge');
1233};
1234//video
1235function ttVideoBlock() {
1236  $('.tt-video-block').on('click', function (e) {
1237    e.preventDefault();
1238    var myVideo = $(this).find('.movie')[0];
1239    if (myVideo.paused) {
1240      myVideo.play();
1241      $(this).addClass('play');
1242    } else {
1243      myVideo.pause();
1244      $(this).removeClass('play');
1245    }
1246  });
1247};
1248// Blog Masonr
1249function gridGalleryMasonr() {
1250  // init Isotope
1251  var $grid = blocks.ttBlogMasonry.find('.tt-blog-init').isotope({
1252    itemSelector: '.element-item',
1253    layoutMode: 'masonry',
1254  });
1255  // layout Isotope after each image loads
1256  $grid.imagesLoaded().progress( function() {
1257    $grid.isotope('layout').addClass('tt-show');
1258  });
1259  // filter functions
1260  var ttFilterNav =  blocks.ttBlogMasonry.find('.tt-filter-nav');
1261  if (ttFilterNav.length) {
1262    var filterFns = {
1263      ium: function() {
1264        var name = $(this).find('.name').text();
1265        return name.match(/ium$/);
1266      }
1267    };
1268    // bind filter button click
1269    ttFilterNav.on('click', '.button', function() {
1270      var filterValue = $(this).attr('data-filter');
1271      filterValue = filterFns[filterValue] || filterValue;
1272      $grid.isotope({
1273        filter: filterValue
1274      });
1275      $(this).addClass('active').siblings().removeClass('active');
1276    });
1277  };
1278};
1279// Product Masonr (listing-metro.html)
1280function gridProductMasonr() {
1281  // init Isotope
1282  var $grid = blocks.ttProductMasonry.find('.tt-product-init').isotope({
1283    itemSelector: '.element-item',
1284    layoutMode: 'masonry',
1285  });
1286  // layout Isotope after each image loads
1287  $grid.imagesLoaded().progress( function() {
1288    $grid.isotope('layout');
1289  });
1290  // filter functions
1291  var ttFilterNav =  blocks.ttProductMasonry.find('.tt-filter-nav');
1292  if (ttFilterNav.length) {
1293    var filterFns = {
1294      ium: function() {
1295        var name = $(this).find('.name').text();
1296        return name.match(/ium$/);
1297      }
1298    };
1299    // bind filter button click
1300    ttFilterNav.on('click', '.button', function() {
1301      var filterValue = $(this).attr('data-filter');
1302      filterValue = filterFns[filterValue] || filterValue;
1303      $grid.isotope({
1304        filter: filterValue
1305      });
1306      $(this).addClass('active').siblings().removeClass('active');
1307    });
1308  };
1309};
1310// collapseBlock(pages listing) *listing-left-column.html
1311function ttCollapse() {
1312  var item = blocks.ttCollapse,
1313      itemTitle = item.find('.tt-collapse-title'),
1314      itemContent = item.find('.tt-collapse-content');
1315
1316  item.each(function() {
1317    if ($(this).hasClass('open')) {
1318      $(this).find(itemContent).slideDown();
1319    } else {
1320      $(this).find(itemContent).slideUp();
1321    }
1322  });
1323  itemTitle.on('click', function(e) {
1324    e.preventDefault();
1325    var speed = 300;
1326    var thisParent = $(this).parent(),
1327        nextLevel = $(this).next('.tt-collapse-content');
1328    if (thisParent.hasClass('open')) {
1329      thisParent.removeClass('open');
1330      nextLevel.slideUp(speed);
1331    } else {
1332      thisParent.addClass('open');
1333      nextLevel.slideDown(speed);
1334    }
1335  })
1336};
1337// ttFiltersOptions
1338(function($) {
1339  $.fn.removeClassFirstPart = function(mask) {
1340    return this.removeClass(function(index, cls) {
1341      var re = mask.replace(/\*/g, '\\S+');
1342      return (cls.match(new RegExp('\\b' + re + '', 'g')) || []).join(' ');
1343    });
1344  };
1345})(jQuery);
1346
1347function ttFilterLayout(ttwindowWidth){
1348  if($('.tt-product-listing').hasClass("only-row")) return false;
1349  // detach filter aside left
1350  if($ttFilterOptions.hasClass('desctop-no-sidebar') && !$ttFilterOptions.hasClass('filters-detach-mobile')){
1351     ttwindowWidth <= 1024 ?  insertMobileCol() : insertFilter();
1352  };
1353  if($ttFilterOptions.hasClass('filters-detach-mobile')){
1354    ttwindowWidth <= 1024 ?  insertMobileCol() : insertFilter();
1355  };
1356  if(!$ttFilterOptions.hasClass('desctop-no-sidebar')){
1357    ttwindowWidth <= 1024 ?  insertMobileCol() : insertFilter();
1358  };
1359
1360  function insertMobileCol(){
1361    if(!blocks.ttFilterDetachOption.find('.filters-row-select').length) return false;
1362    var objFilterOptions = blocks.ttFilterSort.find('select').detach();
1363    blocks.ttFilterDetachOption.find('.filters-row-select').append(objFilterOptions);
1364  };
1365  function insertFilter(){
1366    if(!blocks.ttFilterDetachOption.find('.filters-row-select').length) return false;
1367    var objColFilterOptions = blocks.ttFilterDetachOption.find('.filters-row-select select').detach();
1368    blocks.ttFilterSort.append(objColFilterOptions);
1369  };
1370
1371  //active filter detection
1372  blocks.ttProductListing.removeClassFirstPart("tt-col-*");
1373
1374  var ttQuantity = $ttFilterOptions.find('.tt-quantity'),
1375      ttProductItem = blocks.ttProductListing.find('.tt-col-item:first'),
1376      ttProductItemValue =  (function(){
1377        if(ttQuantity.length && ttProductItem.length){
1378          var ttValue = parseInt(ttProductItem.css("flex").replace("0 0", "").replace("%", ""), 10) || parseInt(ttProductItem.css("max-width"), 10);
1379          return ttValue;
1380        };
1381      }());
1382
1383  if(ttProductItemValue == 16){
1384    ttСhangeclass(ttQuantity, '.tt-col-six');
1385  } else if(ttProductItemValue == 25){
1386    ttСhangeclass(ttQuantity, '.tt-col-four');
1387  } else if(ttProductItemValue == 33){
1388    ttСhangeclass(ttQuantity, '.tt-col-three');
1389  } else if(ttProductItemValue == 50){
1390    ttСhangeclass(ttQuantity, '.tt-col-two');
1391  } else if(ttProductItemValue == 100){
1392    ttСhangeclass(ttQuantity, '.tt-col-one');
1393  };
1394
1395  function ttСhangeclass(ttObj, ttObjvalue){
1396    ttwindowWidth <= 1024 ?  ttShowIconMobile(ttObj, ttObjvalue) : ttShowIconDesctop(ttObj, ttObjvalue);
1397    if(ttObj.find(".active").length == 0 || !ttObj.find(".active").hasClass('tt-show-siblings')) ttObj.find(ttObjvalue).addClass('active').siblings().removeClass('active');
1398  };
1399
1400  function ttShowIconDesctop(ttObj, ttObjvalue){
1401
1402    ttObj.find('.tt-show').removeClass('tt-show');
1403    ttObj.find('.tt-show-siblings').removeClass('tt-show-siblings');
1404
1405    var $this = ttObj.find(ttObjvalue);
1406    $this.addClass('tt-show');
1407
1408    $this.next().addClass('tt-show-siblings');
1409    $this.prev().addClass('tt-show-siblings');
1410    var quantitySiblings = $('.tt-quantity .tt-show-siblings').length;
1411    if(quantitySiblings === 1){
1412      ttObj.find('.tt-show-siblings').prev().addClass('tt-show-siblings');
1413    };
1414
1415    if(!Boolean($('.tt-product-listing').data("onerow"))) return false;
1416    $(".tt-col-one").addClass('tt-show-siblings');
1417    var _ca = ttObj.find(".active").data("value");
1418    $('.tt-product-listing').addClass(_ca);
1419  };
1420  function ttShowIconMobile(ttObj, ttObjvalue){
1421    ttObj.find('.tt-show').removeClass('tt-show');
1422    ttObj.find('.tt-show-siblings').removeClass('tt-show-siblings');
1423
1424    var $this = ttObj.find(ttObjvalue);
1425    $this.addClass('tt-show');
1426    $this.prev().addClass('tt-show-siblings');
1427    
1428    if($('.tt-product-listing').data("onerow") == "false") return false;
1429    $(".tt-col-one").addClass('tt-show-siblings');
1430    var _ca = ttObj.find(".active").data("value");
1431    $('.tt-product-listing').addClass(_ca);
1432  };
1433
1434  //click buttons filter
1435  $('body').on('click', '.tt-filters-options a', function(e) {
1436    e.preventDefault();
1437    ttQuantity.find('a').removeClass('active');
1438    var ttActiveValue = $(this).addClass('active').attr('data-value');
1439    $ttPageContent.find('.tt-product-listing').removeClassFirstPart("tt-col-*").addClass(ttActiveValue);
1440    ttProductSmall();
1441    initImagesSize();
1442  });
1443};
1444
1445
1446// Portfolio
1447function gridPortfolioMasonr() {
1448  // init Isotope
1449  var $grid = blocks.ttPortfolioMasonry.find('.tt-portfolio-content').isotope({
1450    itemSelector: '.element-item',
1451    layoutMode: 'masonry',
1452  });
1453  // layout Isotope after each image loads
1454  $grid.imagesLoaded().progress( function() {
1455    $grid.isotope('layout').addClass('tt-show');
1456  });
1457  // filter functions
1458  var ttFilterNav =  blocks.ttPortfolioMasonry.find('.tt-filter-nav');
1459  if (ttFilterNav.length) {
1460    var filterFns = {
1461      ium: function() {
1462        var name = $(this).find('.name').text();
1463        return name.match(/ium$/);
1464      }
1465    };
1466    // bind filter button click
1467    ttFilterNav.on('click', '.button', function() {
1468      var filterValue = $(this).attr('data-filter');
1469      filterValue = filterFns[filterValue] || filterValue;
1470      $grid.isotope({
1471        filter: filterValue
1472      });
1473      $(this).addClass('active').siblings().removeClass('active');
1474    });
1475  };
1476};
1477function initPortfolioPopup() {
1478  var objZoom = $ttPageContent.find('.tt-portfolio-masonry .tt-btn-zomm');
1479  objZoom.magnificPopup({
1480    type: 'image',
1481    gallery: {
1482      enabled: true
1483    }
1484  });
1485};
1486//input-counter
1487function ttInputCounter() {
1488  blocks.ttInputCounter.find('.minus-btn, .plus-btn').click(function( e ) {
1489    var $input = $(this).parent().find('input');
1490    var count = parseInt($input.val(), 10) + parseInt(e.currentTarget.className === 'plus-btn' ? 1 : -1, 10);
1491    $input.val(count).change();
1492  });
1493  blocks.ttInputCounter.find("input").change(function() {
1494    var _ = $(this);
1495    var min = 1;
1496    var val = parseInt(_.val(), 10);
1497    var max = parseInt(_.attr('size'), 10);
1498    val = Math.min(val, max);
1499    val = Math.max(val, min);
1500    _.val(val);
1501  })
1502  .on("keypress", function( e ) {
1503    if (e.keyCode === 13) {
1504      e.preventDefault();
1505    }
1506  });
1507};
1508//popup on pages product single
1509function ttVideoPopup() {
1510  blocks.modalVideoProduct.on('show.bs.modal', function(e) {
1511    var relatedTarget = $(e.relatedTarget),
1512        attr = relatedTarget.attr('data-value'),
1513        attrPoster = relatedTarget.attr('data-poster'),
1514        attrType = relatedTarget.attr('data-type');
1515
1516    if(attrType === "youtube" || attrType === "vimeo" || attrType === undefined){
1517      $('<iframe src="'+attr+'" allowfullscreen></iframe>').appendTo($(this).find('.modal-video-content'));
1518    };
1519
1520    if(attrType === "video"){
1521      $('<div class="tt-video-block"><a href="#" class="link-video"></a><video class="movie" src="'+attr+'" poster="'+attrPoster+'" allowfullscreen></video></div>').appendTo($(this).find('.modal-video-content'));
1522
1523    };
1524    ttVideoBlock();
1525  }).on('hidden.bs.modal', function () {
1526    $(this).find('.modal-video-content').empty();
1527  });
1528};
1529//product pages
1530var elevateZoomWidget = {
1531  scroll_zoom: true,
1532  class_name: '.zoom-product',
1533  scrollslider_parent: $('.slider-scroll-product'),
1534  checkNoZoom: function(){
1535    return $(this.class_name).parent().parent().hasClass('no-zoom');
1536  },
1537  get_thumb_parent: function(){
1538    return $('#smallGallery');
1539  },
1540  init: function(type){
1541    var _ = this;
1542    var currentW = window.innerWidth || $(window).width();
1543    var zoom_image = $(_.class_name);
1544    var _thumbs = _.get_thumb_parent();
1545    _.initBigGalleryButtons();
1546    _.scrollSlider();
1547
1548    if(zoom_image.length == 0) return false;
1549    if(!_.checkNoZoom()){
1550      var attr_scroll = zoom_image.parent().parent().attr('data-scrollzoom');
1551      attr_scroll = attr_scroll ? attr_scroll : _.scroll_zoom;
1552      _.scroll_zoom = attr_scroll == 'false' ? false : true;
1553      currentW > 575 && _.configureZoomImage();
1554      _.resize();
1555    }
1556
1557    if(_thumbs.length == 0) return false;
1558    var thumb_type = _thumbs.parent().attr('class').indexOf('-vertical') > -1 ? 'vertical' : 'horizontal';
1559    _[thumb_type](_thumbs);
1560    _.setBigImage(_thumbs);
1561  },
1562  configureZoomImage: function(){
1563    var _ = this;
1564    $('.zoomContainer').remove();
1565    var zoom_image = $(this.class_name);
1566    zoom_image.each(function(){
1567      var _this = $(this);
1568      var clone = _this.removeData('elevateZoom').clone();
1569      _this.after(clone).remove();
1570    });
1571    setTimeout(function(){
1572      $(_.class_name).elevateZoom({
1573        gallery: _.get_thumb_parent().attr('id'),
1574        zoomType: "inner",
1575        scrollZoom: Boolean(_.scroll_zoom),
1576        cursor: "crosshair",
1577        zoomWindowFadeIn: 300,
1578        zoomWindowFadeOut: 300
1579      });
1580    }, 100);
1581  },
1582  resize: function(){
1583    var _ = this;
1584    $(window).resize(function(){
1585      var currentW = window.innerWidth || $(window).width();
1586      if(currentW <= 575) return false;
1587      _.configureZoomImage();
1588    });
1589  },
1590  horizontal: function(_parent){
1591    _parent.hasClass('slick-slider') && _parent.slick('unslick');
1592    _parent.on('init', function(event, slick){
1593      var event = new CustomEvent('desktop-slider-initialized', { 'detail': $(this) });
1594      window.dispatchEvent(event);
1595    });
1596    _parent.slick({
1597      lazyLoad: 'progressive',
1598      infinite: false,
1599      dots: false,
1600      arrows: true,
1601      slidesToShow: 6,
1602      slidesToScroll: 1,
1603      responsive: [{
1604        breakpoint: 1200,
1605        settings: {
1606          slidesToShow: 4,
1607          slidesToScroll: 1
1608        }
1609      },
1610                   {
1611                     breakpoint: 992,
1612                     settings: {
1613                       slidesToShow: 4,
1614                       slidesToScroll: 1
1615                     }
1616                   }]
1617    });
1618  },
1619  vertical: function(_parent){
1620    _parent.hasClass('slick-slider') && _parent.slick('unslick');
1621    _parent.on('init', function(event, slick){
1622      var event = new CustomEvent('desktop-slider-initialized', { 'detail': $(this) });
1623      window.dispatchEvent(event);
1624    });
1625    _parent.slick({
1626      lazyLoad: 'progressive',
1627      vertical: true,
1628      infinite: false,
1629      slidesToShow: 5,
1630      slidesToScroll: 1,
1631      verticalSwiping: true,
1632      arrows: true,
1633      dots: false,
1634      centerPadding: "0px",
1635      customPaging: "0px",
1636      responsive: [{
1637        breakpoint: 1200,
1638        settings: {
1639          slidesToShow: 5,
1640          slidesToScroll: 1
1641        }
1642      },
1643                   {
1644                     breakpoint: 992,
1645                     settings: {
1646                       slidesToShow: 5,
1647                       slidesToScroll: 1
1648                     }
1649                   },
1650                   {
1651                     breakpoint: 768,
1652                     settings: {
1653                       slidesToShow: 5,
1654                       slidesToScroll: 1
1655                     }
1656                   }]
1657    });    
1658  },
1659  initBigGalleryButtons: function(){
1660    var bigGallery = $('.bigGallery');
1661    if(bigGallery.length == 0) return false;
1662    $( 'body' ).on( 'mouseenter', '.zoomContainer',
1663                   function(){        bigGallery.find('button').addClass('show');        }
1664                  ).on( 'mouseleave', '.zoomContainer',
1665                       function(){ bigGallery.find('button').removeClass('show'); }
1666                      );
1667  },
1668  scrollSlider: function(){
1669    var _scrollslider_parent = this.scrollslider_parent;
1670    if(_scrollslider_parent.length == 0) return false;
1671    _scrollslider_parent.on('init', function(event, slick) {
1672      _scrollslider_parent.css({ 'opacity': 1 });
1673    });
1674    _scrollslider_parent.css({ 'opacity': 0 }).slick({
1675      infinite: false,
1676      vertical: true,
1677      verticalScrolling: true,
1678      dots: true,
1679      arrows: false,
1680      slidesToShow: 1,
1681      slidesToScroll: 1,
1682      responsive: [{
1683        breakpoint: 1200,
1684        settings: {
1685          slidesToShow: 1,
1686          slidesToScroll: 1
1687        }
1688      },
1689                   {
1690                     breakpoint: 992,
1691                     settings: {
1692                       slidesToShow: 1,
1693                       slidesToScroll: 1
1694                     }
1695                   },
1696                   {
1697                     breakpoint: 768,
1698                     settings: {
1699                       slidesToShow: 1,
1700                       slidesToScroll: 1
1701                     }
1702                   }]
1703    }).mousewheel(function(e) {
1704      e.preventDefault();
1705      e.deltaY < 0 ? $(this).slick('slickNext') : $(this).slick('slickPrev');
1706    });
1707  },
1708  setBigImage: function(_parent){
1709    var _ = this;
1710    _parent.find('a').click(function(e){
1711      _.checkNoZoom() && e.preventDefault();
1712      var zoom_image = $(_.class_name);
1713      var getParam = _.checkNoZoom() ? 'data-image' : 'data-zoom-image';
1714      var setParam = _.checkNoZoom() ? 'src' : 'data-zoom-image';
1715      var big_image = $(this).attr(getParam);
1716      zoom_image.attr(setParam, big_image);
1717
1718      if(!_.checkNoZoom()) return false;
1719      _parent.find('.zoomGalleryActive').removeClass('zoomGalleryActive');
1720      $(this).addClass('zoomGalleryActive');
1721    });
1722  }
1723};
1724
1725// product single tt-btn-zomm(*magnific popup)
1726function ttProductSingleBtnZomm() {
1727  $body.on('click', '.tt-product-single-img .tt-btn-zomm', function (e) {
1728    var objSmallGallery = $('#smallGallery');
1729    objSmallGallery.find('[data-zoom-image]').each(function(){
1730      var dataZoomImg = $(this).attr('data-zoom-image');
1731      if(dataZoomImg.length){
1732        $(this).closest('li').append("<a class='link-magnific-popup' href='#'></a>").find('.link-magnific-popup').attr('href', dataZoomImg);
1733        if($(this).hasClass('zoomGalleryActive')){
1734          $(this).closest('li').find('.link-magnific-popup').addClass('zoomGalleryActive');
1735        };
1736      };
1737    });
1738    objSmallGallery.addClass('tt-magnific-popup').find('.link-magnific-popup').magnificPopup({
1739      type: 'image',
1740      gallery: {
1741        enabled: true,
1742        tCounter: '<span class="mfp-counter"></span>'
1743      },
1744      callbacks: {
1745        close: function() {
1746          setTimeout(function() {
1747            objSmallGallery.removeClass('tt-magnific-popup').find('.link-magnific-popup').remove();
1748          }, 200);
1749
1750        }
1751      }
1752    });
1753    objSmallGallery.find('.link-magnific-popup.zoomGalleryActive').trigger('click');
1754  });
1755};
1756
1757//sticky(product-05.html)
1758function ttAirSticky(ttwindowWidth){
1759  var airStickyObj =  blocks.ttAirSticky,
1760      tabObj =  blocks.ttCollapseBlock.find('.tt-collapse-title');
1761
1762  if(ttwindowWidth >= 1024){
1763    airStickyObj.airStickyBlock({
1764      debug: false,
1765      stopBlock: '.airSticky_stop-block',
1766      offsetTop: 70,
1767    });
1768  } else if(airStickyObj.hasClass('airSticky_absolute')) {
1769    airStickyObj.removeClass('airSticky_absolute');
1770  };
1771  $document.on('resize scroll', tabObj, function () {
1772    airStickyObj.trigger('render.airStickyBlock');
1773  });
1774  tabObj.on('click', function() {
1775    setTimeout(function(){
1776      airStickyObj.trigger('render.airStickyBlock');
1777    }, 170);
1778  });
1779};
1780// img for ratio > 1
1781if (window.devicePixelRatio > 1) {
1782  var ttImgToReplace = $('.tt-retina');
1783  for (var i = 0, l = ttImgToReplace.length; i < l; i++) {
1784    var src = ttImgToReplace[i].src;
1785    src = src.replace(/\.(png|jpg|gif)+$/i, '@2x.$1');
1786    ttImgToReplace[i].src = src;
1787  };
1788};
1789
1790
1791
1792/**
1793     * Stuck init. Properties: on/off
1794     * @value = 'off', default empty
1795     */
1796function initStuck(value) {
1797  if($stucknav.hasClass('disabled')) return;
1798
1799  var value = value || false,
1800      ie = (getInternetExplorerVersion() !== -1) ? true : false;
1801
1802  if (value === 'off') return false;
1803  var n = 0;
1804  $window.scroll(function() {
1805    var HeaderTop = $('header').innerHeight();
1806    var mh = $('header').innerHeight();
1807    var $hil = $('header').find('.tt-mobile-header-inline-stuck');
1808    if($hil.length && window.innerWidth < 1025){
1809      HeaderTop = $('.innerheadercontainer').length ? $('.innerheadercontainer').innerHeight() : $('header').innerHeight();
1810    }
1811    if ($window.scrollTop() > HeaderTop) {
1812      if ($stucknav.hasClass('stuck')) return false;
1813
1814      if($hil.length && window.innerWidth < 1025){
1815        $('<div class="innerheadercontainer" style="height:'+mh+'px;"></div>').insertBefore('header');
1816        $stucknav.addClass('stuck').show();
1817        $hil.addClass('stuck').stop().hide().fadeIn().closest('header').addClass('headerisstuck');
1818      }
1819      else{
1820        $hil.length && $hil.addClass('stuck').closest('header').addClass('headerisstuck');
1821        $stucknav.hide();
1822        $stucknav.addClass('stuck');
1823        $('body').trigger('showStuck');
1824        window.innerWidth < 1025 ? $ttStuckParentMenu.append($ttMobileParentMenuChildren.detach()) : $ttStuckParentMenu.append($ttDesctopMenu.first().detach());
1825        $ttStuckParentCart.append($ttcartObj.detach());
1826        $ttStuckParentMulti.append($ttMultiObj.detach());
1827        $ttStuckParentAccount.append($ttAccountObj.detach());
1828        $ttStuckParentSearch.append($ttSearchObj.detach());
1829
1830        if ($stucknav.find('.tt-stuck-cart-parent > .tt-cart > .dropdown').hasClass('open') || ie)
1831          $stucknav.stop().show();
1832        else
1833          $stucknav.stop().fadeIn(300);
1834
1835      }
1836    } else {
1837      if (!$stucknav.hasClass('stuck')) return false;
1838
1839      if($hil.length && window.innerWidth < 1025){
1840        $('.innerheadercontainer').length && $('.innerheadercontainer').remove();
1841        $stucknav.hide().removeClass('stuck');
1842        $hil.removeClass('stuck').removeAttr('style').closest('header').removeClass('headerisstuck');
1843        $ttDesctopParentMenu.append($ttDesctopMenu.first().detach());
1844      }
1845      else{
1846        $('.innerheadercontainer').length && $('.innerheadercontainer').remove();
1847        $hil.length && $hil.removeClass('stuck').closest('header').removeClass('headerisstuck');
1848        $stucknav.hide();
1849        $stucknav.removeClass('stuck');
1850        $('body').trigger('hideStuck');
1851        if (window.innerWidth < 1025) {
1852          $ttMobileParentMenu.append($ttMobileParentMenuChildren.detach());
1853          $ttMobileParentCart.append($ttcartObj.detach());
1854          $ttMobileParentMulti.append($ttMultiObj.detach());
1855          $ttMobileParentAccount.append($ttAccountObj.detach());
1856          $ttMobileParentSearch.append($ttSearchObj.detach());
1857          return false;
1858        }
1859        $ttDesctopParentMenu.append($ttDesctopMenu.first().detach());
1860        $ttDesctopParentCart.append($ttcartObj.detach());
1861        $ttDesctopParentMulti.append($ttMultiObj.detach());
1862        $ttDesctopParentAccount.append($ttAccountObj.detach());
1863        $ttDesctopParentSearch.append($ttSearchObj.detach());
1864      }
1865    }
1866  });
1867  $window.resize(function() {
1868    if(window.innerWidth < 1025 && $('header').find('.tt-mobile-header-inline-stuck').length) {
1869      var chs = $('header').find('.tt-mobile-parent-menu-icons');
1870      if(!chs.length) return false;
1871      if(!chs.children().length) return false;
1872      if(chs.children().first().children().length) return false;
1873      $ttMobileParentCart.append($ttcartObj.detach());
1874      $ttMobileParentSearch.append($ttSearchObj.detach());
1875      return false;
1876    }
1877
1878    if (!$stucknav.hasClass('stuck')) return false;
1879
1880    if (window.innerWidth < 1025) {
1881      $ttDesctopParentMenu.append($ttDesctopMenu.first().detach());
1882      $ttStuckParentMenu.append($ttMobileParentMenuChildren.detach());
1883    } else {
1884      if($('header').find('.tt-mobile-header-inline-stuck').length){
1885        var chs = $('header').find('.tt-mobile-parent-menu-icons');
1886        if(!chs.length) return false;
1887        if(!chs.children().length) return false;
1888        if(!chs.children().first().children().length) return false;
1889        $ttStuckParentMenu.append($ttDesctopMenu.first().detach());
1890        $ttStuckParentCart.append($ttcartObj.detach());
1891        $ttStuckParentMulti.append($ttMultiObj.detach());
1892        $ttStuckParentAccount.append($ttAccountObj.detach());
1893        $ttStuckParentSearch.append($ttSearchObj.detach());
1894        $('.tt-mobile-header').removeAttr('style');
1895        $('.innerheadercontainer').length && $('.innerheadercontainer').remove();
1896      }
1897      else{
1898        $ttMobileParentMenu.append($ttMobileParentMenuChildren.detach());
1899        $ttStuckParentMenu.append($ttDesctopMenu.first().detach());
1900      }
1901    }
1902  });
1903};
1904//header search
1905function mobileParentSearch() {
1906  if (window.innerWidth < 1025) {
1907    if ($ttMobileParentSearch.children().length) return false;
1908    if ($('.stuck').length) return false;
1909    $ttMobileParentSearch.append($ttSearchObj.detach());
1910  } else {
1911    if ($ttDesctopParentSearch.children().length) return false;
1912    if ($('.stuck').length) return false;
1913    $ttDesctopParentSearch.append($ttSearchObj.detach());
1914  };
1915};
1916//header cart
1917function mobileParentCart() {
1918  if (window.innerWidth < 1025) {
1919    if ($ttMobileParentCart.children().length) return false;
1920    if ($('.stuck').length) return false;
1921    $ttMobileParentCart.append($ttcartObj.detach());
1922  } else {
1923    if ($ttDesctopParentCart.children().length) return false;
1924    if ($('.stuck').length) return false;
1925    $ttDesctopParentCart.append($ttcartObj.detach());
1926  };
1927};
1928//header account
1929function mobileParentAccount() {
1930  if (window.innerWidth < 1025) {
1931    if ($ttMobileParentAccount.children().length) return false;
1932    if ($('.stuck').length) return false;
1933    if($('header').find('.tt-mobile-header-inline').length) return false;
1934    $ttMobileParentAccount.append($ttAccountObj.detach());
1935  } else {
1936    if ($ttDesctopParentAccount.children().length) return false;
1937    if ($('.stuck').length) return false;
1938    $ttDesctopParentAccount.append($ttAccountObj.detach());
1939  };
1940};
1941//header langue and currency(*all in one module)
1942function mobileParentMulti() {
1943  if (window.innerWidth < 1025) {
1944    if ($ttMobileParentMulti.children().length) return false;
1945    if ($('.stuck').length) return false;
1946    if($('header').find('.tt-mobile-header-inline').length) return false;
1947    $ttMobileParentMulti.append($ttMultiObj.detach());
1948  } else {
1949    if ($ttDesctopParentMulti.children().length) return false;
1950    if ($('.stuck').length) return false;
1951    $ttDesctopParentMulti.append($ttMultiObj.detach());
1952  };
1953};
1954
1955/*
1956      header menu
1957    */
1958// header menu(hover)
1959(function toggle_header_menu() {
1960  var delay = header_menu_timeout,
1961      hoverTimer = header_menu_delay,
1962      timeout1 = false;
1963
1964  var set_dropdown_maxH = function() {
1965    var wind_H = window.innerHeight,
1966        $ttDesctopMenu = $(this).find('.dropdown-menu'),
1967        menu_top = $ttDesctopMenu.get(0).getBoundingClientRect().top,
1968        menu_max_H = wind_H - menu_top,
1969        $ttDesctopMenu_H = $ttDesctopMenu.innerHeight(),
1970        $btn_top = blocks.ttBackToTop;
1971
1972    if ($ttDesctopMenu_H > menu_max_H) {
1973      var $body = $('body'),
1974          $stuck = $('.tt-stuck-nav');
1975      $ttDesctopMenu.css({
1976        maxHeight: menu_max_H - 20,
1977        overflow: 'auto'
1978      });
1979
1980      var scrollWidth = function() {
1981        var $div = $('<div>').css({
1982          overflowY: 'scroll',
1983          width: '50px',
1984          height: '50px',
1985          visibility: 'hidden'
1986        });
1987
1988        $body.append($div);
1989        var scrollWidth = $div.get(0).offsetWidth - $div.get(0).clientWidth;
1990        $div.remove();
1991
1992        return scrollWidth;
1993      };
1994
1995      $body.css({
1996        overflowY: 'hidden',
1997        paddingRight: scrollWidth()
1998      });
1999
2000      $stuck.css({
2001        paddingRight: scrollWidth()
2002      });
2003
2004      $btn_top.css({
2005        right: scrollWidth()
2006      });
2007      
2008      $('.tt-header-static').length && $('.tt-header-static').css({'padding-right': scrollWidth()});
2009    }
2010  };
2011
2012  if ($ttDesctopMenu.length > 0) {
2013    $('.tt-megamenu-submenu li').each(function(){
2014      if($(this).find('img').length){
2015        $(this).closest('ul').addClass('tt-sub-img');
2016      }
2017    });
2018    $ttDesctopMenu.find('.dropdown-menu').each(function(){
2019      if($(this).length){
2020        $(this).closest('.dropdown').addClass('tt-submenu');
2021      }
2022    });
2023    
2024    $(document).on({
2025      mouseenter: function() {
2026        var $this = $(this),
2027            that = this,
2028            windowW = window.innerWidth || $(window).width();
2029
2030        if (windowW > 1025 && $body.hasClass('touch-device')) {
2031          $ttDesctopMenu.find('.dropdown.tt-submenu > a').one("click", false);
2032        };
2033
2034        timeout1 = setTimeout(function () {
2035
2036          var $carousel = $this.find('.tt-menu-slider'),
2037              $ttDesctopMenu = $this.find('.dropdown-menu');
2038
2039
2040          $this.addClass('active')
2041          .find(".dropdown-menu")
2042          .stop()
2043          .addClass('hover')
2044          .fadeIn(hoverTimer);
2045
2046          if($ttDesctopMenu.length & !$ttDesctopMenu.hasClass('one-col')) {
2047            set_dropdown_maxH.call(that);
2048          }
2049
2050          if($carousel.length) {
2051            if(!$carousel.hasClass('slick-initialized')) {
2052              $carousel.slick({
2053                dots: false,
2054                arrows: true,
2055                infinite: true,
2056                speed: 300,
2057                slidesToShow: 3,
2058                slidesToScroll: 3,
2059                adaptiveHeight: true
2060              });
2061            }
2062          };
2063          $carousel.slick('setPosition');
2064
2065        }, delay);
2066
2067      },
2068      mouseleave: function(e) {
2069        var $this = $(this),
2070            $dropdown = $this.find(".dropdown-menu");
2071
2072        if($(e.target).parents('.dropdown-menu').length && !$(e.target).parents('.tt-megamenu-submenu').length && !$(e.target).parents('.one-col').length) return;
2073
2074        if(timeout1 !== false) {
2075          clearTimeout(timeout1);
2076          timeout1 = false;
2077        }
2078
2079        if($dropdown.length) {
2080          $dropdown.stop().fadeOut({duration: 0, complete: function() {
2081            $this.removeClass('active')
2082            .find(".dropdown-menu")
2083            .removeClass('hover');
2084          }});
2085        } else {
2086          $this.removeClass('active')
2087          .find(".dropdown-menu")
2088          .removeClass('hover');
2089        }
2090
2091        $dropdown.removeAttr('style');
2092        $('.tt-header-static').length && $('.tt-header-static').removeAttr('style');        
2093         
2094        if(!$('body').hasClass('notdelete')){
2095          $body.removeAttr('style');
2096        }
2097
2098        $('.tt-stuck-nav').css({
2099          paddingRight: 'inherit'
2100        });
2101
2102        blocks.ttBackToTop.css({
2103          right: 0
2104        });
2105      }
2106    }, '.tt-desctop-menu li');
2107
2108    $('.multicolumn ul li').hover(function() {
2109      var $ul = $(this).find('ul:first');
2110
2111      if ($ul.length) {
2112        var windW = window.innerWidth,
2113            windH = window.innerHeight,
2114            ulW = parseInt($ul.css('width'), 10),
2115            thisR = this.getBoundingClientRect().right,
2116            thisL = this.getBoundingClientRect().left;
2117
2118        if (windW - thisR < ulW) {
2119          $ul.removeClass('left').addClass('right');
2120        } else if (thisL < ulW) {
2121          $ul.removeClass('right').addClass('left');
2122        } else {
2123          $ul.removeClass('left right');
2124        }
2125        $ul.stop(true, true).fadeIn(300);
2126      }
2127    }, function() {
2128      $(this).find('ul:first').stop(true, true).fadeOut(300).removeAttr('style');
2129    });
2130
2131    $ttDesctopMenu.find('.tt-megamenu-submenu li').hover(function() {
2132      var $ul = $(this).find('ul:first');
2133
2134      if ($ul.length) {
2135        var $dropdownMenu = $(this).parents('.dropdown').find('.dropdown-menu'),
2136            dropdown_left = parseInt($(this).get(0).getBoundingClientRect().left, 10),
2137            dropdown_Right = $dropdownMenu.get(0).getBoundingClientRect().right,
2138            dropdown_Bottom = $dropdownMenu.get(0).getBoundingClientRect().bottom,
2139            ulW = parseInt($ul.css('width'), 10),
2140            thisR = this.getBoundingClientRect().right,
2141            thisL = this.getBoundingClientRect().left,
2142            compareValue = parseInt(ulW + dropdown_left + 170, 10),
2143            ttwindowWidth = window.innerWidth;
2144
2145
2146        if (ttwindowWidth <= compareValue) {
2147          $(this).find('ul:first').removeClass('left').addClass('right');
2148        } else if (ttwindowWidth > compareValue) {
2149          $(this).find('ul:first').css({left: parseInt($(this).find('a').innerWidth(), 10)}).removeClass('right').addClass('left');
2150        };
2151
2152        $ul.stop(true, true).delay(150).fadeIn(300);
2153
2154        var ul_bottom = $ul.get(0).getBoundingClientRect().bottom;
2155
2156        if (dropdown_Bottom < ul_bottom) {
2157          var move_top = dropdown_Bottom - ul_bottom;
2158          $ul.css({
2159            top: move_top
2160          });
2161        }
2162      }
2163    }, function() {
2164      $(this).find('ul:first').stop(true, true).fadeOut(300).removeAttr('style');
2165    });
2166
2167    $('.megamenu div').hover(function() {
2168      $(this).children('.tt-title-submenu').addClass('active');
2169    }, function() {
2170      $(this).children('.tt-title-submenu').removeClass('active');
2171    });
2172
2173  }
2174
2175  function onscroll_dropdown_hover() {
2176    var $dropdown_active = $('.dropdown.hover');
2177
2178    if (!$dropdown_active.find('.dropdown-menu').not('.one-col').length) return;
2179
2180    if ($dropdown_active.length)
2181      set_dropdown_maxH.call($dropdown_active);
2182  };
2183  $(window).on('scroll', function() {
2184    onscroll_dropdown_hover();
2185  });
2186})();
2187
2188/*!
2189 * jQuery Cookie Plugin v1.4.1
2190 * https://github.com/carhartl/jquery-cookie
2191 *
2192 * Copyright 2006, 2014 Klaus Hartl
2193 * Released under the MIT license
2194 */
2195(function (factory) {
2196  if (typeof define === 'function' && define.amd) {
2197    define(['jquery'], factory);
2198  } else if (typeof exports === 'object') {
2199    module.exports = factory(require('jquery'));
2200  } else {
2201    factory(jQuery);
2202  }
2203}(function ($) {
2204
2205  var pluses = /\+/g;
2206
2207  function encode(s) {
2208    return config.raw ? s : encodeURIComponent(s);
2209  }
2210
2211  function decode(s) {
2212    return config.raw ? s : decodeURIComponent(s);
2213  }
2214
2215  function stringifyCookieValue(value) {
2216    return encode(config.json ? JSON.stringify(value) : String(value));
2217  }
2218
2219  function parseCookieValue(s) {
2220    if (s.indexOf('"') === 0) {
2221      s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
2222    }
2223
2224    try {
2225      s = decodeURIComponent(s.replace(pluses, ' '));
2226      return config.json ? JSON.parse(s) : s;
2227    } catch(e) {}
2228  }
2229
2230  function read(s, converter) {
2231    var value = config.raw ? s : parseCookieValue(s);
2232    return $.isFunction(converter) ? converter(value) : value;
2233  }
2234
2235  var config = $.cookie = function (key, value, options) {
2236
2237    if (arguments.length > 1 && !$.isFunction(value)) {
2238      options = $.extend({}, config.defaults, options);
2239
2240      if (typeof options.expires === 'number') {
2241        var days = options.expires, t = options.expires = new Date();
2242        t.setMilliseconds(t.getMilliseconds() + days * 864e+5);
2243      }
2244
2245      return (document.cookie = [
2246        encode(key), '=', stringifyCookieValue(value),
2247        options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
2248        options.path    ? '; path=' + options.path : '',
2249        options.domain  ? '; domain=' + options.domain : '',
2250        options.secure  ? '; secure' : ''
2251      ].join(''));
2252    }
2253
2254    var result = key ? undefined : {},
2255        cookies = document.cookie ? document.cookie.split('; ') : [],
2256        i = 0,
2257        l = cookies.length;
2258
2259    for (; i < l; i++) {
2260      var parts = cookies[i].split('='),
2261          name = decode(parts.shift()),
2262          cookie = parts.join('=');
2263
2264      if (key === name) {
2265        result = read(cookie, value);
2266        break;
2267      }
2268
2269      if (!key && (cookie = read(cookie)) !== undefined) {
2270        result[name] = cookie;
2271      }
2272    }
2273
2274    return result;
2275  };
2276
2277  config.defaults = {};
2278
2279  $.removeCookie = function (key, options) {
2280    $.cookie(key, '', $.extend({}, options, { expires: -1 }));
2281    return !$.cookie(key);
2282  };
2283
2284}));
2285
2286function subscribeErrorHandler(){
2287  if($('.errors').length == 0) return false;
2288  $('[type="email"]').on('focus', function(){
2289    $(this).unbind().closest('form').find('.errors').length && $(this).closest('form').find('.errors').remove();
2290  })
2291}
2292subscribeErrorHandler();
2293
2294/* Sections */
2295var hoverColors = {
2296  params: { 
2297    baseColor: 'data-c',
2298    activeColor: 'data-ac',
2299    bgBaseColor: 'data-bgc',
2300    bgActiveColor: 'data-abgc',
2301    borderBaseColor: 'data-borc',
2302    borderActiveColor: 'data-aborc',
2303  },
2304  init: function(){
2305    var attrName = this.params;
2306    var he = $('[data-hovercolors]');
2307    if(he.length == 0) return false;
2308    he.each(function(){
2309      hoverColors.getCurrentColors($(this), attrName.baseColor, attrName.bgBaseColor, attrName.borderBaseColor);
2310    });
2311  },
2312  initEvents: function(){
2313    var attrName = this.params;
2314    $('body').on({
2315      mouseenter: function(){
2316        hoverColors.getCurrentColors($(this), attrName.activeColor, attrName.bgActiveColor, attrName.borderActiveColor );
2317      },
2318      mouseleave: function(){
2319        hoverColors.getCurrentColors($(this), attrName.baseColor, attrName.bgBaseColor, attrName.borderBaseColor );
2320      }}, '[data-hovercolors]'
2321    );
2322  },
2323  getCurrentColors: function(_, attr1, attr2, attr3){
2324    hoverColors.setCurrentColors(_, attr1, attr2, attr3);
2325    var attr = false;
2326
2327    var ac = _.find('['+ attr1 +']');
2328    if(ac.length > 0) {
2329      ac.each(function(){
2330        attr = $(this).attr("use-on-hover");
2331        if (typeof attr !== typeof undefined && attr !== false && _ != $(this)) return true;
2332        var c = $(this).attr(attr1);
2333        $(this).css('color', c);
2334      });
2335    }
2336    
2337    ac = _.find('['+ attr2 +']');
2338    if(ac.length > 0) {
2339      ac.each(function(){
2340        attr = $(this).attr("use-on-hover");
2341        if (typeof attr !== typeof undefined && attr !== false && _ != $(this)) return true;
2342        hoverColors.setCurrentBgColor($(this), attr2);
2343      });
2344    }
2345
2346    ac = _.find('['+ attr3 +']');
2347    if(ac.length > 0) {
2348      ac.each(function(){
2349        attr = $(this).attr("use-on-hover");
2350        if (typeof attr !== typeof undefined && attr !== false && _ != $(this)) return true;
2351        hoverColors.setCurrentBorderColor($(this), attr3);
2352      });
2353    }
2354  },
2355  setCurrentBgColor: function(_, attr){
2356    var a = _.attr(attr);
2357    _.css({"background": a});
2358  },
2359  setCurrentBorderColor: function(_, attr){
2360    var a = _.attr(attr);
2361    if (typeof a !== typeof undefined && a !== false) {
2362      _.css('border-color', a);
2363    }
2364  },
2365  setCurrentColors: function(_, attr1, attr2, attr3){
2366    var c = _.attr(attr1);
2367    _.css('color', c);
2368
2369    hoverColors.setCurrentBgColor(_, attr2);
2370    hoverColors.setCurrentBorderColor(_, attr3);
2371
2372    return false;
2373  }
2374}
2375hoverColors.initEvents();
2376
2377// Countdown
2378function countDown(showZero) {
2379  if ($(".tt-countdown").length) {
2380
2381    var showZero = showZero || false;
2382
2383    $(".tt-countdown").each(function() {
2384      var $this = $(this),
2385          date = $this.data('date'),
2386          nextYear = false,
2387          tz = $('[name=timezone]');
2388      
2389      if(typeof moment === "function" && tz.length) nextYear = moment.tz($this.data('date'), tz.attr('content'));
2390
2391      if (date = date.split('-')) {
2392        date = date.join('/');
2393      } else return;
2394
2395      var timezone = nextYear ? nextYear.toDate() : date;
2396
2397      $this.countdown(timezone, function(e) {
2398        var format = '<span class="countdown-row">';
2399
2400        function addFormat(func, timeNum, showZero) {
2401          if(timeNum === 0 && !showZero) return;
2402
2403          func(format);
2404        };
2405
2406        addFormat(function() {
2407          format += '<span class="countdown-section">'
2408          + '<span class="countdown-amount">' + e.offset.totalDays + '</span>'
2409          + '<span class="countdown-period">' + set_day + '</span>'
2410          + '</span>';
2411        }, e.offset.totalDays, showZero);
2412
2413        addFormat(function() {
2414          format += '<span class="countdown-section">'
2415          + '<span class="countdown-amount">' + e.offset.hours + '</span>'
2416          + '<span class="countdown-period">' + set_hour + '</span>'
2417          + '</span>';
2418        }, e.offset.hours, showZero);
2419
2420        addFormat(function() {
2421          format += '<span class="countdown-section">'
2422          + '<span class="countdown-amount">' + e.offset.minutes + '</span>'
2423          + '<span class="countdown-period">' + set_minute + '</span>'
2424          + '</span>';
2425        }, e.offset.minutes, showZero);
2426
2427        addFormat(function() {
2428          format += '<span class="countdown-section">'
2429          + '<span class="countdown-amount">' + e.offset.seconds + '</span>'
2430          + '<span class="countdown-period">' + set_second + '</span>'
2431          + '</span>';
2432        }, e.offset.seconds, showZero);
2433
2434        format += '</span>';
2435
2436        $(this).html(format);
2437      });
2438    });
2439  }
2440};
2441
2442$(document).ready(function() {
2443
2444  "use strict";
2445
2446  countDown(true);
2447
2448  initProductOptions();
2449});
2450
2451/* products options */
2452function initProductOptions(){
2453  $('body').on('change', '.productitem-option1-combo-js select', function(e){
2454    var $this = $(this).find('option:selected');
2455    setNewData($this, true);
2456    var val = $this.attr("data-tag") + '-js';
2457    var _parent = $this.closest('.tt-option-block');
2458    val = _parent.optionsSetParams(val, '.productitem-option2-js');
2459    _parent.optionsSetParams(val, '.productitem-option3-js');
2460  })
2461  $('body').on('click', '.productitem-option1-js a', function(e){
2462    var $this = $(this);
2463    optionsHandler(e, $this);
2464    var val = $this.parent().attr("data-tag") + '-js';
2465    var _parent = $this.closest('.tt-option-block');
2466    val = _parent.optionsSetParams(val, '.productitem-option2-js');
2467    _parent.optionsSetParams(val, '.productitem-option3-js');
2468  })
2469  $('body').on('click', '.productitem-option2-js a', function(e){
2470    var $this = $(this)
2471    optionsHandler(e, $this);
2472    var val = $this.parent().attr("data-tag") + '-js';
2473    var _parent = $this.closest('.tt-option-block');
2474    _parent.optionsSetParams(val, '.productitem-option3-js');
2475  });
2476  $('body').on('click', '.productitem-option3-js a', function(e){
2477    optionsHandler(e, $(this));
2478  });
2479}
2480function optionsHandler(e, $this){
2481  e.preventDefault();
2482  if($this.parent().hasClass('active')) return false;
2483  setNewData($this);
2484}
2485$.fn.optionsSetParams = function(val, str){
2486  var _opt = this.find(str);
2487  if(_opt.length == 0) return false;
2488  _opt.show().find('li').each(function(){ $(this).hide().removeClass('active') });
2489  if(_opt.find('[data-current-option="'+val+'"]').length == 0) return false;
2490  _opt.find('[data-current-option="'+val+'"]').show().first().addClass('active');
2491  return _opt.find('.active').find('a').parent().attr("data-tag") + '-js';
2492}
2493function setNewData($this, combobox){
2494  if (combobox === undefined) {
2495    combobox = false;
2496  }
2497  var _parent = combobox ? $this : $this.parent();
2498  if(!combobox){
2499    _parent.parent().find(".active").removeClass('active');
2500    _parent.addClass('active');
2501  }
2502
2503  var availability = Boolean(_parent.data('variant_availability'));
2504  var $pr_parent = $this.closest('.options-js');
2505
2506  $pr_parent.find('input').val(_parent.attr('data-var_id'));
2507  
2508  var img_src = _parent.attr('data-img');
2509  if(img_src != ''){
2510    if($(window).width() > '1024' && $pr_parent.find('.tt-img-roll-over').length) {
2511      $pr_parent.find('.tt-img-roll-over img').attr('src', img_src).removeAttr('srcset data-src data-srcset').removeClass('lazyload');
2512    }
2513    else{
2514      $pr_parent.find('.tt-img img').attr('src', img_src).removeAttr('srcset data-src data-srcset').removeClass('lazyload');
2515    }
2516    if($pr_parent.find('[data-mainimage]').length){
2517      $pr_parent.find('[data-mainimage]').removeAttr('data-mainimage').parent().css('height', 'auto');
2518    }
2519  }
2520
2521  var $btn = $pr_parent.find('.tt-btn-addtocart');
2522  $btn.attr('href', '/cart/add.js?quantity=1&id='+_parent.attr('data-var_id'));
2523  
2524  if($pr_parent.find('.compare-js').length){
2525  	$pr_parent.find('.compare-js').attr('data-compareid', _parent.attr('data-var_id'));
2526    $(window).trigger( "compareevent" );
2527  }
2528  
2529  availability ? $btn.html(_parent.attr('data-buttonname')).removeClass('disable') : $btn.html(unavailable_text).addClass('disable');
2530
2531  var labelsale = $pr_parent.find('.tt-label-sale');
2532  var mainprice = $pr_parent.find('.tt-price span:first-child');
2533  var oldprice = $pr_parent.find('.old-price');
2534  mainprice.html(Shopify.formatMoney(_parent.attr('data-price'), money_format));
2535  var compprice = String(_parent.attr('data-compprice'));
2536  oldprice.html(Shopify.formatMoney(compprice, money_format));
2537  if(!compprice) {
2538    !oldprice.hasClass('hide') && oldprice.addClass('hide');
2539    mainprice.hasClass('new-price') && mainprice.removeClass('new-price');
2540    labelsale.length && labelsale.hide();
2541  }
2542  else {
2543    var _mainprice = Number(_parent.attr('data-price'));
2544    compprice = Number(compprice);
2545    if(_mainprice >= compprice){
2546      !oldprice.hasClass('hide') && oldprice.addClass('hide');
2547      mainprice.hasClass('new-price') && mainprice.removeClass('new-price');
2548      labelsale.length && labelsale.hide();
2549    }
2550    else{
2551      oldprice.hasClass('hide') && oldprice.removeClass('hide');
2552      !mainprice.hasClass('new-price') && mainprice.addClass('new-price');
2553      var per = Math.round(100 - (_mainprice / compprice)*100)+'%';
2554      labelsale.length && labelsale.show().find('.thumb_percent').html(per);
2555    }
2556  }
2557  
2558  
2559    /*  variant_price = labelsale.data('price')
2560      percent = Math.round(100 - (variant.price / variant.compare_at_price)*100);*/
2561  
2562  
2563  $('body').trigger('refreshCurrency');
2564}
2565
2566/* Section */
2567$(document)
2568.on('shopify:section:load', eventHandler)
2569.ready(function() {
2570  $('[data-sectionname]').each(function(){ $(this).initSection() });
2571  $('[data-mainimage]').length && $(window).resize(initImagesSizeResize);
2572  initImagesSize('start');
2573  lazyload();
2574});
2575
2576function eventHandler(e) {
2577  $('#' + e.target.id).find('[data-sectionname]').initSection();
2578  initImagesSize();
2579  lazyload();
2580  if (Shopify.designMode && typeof "product_page_1_description_handler" === "function"){
2581    $(document)
2582    .on('shopify:section:select', product_page_1_description_handler);
2583  }
2584}
2585
2586initImagesSize();
2587function initImagesSizeResize(){
2588  setTimeout(function(){initImagesSize('resize')}, 100)
2589}
2590function initImagesSize(e){
2591  if(!$('[data-mainimage]').length) return false;
2592  $('[data-mainimage]').each(function(){
2593    var _ = $(this),
2594        wn = _.closest('.respimgsize.product-parent').find('.tt-image-box').length ? _.closest('.respimgsize').find('.tt-image-box').width() : _.closest('.respimgsize').width(),
2595        w = Math.min(wn, 2000) + 'x',
2596    	w2= wn*2 + 'x',
2597        i = _.attr('data-mainimage').replace('respimgsize', w),
2598        i2 = _.attr('data-mainimage').replace('respimgsize', w2),
2599        attr = _.attr('data-mainimageratio');
2600    
2601    if(w == '0x') return false;
2602
2603    var dwidth = _.attr('data-width');
2604    if (typeof dwidth !== typeof undefined && dwidth !== false && !_.is(":visible")){
2605        dwidth = Math.min(Number(dwidth), 2000);
2606        w = dwidth + 'x',
2607    	w2= dwidth*2 + 'x',
2608        i = _.attr('data-mainimage').replace('respimgsize', w),
2609        i2 = _.attr('data-mainimage').replace('respimgsize', w2);
2610    }
2611    
2612    _.attr('data-srcset', i+' 1x,'+i2+' 2x');
2613    if(e == 'resize'){
2614      _.attr('srcset', i+' 1x,'+i2+' 2x');
2615    }
2616    if(e == 'start' && !_.closest('.product-parent').length){
2617      setTimeout(function(){_.attr('srcset', i+' 1x,'+i2+' 2x')}, 3000);
2618    }
2619    if(!$('#same_product_height').length && _.closest('.product-parent').length){
2620      var h = wn/Number(attr);
2621      _.parent().css('height', h).css('display', 'block');
2622    }
2623  })
2624}
2625
2626$.fn.initSection = function(){
2627  var _ = this;
2628  var n = _.data('sectionname');
2629  switch (n) {
2630	case ("index_sectionconstbann"): _.find('.contbanslider').initSlick(1, 1, 1,false); break;
2631    case ("index_sectionproducts"): var m = Number(_.find('.tt-carousel-products-js').attr('data-mobile'));
2632      var a = _.find('.tt-carousel-products-js').attr('data-adaptive') == "true" ? true: false;
2633      _.find('.tt-carousel-products-js').initSlick(3, m, m, a); break;
2634    case ("index_horizontaltabs"): _.initTabs(); break;
2635    case ("index_verticaltabs"): _.initTabs(1); break;
2636    case ("index_sectionlookbook"): _.find('.tt-carousel-lookbook').initSlickLookbook(3, 2, 1); break;
2637    case ("index_sectionlookbookmasonry"): _.find('.tt-lookbook-init').initMasonryLookbook(); break;
2638    case ("index_sectionmasonry_products"): _.find('.tt-product-index-init').initMasonryLookbook(); break;
2639    case ("index_brands"): _.find('.tt-carousel-brands').initSlickBrands(6, 4, 3, 2, 1); break;
2640    case ("index_testimonials"): _.find('.tt-slider-fullwidth').initSlick(1, 1, 1); break;
2641    case ("index_revolution"): _.find('.slider-revolution').initRevolution(); break;
2642    case ("index_iconbanners2"): _.find('.tt-single-text-with-icons').initSigleTextWithIcon(); break;
2643    case ("product-recommendations"): _.initProductPageRecommendations(); break;
2644    case ("index_productandvideosection"): _.initVideoProductSection(); break;
2645    case ("index_blurbssection"): _.find('.js-blurbs-slider').initBlurbssection(); _.find('.tt-blurbsreview-masonry').blurbsreviewMasonry(); break;
2646    case ("index_sectionsingleproduct"): _.initSingleProductSection(); break;
2647
2648    case ("productpagesection"): product_page_1_description_handler(); break;
2649
2650    default: break;
2651  }
2652}
2653
2654$.fn.initSingleProductSection = function(){
2655  var _this = this,
2656      _select = _this.find('.col-select select'),
2657      _price = _this.find('.tt-price'),
2658      _loader = _this.find('.custom-loader'),
2659      _image_box = _this.find('.productandvideoimg'),
2660      _avaibility = _this.find('.availability'),
2661      _input = _this.find('.tt-input-counter').find('input'),
2662      u = _this.attr('data-prurl');
2663  
2664  addToCartHandler.initFormAddToCartButton(false, _this, false);
2665
2666  if(_avaibility.length){
2667    var global_quantity_qw = {};
2668    var qa = _this.attr('data-quantity').split(';');
2669    if(qa.length > 0){
2670      for(var i = 0; i < qa.length; i++){
2671        if(qa[i] === '') break;
2672        var _qa = qa[i].split('-');
2673        global_quantity_qw[_qa[0]] = _qa[1];
2674      }
2675    }
2676  }
2677  
2678  window.parent != window.top && _this.find('.tt-countdown_box_02').length && countDown(true);
2679  
2680  Shopify.getProduct(u, productInfoJsonLoaded);
2681  function productInfoJsonLoaded(json){
2682    var _var = _select.find('option:selected').length == 0 ? json.variants[0] : json.variants[_select.find('option:selected').index()];
2683    _avaibility.length && swatchAvaibility(_var, _avaibility, _input, global_quantity_qw);
2684    _select.on('change', function(){
2685      var i = $(this).find('option:selected').index(),
2686          variant = json.variants[i],
2687          src = variant.featured_image ? variant.featured_image.src.split('https:').pop() : json.featured_image.split('https:').pop();
2688
2689      _this.find('[name="id"]').attr('value', variant.id);
2690      
2691      if(src != _image_box.find('img').attr('src')){
2692        var img = new Image();
2693        img.onload = function() {
2694          _loader.length && _loader.stop().fadeOut();
2695          _image_box.find('img').replaceWith(img);
2696        }
2697        _loader.length && _loader.stop().fadeIn();
2698        img.src = src;
2699      }
2700
2701      if(_price.length){
2702        var price_str = Shopify.formatMoney(variant.price, money_format);
2703        var price_comare_str = Shopify.formatMoney(variant.compare_at_price, money_format);
2704        if(variant.price < variant.compare_at_price){
2705          _price.find('>span:first').addClass('new-price').html(price_str);
2706          _price.find('>span:last').removeClass('hide').html(price_comare_str);
2707        }
2708        else {
2709          _price.find('>span:first').removeClass('new-price').html(price_str);
2710          _price.find('>span:last').addClass('hide');
2711        }
2712      }
2713      
2714      _avaibility.length && swatchAvaibility(variant, _avaibility, _input, global_quantity_qw);
2715      var temp = global_quantity;
2716      global_quantity = global_quantity_qw;
2717      swatchVariantButtonHandler(_this, variant);
2718      global_quantity = temp;
2719    })
2720  }
2721}
2722
2723$.fn.initBlurbssection = function(){
2724  var _this = this;
2725
2726  wresizeHandler();
2727  $(window).bind('resize', wresizeHandler);
2728
2729  function wresizeHandler(){
2730    if($(window).width() < 576)
2731      !_this.hasClass('slick-slider') && setTimeout(initBlurbssectionSlider, 0);
2732    else
2733      _this.hasClass('slick-slider') && _this.slick('unslick');
2734  }
2735  function initBlurbssectionSlider(){
2736    _this.slick({
2737      lazyLoad: 'progressive',
2738      dots: true,
2739      arrows: false,
2740      infinite: true,
2741      speed: 300,
2742      slidesToShow: 1,
2743      slidesToScroll: 1,
2744      adaptiveHeight: false
2745    });
2746  }
2747}
2748
2749
2750$.fn.initVideoProductSection = function(){
2751  var _ = this.find('video');
2752  _.on('click touchstart', function(){
2753    _[0].play();
2754    _.css('cursor', 'default');
2755  })
2756  $(window).scroll({obj: _},videoProductscrollW).resize({obj: _},videoProductscrollW);
2757}
2758function videoProductscrollW(e){
2759  var v = e.data.obj,
2760      wp = $(window).scrollTop(),
2761      wh = $(window).height(),
2762      p = v.offset().top,
2763      h = v.height(),
2764      dt = 0,
2765      db = 100;
2766  if(wp+wh > p+dt && wp < p+h-db){
2767    v[0].play();
2768    !v.hasClass('played') && v.addClass('played');
2769  }
2770  else{
2771    if(v.hasClass('played')){
2772      v.removeClass('played');
2773      v[0].pause();
2774    }
2775  }
2776}
2777
2778$.fn.initTabs = function(mobilegrid){
2779  mobilegrid = mobilegrid || 2;
2780  var _ = this;
2781  if(!_.find('[role="tabpanel"]').length) return false;
2782  var a = _.find('[role="tabpanel"]').first().find('.ajaxcontent');
2783  getTabcontent(a, mobilegrid);
2784  
2785  if(_.find('.nav-link').length){
2786    _.on('mouseenter', function(){
2787      $(this).unbind('mouseenter');
2788      _.find('.nav-link').on('click', clickTabcontent).each(function(){
2789        var href = $(this).attr('href');
2790        getTabcontent($(href).find('.ajaxcontent'), mobilegrid);
2791      })
2792    })
2793  }
2794}
2795function clickTabcontent(){
2796  var $this = $(this);
2797  setTimeout(function(){
2798    $this.closest('[data-respjs]').find('.tab-pane.active').find('[data-mainimage]').each(function(){
2799      var _ = $(this),
2800          wn = _.closest('.respimgsize').width(),
2801          w = wn + 'x',
2802          w2= wn*2 + 'x',
2803          i = _.attr('data-mainimage').replace('respimgsize', w),
2804          i2 = _.attr('data-mainimage').replace('respimgsize', w2),
2805          attr = _.attr('data-mainimageratio');
2806      _.attr('data-srcset', i+' 1x,'+i2+' 2x').attr('srcset', i+' 1x,'+i2+' 2x');
2807      if(!$('#same_product_height').length) {
2808        var h = wn/Number(attr);
2809        _.parent().css('height', h).css('display', 'block');
2810      }
2811    })
2812  }, 100);
2813  alignmentArrowValue();
2814}
2815function getTabcontent(a, mobilegrid){
2816  if(!a.length || !a.hasClass('startajax')) return false;
2817  a.removeClass('startajax')
2818  var url = '/collections/all?view=collectiontabshorizontal&constraint=' + a.attr('data-content'),
2819      params = {
2820        type: "get",
2821        url: url,
2822        success: function(data){
2823          var check = !$('.tt-product .tt-product-inside-hover').length ? true : false;
2824          var check2 = !$('.product-parent').length ? true : false;
2825
2826          var p = a.parent();
2827          a.replaceWith(data);
2828          if(a.hasClass('slider')){
2829            
2830            p.find('.tt-carousel-products-js').initSlick(3, 2, mobilegrid);
2831            alignmentArrowValue();
2832            if($(".tt-rating").length > 0) {
2833              try {
2834                $.getScript(window.location.protocol + "//productreviews.shopifycdn.com/assets/v4/spr.js");
2835              } catch (err) {}
2836            }
2837          }
2838          initImagesSize();
2839          lazyload();
2840          $('body').trigger('refreshCurrency');
2841          ttProductSmall();
2842          countDown(true);
2843          setTimeout(ttReinitflowProduct, 0);
2844          
2845          if($('.tt-product .tt-product-inside-hover').length && check){
2846            ttProductHover();
2847          }
2848          if($('.product-parent').length && check2){
2849            wl_handler.init();
2850            compare.init();
2851          }
2852        }
2853      }
2854  jQuery.ajax(params);
2855}
2856
2857$.fn.initProductPageRecommendations = function() {
2858  var productId = this.attr('data-product-id'),
2859      title =  this.attr('data-title'),
2860      limit = this.attr('data-limit'),
2861      titleposition = this.attr('data-titleposition'),
2862      fullscreen = this.attr('data-fullscreen'),
2863      slickshow = this.attr('data-slickshow'),
2864      recommendationsSectionUrl =
2865      '/recommendations/products?&section_id=product-recommendations&product_id=' +
2866      productId +
2867      '&limit='+limit;
2868  
2869  $.get(recommendationsSectionUrl).then(
2870    function(section) {
2871      var recommendationsMarkup = $(section).html();
2872      if (recommendationsMarkup.trim() !== '') {
2873        this.html(recommendationsMarkup);
2874        lazyload();
2875        this.find('.tt-title-small').html(title).parent().addClass(titleposition);
2876        fullscreen == "true" && this.find('.tt-block-title').parent().removeClass('container').addClass('container-fluid-custom');
2877        this.find('.tt-carousel-products').attr('data-slick', '{"slidesToShow": '+sl
2877ickshow+', "slidesToScroll": '+slickshow+'}').initSlick(3, 2, 2);
2878        alignmentArrowValue();
2879        initImagesSize();
2880      }
2881    }.bind(this)
2882  );
2883}
2884
2885$.fn.initSigleTextWithIcon = function() {
2886  var $singletextwithicons = this;
2887  sigleTextWithIconHandler();
2888  $(window).resize(sigleTextWithIconHandler);
2889  function sigleTextWithIconHandler(){
2890    $(window).width() > 1024 ? unslickSigleTextWithIcon() : initSlickSigleTextWithIcon();
2891  }
2892
2893  function initSlickSigleTextWithIcon(){
2894    if($singletextwithicons.hasClass('slick-slider')) return false;
2895    $singletextwithicons.slick({
2896      dots: false,
2897      arrows: false,
2898      infinite: true,
2899      adaptiveHeight: true,
2900      slidesToShow: 6,
2901      slidesToScroll: 1,
2902      responsive: 
2903      [
2904        {
2905          breakpoint: 1025,
2906          settings: {
2907            slidesToShow: 2,
2908            slidesToScroll: 1
2909          }
2910        },
2911        {
2912          breakpoint: 500,
2913          settings: {
2914            slidesToShow: 1,
2915            slidesToScroll: 1
2916          }
2917        }
2918      ]
2919    });
2920  }
2921  function unslickSigleTextWithIcon(){
2922
2923    if(!$singletextwithicons.hasClass('slick-slider')) return false;
2924    setTimeout(function(){$singletextwithicons.slick('unslick');}, 200);
2925
2926  }
2927}
2928
2929$.fn.initSlick = function(md, sm, xs,adaheight) {
2930  adaheight = adaheight == false ? false : true;
2931  this.slick({
2932    dots: false,
2933    arrows: true,
2934    infinite: true,
2935    adaptiveHeight: adaheight,
2936    responsive:
2937    [
2938      {
2939        breakpoint: 1025,
2940        settings: {
2941          slidesToShow: md,
2942          slidesToScroll: md
2943        }
2944      },
2945      {
2946        breakpoint: 769,
2947        settings: {
2948          slidesToShow: sm,
2949          slidesToScroll: sm
2950        }
2951      },
2952      {
2953        breakpoint: 480,
2954        settings: {
2955          slidesToShow: xs,
2956          slidesToScroll: xs
2957        }
2958      }
2959    ]
2960  });
2961}
2962
2963$.fn.initSlickBrands = function(md, sm, sm2, xs, xs2) {
2964  this.slick({
2965    dots: false,
2966    arrows: true,
2967    infinite: true,
2968    adaptiveHeight: true,
2969    responsive: [
2970      {
2971        breakpoint: 1230,
2972        settings: {
2973          slidesToShow: md,
2974          slidesToScroll: md
2975        }
2976      },
2977      {
2978        breakpoint: 1025,
2979        settings: {
2980          slidesToShow: sm,
2981          slidesToScroll: sm
2982        }
2983      },
2984      {
2985        breakpoint: 790,
2986        settings: {
2987          slidesToShow: sm2,
2988          slidesToScroll: sm2
2989        }
2990      },
2991      {
2992        breakpoint: 576,
2993        settings: {
2994          slidesToShow: xs,
2995          slidesToScroll: xs
2996        }
2997      },
2998      {
2999        breakpoint: 380,
3000        settings: {
3001          slidesToShow: xs2,
3002          slidesToScroll: xs2
3003        }
3004      }
3005    ]
3006  });
3007};
3008
3009// carusel
3010$.fn.initSlickLookbook = function(md, sm, xs) {
3011  this.slick({
3012    dots: true,
3013    arrows: true,
3014    infinite: true,
3015    adaptiveHeight: true,
3016    responsive: 
3017    [
3018      {
3019        breakpoint: 1025,
3020        settings: {
3021          slidesToShow: sm,
3022          slidesToScroll: sm
3023        }
3024      },
3025      {
3026        breakpoint: 790,
3027        settings: {
3028          slidesToShow: xs,
3029          slidesToScroll: xs
3030        }
3031      }
3032    ]
3033  });
3034};
3035$.fn.initMasonryLookbook = function() { 
3036  if($('body').find('.isotope_included').length == 0)
3037  {
3038    this.replaceWith('<span class="text-center" style="display: inherit;">Save and reload page.</span>');
3039    return false;
3040  }
3041
3042  var _ = this;
3043
3044  var iso = _.isotope({
3045    itemSelector: '.element-item',
3046    layoutMode: 'masonry',
3047    gutter: 0
3048  });
3049  // layout Isotope after each image loads
3050  iso.imagesLoaded().progress( function(index) {
3051    iso.addClass('tt-show').isotope('layout');
3052  });
3053}
3054
3055$.fn.blurbsreviewMasonry = function() { 
3056  if(!this.length) return false;
3057  var _this = this
3058  var isActive = false;
3059  
3060  brmHandler();
3061  $(window).bind('resize', brmHandler);
3062
3063  function brmHandler(){
3064    if($(window).width() < 576){
3065      if (isActive){
3066        _this.removeClass('tt-show').isotope('destroy');
3067        isActive = false;
3068      }
3069    }
3070    else{
3071      if (!isActive){
3072        _this.initMasonryLookbook();
3073        isActive = true;
3074      }
3075    }
3076  }
3077}
3078
3079//REVOLUTION SLIDER (function to reset the plug on the breakpoints)
3080
3081$.fn.initRevolution = function(){
3082
3083  if($('body').find('.revolution_included').length == 0)
3084  {
3085    this.replaceWith('<span class="text-center" style="display: inherit;">Save and reload page.</span>');
3086    return false;
3087  }
3088  
3089  function click_to_play_video() {
3090    var $this = $(this),
3091      $video = $this.find('li video');
3092
3093    if (!$video.length) return;
3094
3095    $video.on('play', function() {
3096      var $btn = $(this).parents('li').find('.video-play');
3097
3098      $btn.addClass('pause');
3099      $(this).parents('.tp-caption.fullscreenvideo').addClass('click-video');
3100    });
3101
3102    $video.on('pause ended', function() {
3103      var $btn = $(this).parents('li').find('.video-play');
3104
3105      $btn.removeClass('pause');
3106    });
3107
3108    $this.find('.video-play').on('click', function(e) {
3109      var $video = $(this).parents('li').find('video');
3110
3111      $video.trigger('click');
3112      e.preventDefault();
3113      e.stopPropagation();
3114      return false;
3115    });
3116
3117    $this.on('revolution.slide.onbeforeswap', function(event, data) {
3118      $(this).find('.tp-caption.fullscreenvideo').removeClass('click-video');
3119    });
3120  };
3121
3122  function autoplay_video(elem) {
3123    var $get_sliders = $(this);
3124
3125    $get_sliders.each(function() {
3126      var $slider = $(this);
3127
3128      var set_event = function() {
3129        $slider.on('revolution.slide.onchange', function(event, data) {
3130          var $this = $(this),
3131            $active_slide = $this.find('li').eq(data.slideIndex - 1),
3132            $video = $active_slide.find('video'),
3133            autoplay = $active_slide.find('.tp-caption').attr('data-autoplay');
3134
3135          if ($video.length && autoplay === 'true') {
3136            var video = $video.get(0);
3137
3138            video.currentTime = 0;
3139
3140            $slider.one('revolution.slide.onafterswap', function(event, data) {
3141              if (video.paused) {
3142                video.play();
3143              }
3144            });
3145          }
3146        });
3147      };
3148
3149      if ($slider.hasClass('revslider-initialised')) {
3150        set_event();
3151      } else {
3152        $slider.one('revolution.slide.onloaded', function() {
3153          set_event();
3154        });
3155      }
3156    });
3157  };
3158
3159  $.fn.resizeRevolution = function(options, new_rev_obj, bp_arr, revdelay) {
3160    if (!$(this).length || !$(options.slider).length || !options.breakpoints) return false;
3161
3162    var wrapper = this,
3163      slider = options.slider,
3164      breakpoints = options.breakpoints,
3165      fullscreen_BP = options.fullscreen_BP || false,
3166      new_rev_obj = new_rev_obj || {},
3167      bp_arr = bp_arr || [],
3168      rev_obj = {
3169        dottedOverlay: "none",
3170        delay: revdelay,
3171        startwidth: 1920,
3172        hideThumbs: 200,
3173        hideTimerBar: "on",
3174
3175        thumbWidth: 100,
3176        thumbHeight: 50,
3177        thumbAmount: 5,
3178
3179        navigationArrows: "none",
3180
3181        touchenabled: "on",
3182        onHoverStop: "on",
3183
3184        swipe_velocity: 0.7,
3185        swipe_min_touches: 1,
3186        swipe_max_touches: 1,
3187        drag_block_vertical: false,
3188
3189        parallax: "mouse",
3190        parallaxBgFreeze: "on",
3191        parallaxLevels: [7, 4, 3, 2, 5, 4, 3, 2, 1, 0],
3192
3193        keyboardNavigation: "off",
3194
3195        navigationHAlign: "center",
3196        navigationVAlign: "bottom",
3197        navigationHOffset: 0,
3198        navigationVOffset: 20,
3199
3200        soloArrowLeftHalign: "left",
3201        soloArrowLeftValign: "center",
3202        soloArrowLeftHOffset: 20,
3203        soloArrowLeftVOffset: 0,
3204
3205        soloArrowRightHalign: "right",
3206        soloArrowRightValign: "center",
3207        soloArrowRightHOffset: 20,
3208        soloArrowRightVOffset: 0,
3209
3210        shadow: 0,
3211
3212        spinner: "",
3213        h_align: "left",
3214
3215        stopLoop: "off",
3216        stopAfterLoops: -1,
3217        stopAtSlide: -1,
3218
3219        shuffle: "off",
3220
3221        autoHeight: "off",
3222        forceFullWidth: "off",
3223
3224        hideThumbsOnMobile: "off",
3225        hideNavDelayOnMobile: 1500,
3226        hideBulletsOnMobile: "off",
3227        hideArrowsOnMobile: "off",
3228        hideThumbsUnderResolution: 0,
3229
3230        hideSliderAtLimit: 0,
3231        hideCaptionAtLimit: 0,
3232        hideAllCaptionAtLilmit: 0,
3233        startWithSlide: 0,
3234        fullScreenOffsetContainer: ""
3235      };
3236
3237    $.extend(rev_obj, new_rev_obj);
3238
3239    var get_Slider = function($sliderWrapp) {
3240      return $sliderWrapp.find(slider);
3241    };
3242
3243    var get_current_bp = function() {
3244      var wind_W = window.innerWidth;
3245
3246      for (var i = 0; i < breakpoints.length; i++) {
3247        var bp = breakpoints[i];
3248
3249        if (!breakpoints.length) return false;
3250
3251        if (wind_W <= bp) {
3252          if (i === 0) {
3253            return bp;
3254          } else {
3255            if (bp > breakpoints[i - 1])
3256              return bp;
3257          }
3258        } else if (wind_W > bp && i === breakpoints.length - 1)
3259          return Infinity;
3260      }
3261      return false;
3262    };
3263
3264    var $sliderWrappers = $(wrapper);
3265
3266    $sliderWrappers.each(function() {
3267      var $sliderWrapp = $(this),
3268        $sliderInit = get_Slider($sliderWrapp),
3269          $sliderCopy = $sliderWrapp.clone(),
3270          bp = get_current_bp();
3271
3272      if (!$sliderInit.length) return false;
3273
3274      var start_Rev = function($sliderInit, bp) {
3275        var wind_W = window.innerWidth,
3276          rev_settings_obj = {},
3277          rev_screen_obj = {},
3278          set_rev_obj = {};
3279
3280        if (fullscreen_BP) {
3281          var full_width = (wind_W >= fullscreen_BP) ? 'off' : 'on',
3282            full_screen = (wind_W >= fullscreen_BP) ? 'on' : 'off';
3283
3284          rev_screen_obj = {
3285            fullWidth: full_width,
3286            fullScreen: full_screen
3287          };
3288        }
3289
3290        if (bp_arr.length) {
3291          for (var i = 0; i < bp_arr.length; i++) {
3292            var this_obj = bp_arr[i];
3293
3294            if (this_obj.bp && this_obj.bp.length === 2 && this_obj.bp[0] < this_obj.bp[1]) {
3295              var from = this_obj.bp[0],
3296                to = this_obj.bp[1];
3297
3298              if (from <= bp && to >= bp) {
3299                for (var key in this_obj) {
3300                  if (key !== 'bp')
3301                    rev_settings_obj[key] = this_obj[key];
3302                }
3303              }
3304            }
3305          }
3306        }
3307
3308        $.extend(set_rev_obj, rev_obj, rev_settings_obj, rev_screen_obj);
3309
3310        $($sliderInit).show().revolution(set_rev_obj);
3311
3312        $(options.functions).each(function() {
3313          this.call($sliderInit);
3314        });
3315      };
3316
3317      start_Rev($sliderInit, bp);
3318
3319      var restart_Rev = function(current_bp) {
3320        if (!$($sliderInit).hasClass('revslider-initialised')) return;
3321        bp = current_bp || 0;
3322        $sliderInit.revkill();
3323        $sliderWrapp.replaceWith($sliderCopy);
3324        $sliderWrapp = $sliderCopy;
3325        $sliderCopy = $sliderWrapp.clone();
3326        $sliderInit = get_Slider($sliderWrapp);
3327        start_Rev($sliderInit, bp);
3328      };
3329
3330      function endResize(func) {
3331        var windWidth = window.innerWidth,
3332          interval;
3333
3334        interval = setInterval(function() {
3335          var windWidthInterval = window.innerWidth;
3336          if (windWidth === windWidthInterval) {
3337            setTimeout(function() {
3338              func();
3339            }, 200);
3340          }
3341          clearInterval(interval);
3342        }, 100);
3343      };
3344
3345      $(window).on('resize', function() {
3346        endResize(function() {
3347          var current_bp = get_current_bp();
3348          if (current_bp !== bp)
3349            restart_Rev(current_bp);
3350        })
3351      });
3352    });
3353  };
3354
3355  var delay = this.data('speed'),
3356      fullscreen = this.attr('data-fullscreen') == 'false' ? false : 768,
3357      width = this.attr('data-width'),
3358      height = this.attr('data-height');
3359
3360  if(this.hasClass('revolution-default')) {
3361    this.resizeRevolution(
3362      {
3363        slider: '.tp-banner',
3364        breakpoints: [414, 767, 1025],
3365        fullscreen_BP: fullscreen,
3366        functions: [
3367          click_to_play_video,
3368          autoplay_video
3369        ]
3370      },
3371      {
3372        fullScreenOffsetContainer: "header",
3373        navigationArrows: "true",
3374        startwidth: width || 1920,
3375        startheight: height || 800
3376      },
3377      [
3378        {
3379          bp: [0, 768],
3380          startheight: height || 1200
3381        }
3382      ],
3383      delay
3384     );
3385  }
3386  else {
3387    this.resizeRevolution(
3388      {
3389        slider: '.tp-banner',
3390        breakpoints: [414, 767, 1025],
3391        fullscreen_BP: fullscreen,
3392        functions: [
3393          click_to_play_video,
3394          autoplay_video
3395        ]
3396      },
3397      {
3398        fullScreenOffsetContainer: "header-static",
3399        startwidth: width || 1920,
3400        startheight: height || 800
3401      }, 
3402      [
3403        {
3404          bp: [0, 768],
3405          startheight: height || 1200
3406        },
3407        {
3408          bp: [0, 1025],
3409          fullScreenOffsetContainer: "header"
3410        }
3411      ],
3412      delay
3413    );
3414  }
3415}
3416
3417$('body').on(
3418  'click', '.tt-review, .tt-rating', function(e){
3419    if($("[data-ali]").length) {
3420      alireviewApp($("[data-ali]").attr('data-ali'));
3421      return false;
3422    }
3423    if($(this).closest('.tt-review').length) {
3424      $('#tab_review').length && findAndViewReviews();
3425    }
3426    else{
3427      window.location = $(this).closest('.tt-rating').data('url') + '?tab_review';
3428    }
3429  }
3430)
3431function alireviewApp(val){
3432  var $id = '#'+val;
3433  var y = $($id).offset().top;
3434  var d = $('.tt-stuck-nav').length && $('.tt-stuck-nav.disabled').length == 0 ? $('.tt-stuck-nav').height() : 0;
3435  $('html, body').animate({
3436    scrollTop: y-d*2
3437  }, 500);
3438}
3439$(document).ready(function() {
3440  var s = window.location.search;
3441  if($("[data-ali]").length && s.indexOf('tab_review') > -1){
3442    setTimeout(function(){alireviewApp($("[data-ali]").attr('data-ali'))}, 2000);
3443    return false;
3444  }
3445  if(s.indexOf('tab_review') == -1 || $('#tab_review').length == 0) return false;
3446  setTimeout(findAndViewReviews, 2000);
3447});
3448function findAndViewReviews(){
3449  var y = $('#tab_review').offset().top;
3450  var d = $('.tt-stuck-nav').length && $('.tt-stuck-nav.disabled').length == 0 ? $('.tt-stuck-nav').height() : 0;
3451  $('html, body').animate({
3452    scrollTop: y-d
3453  }, 500);
3454  if($('#tab_review').hasClass('nav-link')){
3455    $('#tab_review').trigger('click');
3456  }
3457  else{
3458    !$('#tab_review').hasClass('active') && $('#tab_review').find('.tt-collapse-title').trigger('click');
3459  }
3460}
3461
3462/* Search autocomplite */
3463$(function() {
3464  // Current Ajax request.
3465  var currentAjaxRequest = null;
3466  // Grabbing all search forms on the page, and adding a .search-results list to each.
3467  var searchForms = $('form[action="/search#"]').each(function() {
3468    // Grabbing text input.
3469    var input = $(this).find('input[name="q"]');
3470    // Adding a list for showing search results.
3471    var offSet = input.position().top + input.innerHeight() + 1;
3472    $('<div class="search-results"></div>').appendTo($(this)).hide();
3473    // Listening to keyup and change on the text field within these search forms.
3474    input.attr('autocomplete', 'off').bind('keyup change', function() {
3475      // What's the search term?
3476      var term = $(this).val();
3477      // What's the search form?
3478      var form = $(this).closest('form');
3479      // What's the search URL?
3480      var searchURL = '/search?type=product&q=' + term;
3481      // What's the search results list?
3482      var resultsList = form.find('.search-results');
3483      // If that's a new term and it contains at least 3 characters.
3484      if (term.length > 3 && term != $(this).attr('data-old-term')) {
3485        // Saving old query.
3486        $(this).attr('data-old-term', term);
3487        // Killing any Ajax request that's currently being processed.
3488        if (currentAjaxRequest != null) currentAjaxRequest.abort();
3489        // Pulling results.
3490        currentAjaxRequest = $.getJSON(searchURL + '&view=json', function(data) {
3491          // Reset results.
3492          resultsList.empty();
3493          // If we have no results.
3494          if(data.results_count == 0) {
3495            resultsList.hide();
3496          } else {
3497            var resultsList_ul = resultsList.append('<ul></ul>');
3498            resultsList_ul = resultsList_ul.find('ul');
3499            // If we have results.
3500            $.each(data.results, function(index, item) {
3501              if(index >= 6) return false;
3502              var link = $('<a></a>').attr('href', item.url);
3503              link.append('<div class="thumbnail"><img src="' + item.thumbnail + '" /></div>');
3504              link.append('<div class="tt-description"><div class="tt-title">' + item.title + '</div></div>');
3505              link.wrap('<li></li>');
3506              resultsList_ul.append(link.parent());
3507            });
3508            // The Ajax request will return at the most 10 results.
3509            // If there are more than 10, let's link to the search results page.
3510            if(data.results_count > 6) {
3511              resultsList.append('<div class="tt-view-all"><a href="' + searchURL + '">'+seeallresults+' (' + data.results_count + ')</a></div>');
3512            }
3513            resultsList.fadeIn(200);
3514          }
3515        });
3516      }
3517    });
3518  });
3519  // Clicking outside makes the results disappear.
3520  $('body').bind('click', function(){
3521    $('.search-results').hide();
3522  });
3523});
3524
3525if($('[data-respjs="index_sectiontabs"]').length || $('.tt-carousel-products-js').length || $('.tt-carousel-products').length) initProductsSlickResize();
3526function initProductsSlickResize(){
3527  $(window).resize(function(){
3528    $('.tt-carousel-products').length && $('.tt-carousel-products').slick('setPosition');
3529    $('.tt-carousel-products-js').length && $('.tt-carousel-products-js').slick('setPosition');
3530    alignmentArrowValue();
3531  })
3532}
3533
3534$(document).ready(function() {
3535  if($(".menu_language_holder").length == 0) return false;
3536  setTimeout(wgDefault, 100);
3537});
3538function wgDefault(){
3539  if($(".wg-default").length == 0) return false;
3540  var css_link = $(".menu_language_holder").data("css");
3541  var wgDefault = $(".wg-default").detach().addClass("menu_language_holder");
3542  var $ul = $(".menu_language_holder");
3543  $ul.replaceWith(wgDefault);
3544  $('<link href="' + css_link + '" rel="stylesheet" type="text/css" media="all">').appendTo('body');
3545}
3546
3547var tooltip = {
3548  html_i: '#tt-tooltip-popup',
3549  html_s: '<div id="tt-tooltip-popup"><span>',
3550  html_e: '</span><i></i></div>',
3551  tp_attr: '[data-tooltip]',
3552  tp_mod: false,
3553  init: function(){
3554    this.tp_mod = this.get_tp_mod();
3555    if(!this.tp_mod.length || /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) return false;
3556    this.handler();
3557  },
3558  get_tp_attr: function(){
3559    return this.tp_attr;
3560  },                     
3561  get_tp_mod: function(){
3562    return $(this.get_tp_attr());
3563  },
3564  get_w_width: function(){
3565    return window.innerWidth || $window.width();
3566  },
3567  get_html_obj: function(name){
3568    return this.html_s + name + this.html_e;
3569  },
3570  check_pr_page_swatches: function($obj){
3571    var swc = $obj.closest('.tt-swatches-container');
3572    var search = $obj.closest('.tt-search');
3573    var qv = $obj.closest('.tt-btn-quickview');
3574    var cc = $obj.closest('.tt-collapse-content');
3575    var wl = $obj.closest('.wlbutton-js');
3576    var co = $obj.closest('.compare-js');
3577    if(!swc.length && !search.length && !qv.length && !cc.length && !wl.length && !co.length) return false;
3578    return true;
3579  },
3580  handler: function(){
3581    var _ = this;
3582    $('body').on('mouseenter mouseleave', this.get_tp_attr(), function(e){
3583      var ww = _.get_w_width();
3584      if(ww <= 1024) return false;
3585      if (e.type === 'mouseenter') _.onHover($(this));
3586      if (e.type === 'mouseleave') _.offHover($(this));
3587    });
3588  },
3589  onHover: function($obj){
3590    var _ = this,
3591    	value = $obj.attr('data-tooltip'),
3592        $o = $(this.get_html_obj(value)),
3593        tposition = $obj.attr('data-tposition'),
3594        ftag = $obj.attr('data-findtag');
3595    
3596    if(value == "") return false;
3597    
3598    $body.append($o);
3599
3600    var $objforsize = typeof ftag != 'undefined' ? $obj.find(ftag).first() : $obj,
3601        th = $o.innerHeight(),
3602        tw = $o.innerWidth(),
3603        oh = $objforsize.innerHeight(),
3604        ow = $objforsize.innerWidth(),
3605        v = $objforsize.offset().top,
3606        h = $objforsize.offset().left;
3607
3608    tposition = typeof tposition != 'undefined' ? tposition : 'top';
3609
3610    if(tposition == 'top'){
3611      v += - th - 20;
3612      h += parseInt((ow - tw)/2);
3613    }
3614    if(tposition == 'bottom'){
3615      v += oh + 24;
3616      h += parseInt((ow - tw)/2);
3617    }
3618    if(tposition == 'left'){
3619      v += parseInt((oh-th)/2);
3620      h += - tw - 24;
3621    }
3622    if(tposition == 'right'){
3623      v += parseInt((oh-th)/2);
3624      h += ow + 24;
3625    }
3626
3627    this.showTooltip($o, h, v, tposition);
3628    
3629    if(!this.check_pr_page_swatches($obj)) return false;
3630    $obj.on('click.closeTooltip', function(){
3631      _.offHover($(this));
3632      $(this).unbind( "click.closeTooltip" );
3633    })
3634  },
3635  offHover: function($obj){
3636    $body.find(this.html_i).remove();
3637    
3638    if(!this.check_pr_page_swatches($obj)) return false;
3639    $obj.unbind( "click.closeTooltip" );
3640  },
3641  showTooltip: function($o, h, v, p){
3642    p = p || 'top';
3643    var a = {opacity: 1},
3644        k = p;
3645    if(k == 'bottom') k = 'top';
3646    if(k == 'right') k = 'left';
3647
3648    a[k] = p == 'bottom' || p == 'right' ? '-=10px' : '+=10px';
3649
3650    $o.css({'top': v, 'left' : h}).addClass('tooltip-' + p).animate(a, 200);
3651  }
3652}
3653$(document).ready(function() {
3654  tooltip.init();
3655});
3656
3657var wl_handler = {
3658  action_r: 'wk-remove',
3659  action_a: 'wk-add',
3660  loader_t: wokiee_app.loader_text,
3661  tooltip: '#tt-tooltip-popup',
3662  noevents: 'wkapp_load',
3663  init: function(){
3664    if(!$('.wlbutton-js').length) return false;
3665
3666    var _ = this;
3667
3668    $('body').on('click', '.wlbutton-js', function(e){
3669      e.preventDefault();
3670      if($(this).hasClass(_.noevents)) return false;
3671
3672      if(_.getcustomerid() == ''){
3673        $('#ModalMessage').modal('show');
3674        return false;
3675      }
3676
3677      var $this = $(this),
3678          data = {
3679            action: $this.attr('data-action'),
3680            text_a: $this.attr('data-add'),
3681            text_r: $this.attr('data-remove'),
3682            namespace: $this.attr('data-type'),
3683            key: $this.attr('data-productid'),
3684            value: $this.attr('data-producth'),
3685          };
3686
3687      $this.addClass(_.noevents).attr('data-tooltip', _.loader_t).trigger('mouseenter');
3688      data.action == _.action_a ? _.add_handler($this, data) : _.remove_handler($this, data);
3689    });
3690  },
3691  getcustomerid: function(){
3692    return wokiee_app.main_info.customerid;
3693  },
3694  getloadertext: function(){
3695    return wokiee_app.loader_text;
3696  },
3697  getappurl: function(){
3698    return 'https://'+wokiee_app.url;
3699  },
3700  add_handler: function($el, obj){
3701    var _ = this;
3702
3703    $.ajax({
3704      type: "POST",
3705      url: _.getappurl()+'/api/add',
3706      data: $.extend({}, wokiee_app.main_info, {
3707        namespace: obj.namespace,
3708        key: obj.key,
3709        value: obj.value
3710      }),
3711      cache: false,
3712      success: function(data) {
3713        console.log('done');
3714
3715        $el.removeClass(_.noevents)
3716        .attr('data-action', _.action_r)
3717        .attr('data-tooltip', obj.text_r);
3718
3719        if($el.hasClass('prpagebtn-js')){
3720          var s = $el.attr('data-prpage-rem');
3721          $el.find('span').text(s);
3722        }
3723
3724        $el.is(':hover') && $el.trigger('mouseleave').trigger('mouseenter');
3725        
3726        if($('.header-icon-with-text.tt-wishlist').length){
3727          var b = $('.header-icon-with-text.tt-wishlist').find('.tt-badge');
3728          var i = parseInt(b.text())+1;
3729          b.text(i).show();
3730        }
3731      },
3732      error: function(XMLHttpRequest, textStatus) {
3733        alert("Please install ThemePlus App. Link you can find in the documentation");
3734        $el.removeClass(_.noevents);
3735      }
3736    })
3737  },
3738  remove_handler: function($el, obj){
3739    var _ = this;
3740
3741    $.ajax({
3742      type: "POST",
3743      url: _.getappurl()+'/api/delete',
3744      data: $.extend({}, wokiee_app.main_info, {
3745        namespace: obj.namespace,
3746        key: obj.key,
3747        _method: 'DELETE'
3748      }),
3749      cache: false,
3750      success: function(data) {        
3751        console.log('done');
3752
3753        if($el.closest('.wkpageinfo').length){
3754          $el.closest('.product-parent').parent().fadeOut(400, function() {
3755            $el.is(':hover') && $el.trigger('mouseleave');
3756            var $p = $(this).parent();
3757            $(this).remove();
3758            if(!$p.children().length){
3759              $p.closest('.wkpageinfo').parent().find('.wkpagenoinfo').removeClass('hide')
3760              .parent().find('.wkpageinfo').remove();
3761            }
3762          });
3763        }
3764        else{
3765          $el.removeClass(_.noevents)
3766          .attr('data-action', _.action_a)
3767          .attr('data-tooltip', obj.text_a);
3768
3769          $el.is(':hover') && $el.trigger('mouseleave').trigger('mouseenter');
3770
3771          if($el.hasClass('prpagebtn-js')){
3772            var s = $el.attr('data-prpage-add');
3773            $el.find('span').text(s);
3774          }
3775        }
3776        
3777        if($('.header-icon-with-text.tt-wishlist').length){
3778          var b = $('.header-icon-with-text.tt-wishlist').find('.tt-badge');
3779          var i = Math.max(0, parseInt(b.text())-1);
3780          b.text(i);
3781          i == 0 && b.hide();
3782        }
3783      },
3784      error: function(XMLHttpRequest, textStatus) {
3785        $el.removeClass(_.noevents);
3786      }
3787    })
3788  }
3789}
3790wl_handler.init();
3791
3792var ct = {
3793  mainc: '.tt-compare-table-js',
3794  slider: $('#tt-compare-table').find('.compare-init-slider'),
3795  init: function(){
3796    if(!$(this.mainc).length) return false;
3797    $(window).resize(ct.resizeHandler);
3798  },
3799  handler: function(){
3800    var a = this.getSizes();
3801    this.setSizes(a);
3802    this.slider.slick('slickGoTo', 0);
3803    $('.tt-compare-table').removeAttr('style');
3804    a = false;
3805    setTimeout(function(){
3806      ct.replaceSliderArrows($('.tt-image-box-last').first().position().top);
3807    }, 200)
3808  },
3809  setSizes: function(a){
3810    $(this.mainc).each(function(){
3811      $(this).children().each(function(index){
3812        $(this).outerHeight(a[index]);
3813      });
3814    })
3815  },
3816  getSizes: function(){
3817    var a = [];
3818    $(this.mainc).each(function(){
3819      $(this).children().each(function(index){
3820        a[index] = typeof a[index] != 'undefined' ? a[index] : 0;
3821        a[index] = Math.max(a[index], $(this).outerHeight());
3822      });
3823    })
3824    return a
3825  },
3826  resizeHandler: function(t){
3827    t = t || 100;
3828    $('.tt-compare-table').css({opacity: 0})
3829    $(ct.mainc).children().removeAttr('style');
3830    $(ct.mainc).find('.tt-btn-addtocart').removeAttr('style');
3831    setTimeout(function(){
3832      ct.handler();
3833    }, t);
3834  },
3835  replaceSliderArrows: function(h){
3836    var prev = $('.compare-init-slider').find('.slick-prev'),
3837        next = $('.compare-init-slider').find('.slick-next'),
3838        bh = prev.height(),
3839        c = parseInt((h-bh)/2);
3840
3841    prev.addClass('showarr').css({top: c});
3842    next.addClass('showarr').css({top: c});
3843  },
3844  sliderinit: function(){
3845    this.slider.slick({
3846      dots: false,
3847      arrows: true,
3848      infinite: true,
3849      speed: 300,
3850      slidesToShow: 3,
3851      slidesToScroll: 1,
3852      adaptiveHeight: true,
3853      responsive: [
3854        {
3855          breakpoint: 1025,
3856          settings: {
3857            slidesToShow: 2,
3858          }
3859        },
3860        {
3861          breakpoint: 790,
3862          settings: {
3863            slidesToShow: 1
3864          }
3865        }
3866      ]
3867    });
3868  },
3869  sliderunslick: function(){
3870    this.slider.slick('unslick');
3871  }
3872}
3873var compare = {
3874  search: '&view=getproduct',
3875  a_a: 'wk-add',
3876  a_d: 'wk-remove',
3877  space: 'comparedata',
3878  com_json: {},
3879  com_count: 0,
3880  com_limit: 0,
3881  init: function(){
3882    var _ = this;
3883    this.comparepage();
3884
3885    if(!$('.compare-js').length) return false;
3886
3887    this.selected();
3888    $(window).on( "compareevent", function(){
3889      var o = $('.compare-js');
3890      o.length && o.attr('data-action', _.a_a).attr('data-tooltip', o.attr('data-add'));
3891      _.setPageButtonText(o, 'data-prpage-add');
3892      compare.selected();
3893    });
3894
3895    $('body').on('click', '.compare-js', function(e){
3896      e.preventDefault();
3897      var $this = $(this);
3898      $this.attr('data-action') == _.a_a ? compare.setdata($this) : compare.deletedata($this);
3899      _.setItemLengthInBadge();
3900    })
3901  },
3902  comparepage: function(){
3903    if(!$('.comparepage').length || !this.checkEmptyPage()) return false
3904
3905    $('.comparepage').removeClass('hide');
3906
3907    var _ = this,
3908        l = $.parseJSON(localStorage[compare.space]);
3909
3910    this.com_limit = _.getjsonsize(l);
3911
3912    $.each(l, function(index, value){
3913      _.getproduct(index, value);
3914    });
3915  },
3916  createcomparepage: function(l){
3917    var _ = this,
3918        p = $('.compare-init-slider'),
3919        b = $('.compareitemhtml').find('.tt-item');
3920
3921    this.setOptionsTable(l, b);
3922
3923    var count = Object.keys(l).length;
3924    $('.tt-col-item').attr('data-grid', count);
3925
3926    $.each(l, function (index, value) {
3927      var o = b.clone();
3928      o.find('.tt-remove-item').attr('data-compareid', index);
3929      o.find('.tt-img').find('a').attr('href', value.url).find('img').attr('src', value.image);
3930      o.find('.tt-title').find('a').text(value.title).attr('href', value.url);
3931
3932      if(value.price < value['compare price']){
3933        o.find('.tt-price').find('.new-price').html(value.price);
3934        o.find('.tt-price').find('.old-price').html(value['compare price']);
3935      }
3936      else{
3937        o.find('.tt-price').find('.new-price').html(value.price).removeClass('new-price');
3938        o.find('.tt-price').find('.old-price').remove();
3939      }
3940
3941      if(!Boolean(value.available)){
3942        o.find('.tt-btn-addtocart').closest("form").remove();
3943        o.find('.tt-label-location').children().first().remove();
3944      }
3945
3946      o.find('form').find('input').val(index);
3947
3948      $.each(value.data, function (index, value) {
3949        var o2 = o.find('[data-val="'+index+'"]');
3950        o2.length && o2.html(value);
3951      });
3952
3953      $.each(value.options, function (index, value) {
3954        var o2 = o.find('[data-val="'+index+'"]');
3955        o2.length && o2.html(value);
3956      });
3957
3958      p.append(o);
3959    });
3960
3961    $('body').trigger('refreshCurrency');
3962    setTimeout(function(){
3963      $(window).trigger('resize');
3964      ct.sliderinit();
3965    }, 500);
3966  },
3967  checkEmptyPage: function(){
3968    var d = localStorage[compare.space];
3969    if(d = d === undefined || d === "undefined"){
3970      $('.comparepageempty').removeClass('hide');
3971      $('.comparepage').remove();
3972      return false;
3973    }
3974    return true;
3975  },
3976  setOptionsTable: function(l, $obj){
3977    var t = $('.tt-value[data-val="empty"]');
3978    var tmp = $('.tt-col-title.tt-compare-table-js');
3979    var tm = $('.title-item[data-val="maintable"]');
3980    var a = [];
3981
3982    if(!tm.length) return false;
3983
3984    $.each(l, function (index, value) {
3985      $.each(value.options, function (index, value) {
3986        index != "Title" && !a.includes(index) && a.push(index);
3987      });
3988    });
3989    if(a.length == 0) return false;
3990    for(var i=0; i<a.length; i++){
3991      $obj.append(t.clone().attr('data-val', a[i]))
3992      tmp.append(tm.clone().text(a[i]));
3993    }
3994  },
3995  selected: function(){
3996    var d = localStorage[compare.space];
3997    if(d = d === undefined || d === "undefined") return false;
3998
3999    var _ = this,
4000        l = $.parseJSON(localStorage[compare.space]);
4001    $.each(l, function (index, value) {
4002      var o = $('[data-compareid="'+index+'"]');
4003      o.length && o.attr('data-action', _.a_d).attr('data-tooltip', o.attr('data-remove'));
4004      _.setPageButtonText(o, 'data-prpage-rem');
4005    });
4006  },
4007  setPageButtonText: function(o, attr){
4008    if(o.hasClass('prpagebtn-js')){
4009      var s = o.attr(attr);
4010      o.find('span').text(s);
4011    }
4012  },
4013  getproduct: function(id, url){
4014    var _ = this,
4015        u = url+'?variant='+id+this.search;
4016    var params = {
4017      type: "get",
4018      url: u,
4019      success: function(data) {
4020
4021        compare.com_json[id] = $.parseJSON(data);
4022
4023        if(compare.com_json[id].hasOwnProperty('url')){
4024          compare.com_json[id]['url'] = url+'?variant='+id;
4025        }
4026
4027        compare.checkloadwnd();
4028      },
4029      error: function(XMLHttpRequest, textStatus) {
4030        compare.deleteitem(id);
4031        compare.checkloadwnd();
4032        console.log('product not found');
4033      }
4034    };
4035    jQuery.ajax(params);
4036  },
4037  checkloadwnd:function(){
4038    compare.com_count += 1;
4039    if(compare.com_limit <= compare.com_count){
4040      compare.createcomparepage(compare.com_json);
4041    }
4042  },
4043  getjsonsize: function(value){
4044    return Object.keys(value).length;
4045  },
4046  setdata: function($obj){
4047    var _ = this,
4048        d = localStorage[compare.space],
4049        da = $obj.attr('href'),
4050        value = this.getid($obj);
4051
4052    d = d === undefined || d === "undefined" ? false : d;
4053
4054    if(d){
4055      d = $.parseJSON(d);
4056      d[value] = da;
4057      d = JSON.stringify(d);
4058    }
4059    else{
4060      var d = '{"'+value+'": "'+da+'"}';
4061    }
4062
4063    localStorage[compare.space] = d;
4064
4065    this.setPageButtonText($obj, 'data-prpage-rem');
4066    $obj.attr('data-action', _.a_d).attr('data-tooltip', $obj.attr('data-remove'));
4067    $obj.is(':hover') && $obj.trigger('mouseleave').trigger('mouseenter');
4068  },
4069  getid: function($obj){
4070    return $obj.attr('data-compareid');
4071  },
4072  deletedata: function($obj){
4073    var value = this.getid($obj),
4074        l = localStorage[compare.space];
4075
4076    if(l === undefined || l === "undefined"){
4077      $obj.attr('data-action', this.a_a);
4078      return false;
4079    }
4080    l = $.parseJSON(l);
4081
4082    this.deleteitem(value);
4083    var count = compare.getjsonsize(l);
4084    if(l.hasOwnProperty(value) && $('.comparepage').length){
4085      count -= 1;
4086      $obj.closest('.tt-item').fadeOut(function(){
4087        ct.sliderunslick();
4088        $('[data-compareid="'+value+'"]').each(function(){
4089          $(this).closest('.tt-item').remove();
4090        });
4091        $('.tt-col-item').attr('data-grid', count);
4092        ct.sliderinit();
4093        ct.resizeHandler(0);
4094        compare.checkEmptyPage();
4095      });
4096      return false;
4097    }
4098
4099    this.setPageButtonText($obj, 'data-prpage-add');
4100    $obj.attr('data-action', this.a_a).attr('data-tooltip', $obj.attr('data-add'));
4101    $obj.is(':hover') && $obj.trigger('mouseleave').trigger('mouseenter');
4102  },
4103  deleteitem: function(value){
4104    var l = $.parseJSON(localStorage[compare.space])
4105    if(l.hasOwnProperty(value)){
4106      var count = compare.getjsonsize(l);
4107      if(count > 1){
4108        delete l[value];
4109        l = JSON.stringify(l);
4110        localStorage[compare.space] = l;
4111      }
4112      else{
4113        localStorage.removeItem(compare.space);
4114      }
4115    }
4116  },
4117  setItemLengthInBadge: function(){
4118    var l = localStorage[compare.space];
4119    if(l === undefined || l === "undefined"){
4120      $('.tt-compare').length && $('.tt-compare').find('.tt-badge').hide();
4121      return false;
4122    }
4123    l = $.parseJSON(l);
4124    l = Object.keys(l).length;
4125    $('.tt-compare').length && $('.tt-compare').find('.tt-badge').show().text(l);
4126  }
4127}
4128$( document ).ready(function(){
4129  compare.init();
4130  compare.setItemLengthInBadge();
4131  ct.init();
4132})
4133
4134if($('.tostuck-det-js').length){
4135  $('body').on('showStuck hideStuck', function(e){
4136    if(e.type == 'showStuck'){
4137      $('.tostuck-det-js').each(function(){
4138        var n = $(this).attr('data-stuckparent');
4139        var m = $(this).attr('data-parent');
4140        transfer(n, m, $(this))
4141      });
4142    }
4143    else{
4144      $('.fromstuck-det-js').each(function(){
4145        var n = $(this).attr('data-parent');
4146        transfer(n, n, $(this))
4147      });
4148    }
4149
4150    function transfer(n, m, $this){
4151      if($('.'+n).length){
4152        var o = $this.children().first().detach();
4153        $('.'+n).attr('data-parent', m).append(o);
4154      }
4155    }
4156  })
4157}
4158
4159if($('.categories-btn').length){
4160  $('body').on('click', '.categories-btn button', function(e){
4161    e.preventDefault();
4162    $(this).parent().toggleClass('opened').find('.tt-dropdown-menu').slideToggle(200);
4163    $('.categories-btn nav > ul > li').each(function(){
4164      catbtnsubposition($(this));
4165      alignicon($(this));
4166    });
4167  }).on('mouseenter', '.categories-btn nav > ul > li', function(){
4168    catbtnsubposition($(this));
4169  });
4170  function catbtnsubposition($this){
4171    var t = $this.position().top,
4172        p = $this.find('.dropdown-menu');
4173    if(!p.length) return false;
4174
4175    var h = p.height(),
4176        ph = t+$this.height();
4177    
4178    var d = $this.closest('.headertype2').length ?  0 : -20;
4179    
4180    if(h >= ph)
4181      p.css({top: d});
4182    else
4183      p.css({top: t+d});
4184  }
4185  function alignicon($this, d){
4186    d = d || 1;
4187    if(!$this.find('svg').length) return false;
4188    var sh = $this.find('svg').height(),
4189        th = $this.find('span').height(),
4190        tp = $this.find('span').position().top-d,
4191        p = ((th-sh)/2)+tp;
4192    $this.find('svg').css({top:p});
4193  }
4194  $( document ).ready(function(){
4195    if ($('.catmenumob-js').length) {
4196      $('.catmenumob-js').initMM({
4197        enable_breakpoint: true,
4198        mobile_button: true,
4199        breakpoint: 1025,
4200        menu_class: 'mobile-caterorie-menu',
4201        close_button_name: b_close,
4202        back_button_name: b_back
4203      });
4204    };
4205    $('.mobile-caterorie-menu #mm0 ul li').each(function(){
4206      alignicon($(this), 2);
4207    });
4208    $('.item-categories').each(function(){
4209      alignicon($(this), 2);
4210    });
4211  })
4212}
4213if($('.icons-main-menu').length){
4214  function alignicon($this, d){
4215    d = d || 1;
4216    if(!$this.find('svg').length) return false;
4217    var sh = $this.find('svg').height(),
4218        th = $this.find('span').height(),
4219        tp = $this.find('span').position().top-d,
4220        p = ((th-sh)/2)+tp;
4221    $this.find('svg').css({top:p});
4222  }
4223  $( document ).ready(function(){
4224    if ($('.catmenumob-js').length) {
4225      $('.catmenumob-js').initMM({
4226        enable_breakpoint: true,
4227        mobile_button: true,
4228        breakpoint: 1025,
4229        menu_class: 'mobile-caterorie-menu',
4230        close_button_name: b_close,
4231        back_button_name: b_back
4232      });
4233    };
4234    $('.mobile-caterorie-menu #mm0 ul li').each(function(){
4235      alignicon($(this), 2);
4236    });
4237  })
4238}
4239function initStickPrLeft(){
4240  var stickprcol = $('.stickprcol-js'),
4241      stickprcolheight = $('.stickprcolheight-js'),
4242      o = stickprcol.attr('data-o', stickprcol.offset().top);
4243  $('body').on('click', '.tt-collapse-title', function(){
4244    setTimeout(function(){
4245      setPosition();
4246    }, 200);
4247  })
4248  setTimeout(function(){
4249    setPosition();
4250  }, 500);
4251  $(window).resize(function(){
4252    stickprcol.css({top: 0});
4253    o = stickprcol.attr('data-o', stickprcol.offset().top);
4254    setTimeout(function(){
4255      setPosition();
4256    }, 100);
4257  }).scroll(function(){
4258    setPosition();
4259  })
4260  function setPosition(){
4261    typeof stickprcol.attr('css') !== typeof undefined && stickprcol.removeAttr('css');
4262    var h = stickprcol.children().length == 1 ? stickprcol.children().height() : stickprcol.height();
4263    if(h > $(window).height()) return false;
4264    if(h > stickprcolheight.height()) return false;
4265    
4266    if($(window).width() < 768) return false;
4267    var m = 68,
4268        o = stickprcol.attr('data-o'),
4269        p = stickprcol.position().top,
4270        w = $(window).scrollTop(),
4271
4272        mh = stickprcolheight.height() - h - 10,
4273
4274        ow = Math.max(0, w-o+m);
4275    ow = Math.min(mh, ow);
4276
4277    stickprcol.css({top: ow});
4278    $('.zoomContainer').length && $('.zoomContainer').css({top: ow+m*2}); 
4279  }
4280}
4281
4282function onerowActiontoInit(){
4283  if($('.tt-quantity').find('.tt-col-one').length){
4284   $('.tt-quantity').find('a').click(function(){ 
4285     $(this).hasClass('tt-col-one') ? onerowActiontoRight(true) : onerowActiontoBack();
4286   })
4287  }
4288
4289  $(window).resize(function(){
4290    var b = $('.tt-product-listing').hasClass('tt-col-one');
4291    $(window).width() < 791 ? onerowActiontoBack() : onerowActiontoRight(b);
4292  })
4293  $('body').on('listingpageajax', function(){
4294    if(!$('.tt-product-listing').hasClass('tt-col-one')) return false;
4295    onerowActiontoRight(true);
4296  })
4297  if(!$('.tt-product-listing').hasClass('tt-col-one')) return false;
4298  onerowActiontoRight(true);
4299}
4300function onerowActiontoRight(isOneRow){
4301  isOneRow = false || isOneRow;
4302  if($(window).width() < 791 || !isOneRow) return false;
4303  $('.product-parent').each(function(){
4304    var o = $(this).find('.onerowactions');
4305    if(o.children().length) return true;
4306    var p = $(this).find('.tt-price').attr('data-par', 'backtottprice').wrap('<div class="backtottprice"/>').detach();
4307    $(this).find('.onerowactions').append(p);
4308    p = $(this).find('.tt-product-inside-hover').attr('data-par', 'backtorphov').wrap('<div class="backtorphov"/>').detach();
4309    $(this).find('.onerowactions').append(p);
4310  })
4311}
4312function onerowActiontoBack(){
4313  $('.product-parent').each(function(){
4314    var o = $(this).find('.onerowactions');
4315    if(!o.children().length) return true;
4316    var p = $(this).find('.tt-price'),
4317        c = p.attr('data-par');
4318    $(this).find('.'+c).append(p.detach());
4319    $(this).find('.tt-price').unwrap();
4320
4321    p = $(this).find('.tt-product-inside-hover');
4322    c = p.attr('data-par');
4323    $(this).find('.'+c).append(p.detach());
4324    $(this).find('.tt-product-inside-hover').unwrap();
4325  })
4326}
4327
4328$(document).ready(function(){
4329  $('.tt-col-one').length && onerowActiontoInit();
4330  $('.stickprcol-js').length && initStickPrLeft();
4331  
4332  if($('[data-currency-selector]').length){
4333    $("body").on('click', '[data-currency-selector] a', function(e) {
4334      e.preventDefault();
4335      var v = $(this).parent().attr('data-currency');
4336      $(this).parents('form').find('[name="currency"]').val(v).parents('form').submit();
4337    });
4338  }
4339})
4340
4341$(document).ready(function(){
4342  function forStickyHeaderMenuInCenter(){
4343    if($('header').hasClass('headertype2') || $('header').hasClass('headertype3')) return false;
4344    var $ttstucknav = $('.tt-stuck-nav');
4345    if(!$ttstucknav.length) return false;
4346    var $ttdesktopheader = $('.tt-desktop-header');
4347    
4348    if($ttdesktopheader.find('.tt-obj-menu.obj-aligment-right').length){
4349      $ttstucknav.addClass('stuckmenuinright');
4350      return false;
4351    } 
4352    
4353    
4354    if(!$ttdesktopheader.find('.menu-in-center').length && !$ttdesktopheader.find('.tt-obj-menu.obj-aligment-center').length) return false;
4355
4356    $ttstucknav.addClass('stuckmenuincenter');
4357    $(window).resize(forStickyHeaderMenuInCenterHandler);
4358    forStickyHeaderMenuInCenterHandler();
4359  }
4360  function forStickyHeaderMenuInCenterHandler(){
4361    var $ttstucknav = $('.tt-stuck-nav');
4362
4363    if($(window).width() > 1024){
4364      if($ttstucknav.find('.stuckiconsabsolute').length) return false;
4365      $ttstucknav.find('.tt-header-row').append('<div class="stuckiconsabsolute"></div>');
4366      $ttstucknav.find('.tt-parent-box').detach().appendTo($ttstucknav.find('.stuckiconsabsolute'))
4367    }
4368    else{
4369      if(!$ttstucknav.find('.stuckiconsabsolute').length) return false;
4370      $ttstucknav.find('.tt-parent-box').first().unwrap();
4371    }
4372  }
4373  forStickyHeaderMenuInCenter();
4374})
4375
4376var settings = {
4377  entryPointInclude : $('#entrypoint-objects')
4378};
4379var methods = {
4380  init: function(options){
4381    return this.each(function(){
4382      var objVar = {
4383        objClass : $(this).attr("class").split(' ')[0],
4384        extraPlaceDetach: options.extraPlaceDetach || false,
4385        changeСlasStyle: options.changeСlasStyle || false,
4386        entryPointInclude: options.entryPointInclude || false,
4387        createBlok: options.createBlok,
4388      };
4389
4390      if(window.innerWidth <= 1024){
4391        methods.detachMobile(objVar, options);
4392      };
4393
4394      $(window).resize(function(){
4395        if(window.innerWidth <= 1024){
4396          methods.detachMobile(objVar, options);
4397        };
4398      });
4399
4400    });
4401  },
4402  detachMobile: function(objVar,options){
4403    var setting = $.extend(settings, options);
4404
4405    objVar.entryPointInclude.attr("dataDetach", "true");
4406
4407    $('header').addClass('dataDetach');
4408
4409    if(objVar.createBlok){
4410      var checkForExistence = objVar.entryPointInclude.find('.' + objVar.createBlok);
4411      if(!checkForExistence.length){
4412        var obj = $("." + objVar.objClass).children().clone().get(0);
4413        if(typeof obj == 'undefined'){
4414          obj = $("." + objVar.extraPlaceDetach).children().clone().get(0);
4415        }
4416        objVar.entryPointInclude.append("<div class='external-item "+ objVar.createBlok +"'></div>").find('.' +  objVar.createBlok).append(obj);
4417      };
4418      if(typeof objVar.changeСlasStyle != "false"){
4419        objVar.entryPointInclude.find('.' +  objVar.createBlok).find('.' +  objVar.changeСlasStyle).removeClass(objVar.changeСlasStyle).attr("data-class", objVar.changeСlasStyle).removeAttr('style');
4420      };
4421    };
4422  }
4423};
4424$.fn.movingObjects = function(action){
4425  if(methods[action]){
4426    return methods[action].apply(this, Array.prototype.slice.call(arguments, 1));
4427  } else if(typeof action === 'object' || !action){
4428    return methods.init.apply(this, arguments);
4429  } else {
4430    console.info('Action ' +action+ 'not found this plugin');
4431    return this;
4432  }
4433};
4434var $header = $('header');
4435if($header.find('.tt-mobile-header-inline').length){
4436  $header.find('.tt-desctop-parent-account').movingObjects({
4437    createBlok:'my-account',
4438    extraPlaceDetach: 'tt-stuck-parent-account',
4439    changeСlasStyle: 'tt-dropdown-menu',
4440    entryPointInclude: $('#entrypoint-objects'),
4441  });
4442  $header.find('.tt-desctop-parent-multi').movingObjects({
4443    createBlok:'my-multi',
4444    extraPlaceDetach: 'tt-stuck-parent-multi',
4445    changeСlasStyle: 'tt-dropdown-menu',
4446    entryPointInclude: $('#entrypoint-objects'),
4447  });
4448};
4449
4450
4451
4452
4453
4454
4455
4456
4457(function ($) {
4458	//Init Menu02
4459	var initMeny02 = $('#js-init-menu02');
4460	if (initMeny02.length){
4461		menu02();
4462	};
4463	function menu02(){
4464		$body.on('click', '#js-init-menu02 .tt-dropdown-toggle', function(e){
4465			openPopup();
4466			//definitionLayout();
4467			initMultilevelList();
4468			return false;
4469		});
4470		$body.on('click', '#js-init-menu02 .tt-close-modal', function(e){
4471			closePopup();
4472			return false;
4473		});
4474		function closePopup(){
4475          $('#js-init-menu02').find('.tt-close-modal').fadeOut(190);
4476          $('#js-init-menu02').find('.tt-dropdown-menu').first().fadeOut(200, function(){
4477          	$('#js-init-menu02').find('.tt-dropdown-menu').first().removeAttr("style");
4478			$('#js-init-menu02 .tt-dropdown-menu').perfectScrollbar('destroy');
4479			var top = parseInt($body.css("top").replace("px", ""), 10) * -1;
4480			$('#js-init-menu02').removeClass('active').find('.tt-close-modal').delay(0).fadeOut(0).removeAttr("style");
4481			$body.removeAttr("style").removeClass('no-scroll notdelete').scrollTop(top);
4482			$html.removeAttr("style").scrollTop(top);
4483			onSound();
4484            })
4485          	return false;
4486		};
4487		function openPopup(){
4488          	
4489			var ttScrollValue = $('body').scrollTop() || $('html').scrollTop();          
4490			$body.css("top", - ttScrollValue);                  
4491          
4492          	var logoOb =  $('#js-init-menu02 .tt-modal-header .col-logo'),
4493                logoObjTop = logoOb.length ? logoOb.position().top : 0,
4494                logoObjHeight = logoOb.length ? logoOb.innerHeight() / 2 : 0,
4495                btnCloseHeight =  $('#js-init-menu02 .tt-close-modal').innerHeight() / 2,         
4496                btnCloseOffset = parseInt(logoObjTop + logoObjHeight - btnCloseHeight, 10);
4497         
4498          
4499          	$('#js-init-menu02').toggleClass('active').find('.tt-close-modal').css("top", ttScrollValue).css("marginTop", btnCloseOffset).css("display", "flex").hide().delay(55).fadeIn(150);
4500          
4501          	          
4502			$body.toggleClass('no-scroll notdelete');
4503			$('#js-init-menu02 .tt-dropdown-menu').perfectScrollbar();
4504			offSound();
4505		};
4506		function offSound(){
4507			Array.prototype.slice.call(document.querySelectorAll('video')).forEach(function(audio) {
4508				audio.muted = true;
4509			});
4510		};
4511		function onSound(){
4512			Array.prototype.slice.call(document.querySelectorAll('video')).forEach(function(audio) {
4513				audio.muted = false;
4514			});
4515		};
4516		function definitionLayout(){
4517			if($('body').css("direction") == 'rtl'){
4518				$('body').addClass('rtl');
4519			};
4520			$('#js-init-menu02 .definitionLayout').each(function(){
4521				var liQuantity = $(this).find(' > li').length;
4522				if(liQuantity <= 10){
4523					$(this).addClass('ul_sm');
4524				} else if (liQuantity >= 11 && liQuantity <= 20){
4525					$(this).addClass('ul_md').liColl({
4526						c_unit: '%',
4527						n_coll: 2
4528					});
4529				} else if (liQuantity >= 21){
4530					$(this).addClass('ul_lg').liColl({
4531						c_unit: '%',
4532						n_coll: 3
4533					});
4534				};
4535			});
4536		};
4537		function initMultilevelList(){
4538			$('#js-init-menu02').find('.tt-multilev-list li').on("mouseenter", function(){
4539				$(this).addClass('active').closest('.nav-multilevel').addClass('active').closest('.tt-dropdown-menu').addClass('dropdown-menu-active');
4540				var $ul = $(this).find('ul:first').addClass('active');
4541				if ($ul.length){
4542                  	var widthDropdownArrow01 = 20,
4543                        widthDropdownArrow02 = 17,
4544                        indentDropdown = 20;
4545					if(!$ul.hasClass('definitionLayout') && !$('body').hasClass('rtl')){                      
4546						$(this).find('ul:first').css({
4547							marginLeft: -widthDropdownArrow01
4548						});
4549					};                
4550                  
4551                  	 var offsetLeftDropdown = parseInt($(this).find('> a').innerWidth(), 10) + widthDropdownArrow02 + indentDropdown;
4552                  
4553                  	if(!$('html').hasClass('rtlstyle')){
4554                      $(this).find('> ul').css({
4555                       left: offsetLeftDropdown                       
4556                     });                
4557                    } else{
4558                      $(this).find('> ul').css({
4559                       right: offsetLeftDropdown                       
4560                     });                
4561                    }
4562                 	 
4563                  	
4564                  
4565					//check horizontal position
4566					var windW = window.innerWidth,
4567						ulW = parseInt($ul.css('width'), 10) + 20,
4568						thisR = this.getBoundingClientRect().right,
4569						thisL = this.getBoundingClientRect().left;
4570           
4571
4572					if (windW - thisR < ulW){
4573						$ul.addClass('left-popup');                      	
4574					} else{
4575						$ul.removeClass('left-popup');
4576					};
4577					//check vertical position
4578					var winH = window.innerHeight,
4579						ulH = parseInt($ul.css('height'), 10) + 23,
4580						thisT = this.getBoundingClientRect().top,
4581						thisB = this.getBoundingClientRect().bottom;
4582
4583					var objHeight = ulH + thisT,
4584						checkEror = parseInt((objHeight - winH - 20), 10),
4585						checkEror02 = parseInt($ul.css('height') - 20, 10),
4586                        linkHeight = parseInt($(this).find('> a').css('height'), 10),
4587                        linkHeight = (linkHeight / 2) * -1;
4588                  
4589                  
4590
4591					if (winH < objHeight && winH > ulH){
4592						var checkEror = checkEror * -1
4593                        if (checkEror < linkHeight){
4594                          $ul.css({
4595							top: checkEror
4596							});
4597                        } else {
4598                        	$ul.css({
4599								top: linkHeight
4600							});
4601                        }						                      	
4602					} else if(winH < objHeight && winH < ulH + 40){
4603						var checkEror = checkEror * -1
4604						$ul.css({
4605							top: checkEror
4606						});                      
4607					};                  
4608                  
4609				};
4610				$ul.stop(true, true).addClass('active').delay(200).fadeIn(150);
4611			}).on('mouseleave', function(){
4612				$(this).find('ul:first').stop(true, true).removeClass('active').fadeOut(50);
4613				$(this).removeClass('active').closest('.nav-multilevel').removeClass('active').closest('.tt-dropdown-menu').removeClass('dropdown-menu-active');
4614              	$(this).find('> ul').removeAttr("style");
4615			});
4616		};
4617	};
4618})(jQuery);
4619
4620$('[data-linkto]').length && $('[data-linkto]').on('click', function(e){e.preventDefault(); window.location.href = $(this).attr('data-linkto');});
4621
4622$('.btnanimation').length && $('body').on('mouseenter','.btnanimation',function(e){
4623  if($(window).width() < 1025) return false;
4624  var $wr = $(this).find('.tt-description-wrapper');
4625  var $btns = $(this).find('.tt-description-wrapper-main .custom-buttons');
4626  if(!$btns.length) return false;
4627  var wrh = $wr.height();
4628  var wrp = $(window).width() < 1600 ? Number($btns.attr("data-offsetmedium")): Number($btns.attr("data-offset"));
4629  var btnp = wrh+wrp;
4630
4631  if($(this).hasClass('btnanimationcenter')){
4632    wrp += $(this).find('.custom-buttons').height();
4633    wrp = Math.round(wrp/2);
4634    $btns.stop().animate({top:btnp, opacity: 1},300);
4635    $wr.stop().animate({top:-wrp},300);
4636  }
4637  else{
4638    wrp += Math.round($(this).find('.custom-buttons').height());
4639    $wr.stop().animate({top:-wrp},300);
4640    $btns.stop().animate({opacity: 1},600);  
4641  }
4642  
4643}).on('mouseleave','.btnanimation',function(e){
4644  if($(window).width() < 1025) return false;
4645  var $wr = $(this).find('.tt-description-wrapper');
4646  var $btns = $(this).find('.tt-description-wrapper-main .custom-buttons');
4647  if(!$btns.length) return false;
4648  
4649  var wrh = $wr.innerHeight();
4650  if($(this).hasClass('btnanimationcenter')){
4651    var btnp = wrh-($(window).width() < 1600 ? Number($btns.attr("data-offsetmedium")): Number($btns.attr("data-offset")))+10;
4652    $btns.stop().animate({top:btnp, opacity: 0},200);
4653    $wr.stop().animate({top:0},300);
4654  }
4655  else{
4656    $wr.stop().animate({top:0},500);
4657    $btns.stop().animate({opacity: 0},200);
4658  }
4659});
4660
4661if($('[data-customtabsdelay]').length){
4662  $('[data-customtabsdelay]').each(function(){
4663    var $this = $(this);
4664    var interval = _setInterval();
4665    function intervalHandle(param1){
4666      var ch = param1.children().length-1,
4667          ind = param1.find('.active').parent().index();
4668      ind += 1;
4669      if(ind > ch) ind = 0;
4670      param1.children().eq(ind).children().trigger('click');
4671    }
4672    
4673    $this.closest('.tabs-box').on('mouseenter', function(){
4674      clearInterval(interval);
4675    }).on('mouseleave', function(){
4676      interval = _setInterval();
4677    })
4678    $this.find('a').on('mousedown', function(){
4679      clearInterval(interval);
4680    })
4681    
4682    function _setInterval(){
4683      return setInterval(intervalHandle, Number($this.attr('data-customtabsdelay')), $this);
4684    }
4685  })
4686}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.