Advertisement
Igor150195

LP3 fix lightgallery

May 22nd, 2023
924
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'use strict'
  2.  
  3. ;(function() {
  4.     var $win = $(window),
  5.         $doc = $(document),
  6.         $html = $(document.documentElement),
  7.         $body = $(document.body),
  8.         iOs = /iPhone|iPad|iPod/i.test(navigator.userAgent),
  9.         initializedMaps = [],
  10.         youtubeListPlayers = [];
  11.        
  12.  
  13.     window.lp_template = {
  14.         version: 'landing page v3',
  15.         queue: {}
  16.     };
  17.    
  18.     lp_template.queue.aboutPopupLink = function($self) {
  19.         if(window.location.pathname != "/my/s3/data/lp/live.edit.php"){
  20.         $('a[href^="popup:"]').attr('style','pointer-events: none');
  21.         }
  22.         $(window).on('load', function(){
  23.             $('a[href^="popup:"]').attr('style','pointer-events: auto');
  24.         })
  25.     }
  26.    
  27.     lp_template.checkAutoplayVideo = function($blocks) {
  28.         $blocks.each(function() {
  29.             var $this = $(this),
  30.                 playStatus = $this.data('playStatus'),
  31.                 inViewport = isElementInViewport(this),
  32.                 $video = $this.find('video'),
  33.                 $thisVideo = $video.length ? $video : $this.find('iframe');
  34.                
  35.            
  36.    
  37.             if (inViewport && playStatus !== 'play') {
  38.                 $this.trigger('autoplayVideo', ['play', $thisVideo[0].nodeName.toLowerCase()]);
  39.                 $this.data('playStatus', 'play');
  40.             } else if (!inViewport && playStatus === 'play') {
  41.                 $this.trigger('autoplayVideo', ['pause', $thisVideo[0].nodeName.toLowerCase()]);
  42.                 $this.data('playStatus', 'pause');
  43.             }
  44.        
  45.         })
  46.     }
  47.    
  48.     lp_template.queue.scrollToAnchor = function($self) {
  49.        
  50.         if (s3LP.is_cms) return;
  51.        
  52.         $self.on('click', 'a', function(e){
  53.             var $this = $(this),
  54.                 thisHref = $this.attr('href');
  55.                
  56.             if (thisHref.length < 2 || thisHref[0] != '#') return;
  57.            
  58.             var $thisBlock = $(thisHref);
  59.            
  60.             if (!$thisBlock.length) return;
  61.            
  62.             e.preventDefault();
  63.            
  64.             //42658
  65.             let scrollValue = $thisBlock.offset().top;
  66.             const $fixedMenu =$(`.js-fixed-menu._to-fix-menu:not(._is-cms)`);
  67.  
  68.             if ($fixedMenu.size() && $fixedMenu.height()){
  69.                 scrollValue -= $fixedMenu.height();
  70.             }
  71.            
  72.             $('html, body').animate({
  73.                 scrollTop: scrollValue
  74.             });
  75.             $('html').css({
  76.                 overflow: 'visible'
  77.             });
  78.         });
  79.     }
  80.    
  81.     lp_template.checkMapInitialization = function($blocks) {
  82.         $blocks.each(function() {
  83.             var $this = $(this),
  84.                 id = $this.attr('id');
  85.  
  86.             if (initializedMaps.includes(id)) {
  87.                 return;
  88.             }
  89.  
  90.             var inViewport = isElementInViewport(this);
  91.  
  92.             if (inViewport) {
  93.                 initializedMaps.push(id);
  94.  
  95.                 lp_template.initMaps($this);
  96.             }
  97.         })
  98.     }
  99.  
  100.     lp_template.initGoogleMaps = function(options) {
  101.         var map = new google.maps.Map(document.getElementById(options.id), {
  102.             zoom: parseInt(options.zoom),
  103.             scrollwheel: false,
  104.             center: new google.maps.LatLng(options.center[0], options.center[1])
  105.         });
  106.  
  107.         $.each(options.data, function(key, item) {
  108.             var marker = new google.maps.Marker({
  109.                 position: new google.maps.LatLng(item.coords[0], item.coords[1]),
  110.                 map: map,
  111.                 title: item.name
  112.             });
  113.  
  114.             var infowindow = new google.maps.InfoWindow({
  115.                 content: '<div class="baloon-content">' +
  116.                     '<h3 style="margin: 0; padding-bottom: 3px;">' + item.name + '</h3>' +
  117.                     item.desc +
  118.                     '</div>'
  119.             });
  120.  
  121.             google.maps.event.addListener(marker, 'click', function() {
  122.                 infowindow.open(map, marker);
  123.             });
  124.         });
  125.     }
  126.  
  127.     lp_template.initYandexMaps = function(options) {
  128.         var map = new ymaps.Map(options.id, {
  129.             center: options.center,
  130.             zoom: options.zoom,
  131.             behaviors: ['drag', 'rightMouseButtonMagnifier'],
  132.         });
  133.  
  134.         map.controls.add(
  135.             new ymaps.control.ZoomControl()
  136.         );
  137.  
  138.         var MyBalloonContentLayoutClass = ymaps.templateLayoutFactory.createClass(
  139.             '<div class="baloon-content" style="padding: 0 10px;">' +
  140.             '<h3 style="margin: 0;">$[properties.name]</h3>' +
  141.             '<p>$[properties.desc]</p>' +
  142.             '</div>'
  143.         );
  144.  
  145.         var myCollection = new ymaps.GeoObjectCollection();
  146.  
  147.         $.each(options.data, function(key, item) {
  148.             myCollection.add(new ymaps.Placemark(
  149.                 item.coords,
  150.                 item, {
  151.                     balloonContentLayout: MyBalloonContentLayoutClass
  152.                 }
  153.             ));
  154.         });
  155.  
  156.         map.geoObjects.add(myCollection);
  157.  
  158.         $('#' + options.id).data('ymaps', map);
  159.     }
  160.  
  161.     lp_template.initMaps = function($block) {
  162.         var options = $block.data('init-params');
  163.  
  164.         options = typeof options === 'string' ? JSON.parse(options) : options;
  165.  
  166.         if (typeof options.center === 'string') {
  167.             options.center = options.center.split(',');
  168.         }
  169.  
  170.         $.each(options.data, function(key, item) {
  171.             if (typeof item.coords === 'string') {
  172.                 item.coords = item.coords.split(',');
  173.             }
  174.         });
  175.  
  176.         var keyMap = options.key;
  177.  
  178.         if (options.type === "google") {
  179.             if (window.google && window.google.maps) {
  180.                 lp_template.initGoogleMaps(options);
  181.             } else {
  182.                 var script = document.createElement('script');
  183.                 script.async = 'async';
  184.                 script.src = `//maps.googleapis.com/maps/api/js?key=${keyMap}`;
  185.                 document.body.append(script);
  186.  
  187.                 script.onload = function() {
  188.                     lp_template.initGoogleMaps(options);
  189.                 }
  190.             }
  191.         } else {
  192.             if (window.ymaps && window.ymaps.Map) {
  193.                 lp_template.initYandexMaps(options)
  194.             } else {
  195.                 /*var script = document.createElement('script');
  196.                 script.async = 'async';
  197.                 //script.src = `//api-maps.yandex.ru/2.1/?apikey=${keyMap}&lang=ru_RU`;
  198.                
  199.                 //start 1935
  200.                 var scriptLangSrc = `${$ite.params.lang}_${$ite.params.lang.toUpperCase()}`;
  201.                 if (scriptLangSrc == 'en_EN') {
  202.                     scriptLangSrc = 'en_US'
  203.                 }
  204.                 script.src = `//api-maps.yandex.ru/2.1/?apikey=${keyMap}&lang=` + scriptLangSrc;
  205.                 //end 1935
  206.                
  207.                 document.body.append(script);
  208.  
  209.                 script.onload = function() {
  210.                     ymaps.ready(function() {
  211.                         lp_template.initYandexMaps(options)
  212.                     });
  213.                 }*/
  214.                
  215.                
  216.                 var htmlLang = document.documentElement.lang;
  217.                 var script = document.createElement("script");
  218.                 script.async = "async";
  219.                 if (htmlLang == "en") {
  220.                   script.src = `//api-maps.yandex.ru/2.1/?apikey=${keyMap}&lang=en_RU`;
  221.                 } else {
  222.                   script.src = `//api-maps.yandex.ru/2.1/?apikey=${keyMap}&lang=ru_RU`;
  223.                 }
  224.        
  225.                 document.body.append(script);
  226.        
  227.                 script.onload = function () {
  228.                   ymaps.ready(function () {
  229.                     lp_template.initYandexMaps(options);
  230.                   });
  231.                 };
  232.             }
  233.         }
  234.     }
  235.    
  236.     /*
  237.     lp_template.initMaps = function(options) {
  238.         var map;
  239.        
  240.         if (options.type === "google") {
  241.             map = new google.maps.Map(document.getElementById(options.id), {
  242.                 zoom: parseInt(options.zoom),
  243.                 scrollwheel: false,
  244.                 center: new google.maps.LatLng(options.center[0], options.center[1])
  245.             });
  246.  
  247.             $.each(options.data, function(key, item) {
  248.            
  249.                 var marker = new google.maps.Marker({
  250.                     position: new google.maps.LatLng(item.coords[0], item.coords[1]),
  251.                     map: map,
  252.                     title: item.name
  253.                 });
  254.  
  255.                 var infowindow = new google.maps.InfoWindow({
  256.                     content: '<div class="baloon-content">' +
  257.                         '<h3 style="margin: 0; padding-bottom: 3px;">' + item.name + '</h3>' +
  258.                         item.desc +
  259.                         '</div>'
  260.                 });
  261.  
  262.                 google.maps.event.addListener(marker, 'click', function() {
  263.                     infowindow.open(map, marker);
  264.                 });
  265.                
  266.                
  267.             });
  268.        
  269.         } else {
  270.            
  271.             ymaps.ready(function() {
  272.            
  273.                 map = new ymaps.Map(options.id, {
  274.                     center: options.center,
  275.                     zoom: options.zoom,
  276.                     behaviors: ['drag', 'rightMouseButtonMagnifier'],
  277.                 });
  278.  
  279.                 map.controls.add(
  280.                     new ymaps.control.ZoomControl()
  281.                 );
  282.  
  283.                 var MyBalloonContentLayoutClass = ymaps.templateLayoutFactory.createClass(
  284.                     '<div class="baloon-content" style="padding: 0 10px;">' +
  285.                     '<h3 style="margin: 0;">$[properties.name]</h3>' +
  286.                     '<p>$[properties.desc]</p>' +
  287.                     '</div>'
  288.                 );
  289.  
  290.                 var myCollection = new ymaps.GeoObjectCollection();
  291.  
  292.                 $.each(options.data, function(key, item) {
  293.                     myCollection.add(new ymaps.Placemark(
  294.                         item.coords,
  295.                         item, {
  296.                             balloonContentLayout: MyBalloonContentLayoutClass
  297.                         }
  298.                     ));
  299.                 });
  300.  
  301.                 map.geoObjects.add(myCollection);
  302.                
  303.                 $('#' + options.id).data('ymaps', map);
  304.             });
  305.         }
  306.     }
  307.    
  308.     lp_template.queue.lpSimpleMap = function($self) {
  309.         var $block = $self.find('.js-lp-simple-map');
  310.        
  311.         if ($block.length) {
  312.             setTimeout(function(){
  313.                 $block.each(function(){
  314.                     var $this = $(this),
  315.                         thisParams = $this.data('init-params');
  316.                        
  317.                     thisParams = typeof thisParams === 'string' ? JSON.parse(thisParams) : thisParams;
  318.                        
  319.                     if (typeof thisParams.center === 'string') {
  320.                         thisParams.center = thisParams.center.split(',');
  321.                     }
  322.                    
  323.                     $.each(thisParams.data, function(key, item) {
  324.                         if (typeof item.coords === 'string') {
  325.                             item.coords = item.coords.split(',');
  326.                         }
  327.                     });
  328.                    
  329.                     lp_template.initMaps(thisParams);
  330.                 });
  331.             }, 750);
  332.         }
  333.     }
  334.     */
  335.    
  336.     lp_template.queue.steps11 = function($self) {
  337.         var $block = $self.hasClass('js-step-11') ? $self : $self.find('.js-step-11');
  338.         if ($block.length) {
  339.             try {
  340.                 let linePos = function(){
  341.                     let firstItemPos = $('.lp-steps-11-item__number').first().position().top,
  342.                         firstItemHeight = $('.lp-steps-11-item__number').first().outerHeight(),
  343.                         lastItemPos = $('.lp-steps-11-item__number').last().position().top;
  344.    
  345.                     $('.lp-steps-11-items .line span').css('height', lastItemPos-firstItemPos-firstItemHeight);
  346.                     $('.lp-steps-11-items .line').css('top', firstItemPos+firstItemHeight);
  347.                 }
  348.    
  349.                 linePos();
  350.                 $(window).resize(function(){
  351.                     var numbElemWidth = $block.find('.lp-steps-11-item__number').outerWidth() / 2;
  352.                     linePos();
  353.                     if (window.matchMedia('(max-width : 959px)').matches) {
  354.                         $block.find('.line').css('left', numbElemWidth);
  355.                     }
  356.                     else {
  357.                         $block.find('.line').css('left', '50%');
  358.                     }
  359.                 });
  360.    
  361.             } catch(e) {
  362.                 console.log(e);
  363.             }
  364.         }
  365.     }
  366.  
  367.     lp_template.queue.popupStepForm = function($self) {
  368.         var $block = $self.find('.js-step-form-popup');
  369.        
  370.         if ($block.length) {
  371.             $block.formsteps({
  372.                 mode: 'popup'
  373.             });
  374.         }
  375.     };
  376.    
  377.     /*
  378.    
  379.     lp_template.queue.promoSlider = function($self) {
  380.         var $block = $self.find('.js-promo2-slider');
  381.        
  382.         $block.each(function (index, slider) {
  383.             var $slider = $(slider);
  384.             var autoplay = $slider.data('autoplay') || false;
  385.             $slider.slick({
  386.               dots: true,
  387.               autoplay: !!autoplay,
  388.               autoplaySpeed: autoplay
  389.             });
  390.             $slider.on('beforeChange', function (event, slick) {
  391.               var $this = $(this);
  392.               var $cloned = $this.find('.slick-cloned');
  393.               $cloned.each(function (index, slide) {
  394.                 styleSlide(slide);
  395.               });
  396.               slick.$slides.each(function (index, slide) {
  397.                 styleSlide(slide);
  398.               });
  399.             });
  400.           });
  401.          
  402.         function styleSlide(slide) {
  403.           var $slide = $(slide).find('.lp-promo2__slider-item');
  404.           var $img = $slide.find('img');
  405.        
  406.           if ($img.height() < $slide.height()) {
  407.             $slide.css({
  408.               'display': 'flex',
  409.               'align-items': 'center'
  410.             });
  411.           }
  412.         }
  413.     };*/
  414.    
  415.     lp_template.queue.headerInPopup = function($self) {
  416.    
  417.         /* Old Version */
  418.         if (s3LP.is_cms) return;
  419.        
  420.         var $block = $self.find('._js-in-promo');
  421.        
  422.         if ($block.length) {
  423.             $block.each(function(){
  424.                 var $this = $(this),
  425.                     $thisParent = $this.next('._insert-header');
  426.                    
  427.                 if ($thisParent.length) {
  428.                     $this.insertBefore($thisParent.find('.js-promo-before'));
  429.                     $thisParent.addClass('_header_inserted');
  430.                 }
  431.             });
  432.         }
  433.     };
  434.    
  435.     lp_template.queue.headerCommunity = function($self) {
  436.         var $header = $self.find('.js-community');
  437.        
  438.         if (s3LP.is_cms) return;
  439.        
  440.         if ($header.length) {
  441.             $header.each(function() {
  442.                 var $this = $(this),
  443.                     $thisNewParent = findPromoBlock($this);
  444.                    
  445.                 if ($thisNewParent) {
  446.                     $this.insertBefore($thisNewParent.find('.js-before-community'));
  447.                     $thisNewParent.addClass('_unified');
  448.                 }
  449.             });
  450.         }
  451.        
  452.         function findPromoBlock ($block) {
  453.             if (!$block.length) return null;
  454.            
  455.             var $next = $block.next('.js-make-community');
  456.            
  457.             if ($next.length) return $next;
  458.            
  459.             if (!$next.length) {
  460.                 return findPromoBlock($block.next());
  461.             }
  462.         }
  463.     };
  464.    
  465.     lp_template.queue.partnersSlider1 = function($self) {
  466.         var $block = $self.find('.js-partners-1');
  467.  
  468.         if ($block.length) {
  469.  
  470.             $block.each(function() {
  471.                 var $slider = $(this),
  472.                     count = $slider.data('count'),
  473.                     autoplay = !!$slider.data('autoplay'),
  474.                     pause = $slider.data('pause'),
  475.                     speed = $slider.data('speed'),
  476.                     arrows = !!$slider.data('arrows'),
  477.                     infinite = !!$slider.data('infinite');
  478.                    
  479.                 $slider.owlCarousel({
  480.                     autoplay: autoplay,
  481.                     autoplayTimeout: pause,
  482.                     smartSpeed: speed,
  483.                     loop: infinite,
  484.                     dots: false,
  485.                     responsive: {
  486.                         0: {
  487.                             items: 1,
  488.                             margin: 0
  489.                         },
  490.                         600: {
  491.                             items: 3,
  492.                             margin: 24
  493.                         },
  494.                         960: {
  495.                             items: 3,
  496.                             margin: 48
  497.                         },
  498.                         1200: {
  499.                             items: count,
  500.                             margin: 24
  501.                         },
  502.                         1380: {
  503.                             items: count,
  504.                             margin: 36
  505.                         }
  506.                     }
  507.                 });
  508.             });
  509.         }      
  510.     };
  511.  
  512.     lp_template.queue.contactsTab = function($self) {
  513.         var $block = $self.find('.js-contacts-tab-1');
  514.         var $allTabs = $self.find('.tab-item');
  515.         var activeClass = 'active';
  516.        
  517.         $block.on('click', function(){
  518.            
  519.             var $thisParent = $(this).closest('.tab-item');
  520.            
  521.             if ($thisParent.hasClass(activeClass)) {
  522.                 $thisParent.removeClass(activeClass).find('.tab-item__text-part').slideUp();
  523.             } else {
  524.            
  525.                 $allTabs.removeClass(activeClass).find('.tab-item__text-part').slideUp();
  526.                
  527.                 $thisParent.addClass(activeClass).find('.tab-item__text-part').slideDown();
  528.             }
  529.         });
  530.        
  531.         $($block[0]).trigger('click');
  532.     }
  533.  
  534.     lp_template.queue.formInputs = function($self) {       
  535.        
  536.         $doc.on('click', '.js-select, .js-multi_select', function() {
  537.             var $this = $(this),
  538.                 openedClass = '_opened',
  539.                 $thisParent = $this.closest('.lp-form-tpl__field-select, .lp-form-tpl__field-multi_select'),
  540.                 $thisList = $thisParent.find('.lp-form-tpl__field-select__list, .lp-form-tpl__field-multi_select__list');
  541.                
  542.             if ($thisParent.hasClass(openedClass)) {
  543.                 $thisParent.removeClass(openedClass);
  544.                 $thisList.slideUp();
  545.             } else {
  546.                 $thisParent.addClass(openedClass);
  547.                 $thisList.slideDown();
  548.             }
  549.         });
  550.        
  551.         $(document).ready(function () {
  552.           $(".js-choose-select._checked").each(function () {
  553.             var $this = $(this),
  554.               thisText = $this.text(),
  555.               $thisParent = $this.closest(".lp-form-tpl__field-select"),
  556.               checkedClass = "_checked";
  557.    
  558.             $thisParent.find(".js-choose-select").removeClass(checkedClass);
  559.             $thisParent.find(".lp-form-tpl__field-select__input").text(thisText);
  560.             $thisParent.parent().find("input").val(thisText);
  561.           });
  562.         });
  563.        
  564.         $doc.on('click', '.js-choose-select', function() {
  565.             var $this = $(this),
  566.                 thisText = $this.text(),
  567.                 $thisParent = $this.closest('.lp-form-tpl__field-select'),
  568.                 checkedClass = '_checked';
  569.                
  570.             if (!$this.hasClass(checkedClass)) {
  571.                 $thisParent.find('.js-choose-select').removeClass(checkedClass);
  572.                 $this.addClass(checkedClass);
  573.                 $thisParent.find('.lp-form-tpl__field-select__input').text(thisText);
  574.                 $thisParent.parent().find('input').val(thisText);
  575.             }
  576.            
  577.             $thisParent.find('.lp-form-tpl__field-select__list').slideUp();
  578.             $thisParent.removeClass('_opened');
  579.                
  580.         });
  581.        
  582.         $doc.on('click', '.js-choose-milti_select', function() {
  583.             var $this = $(this),
  584.                 $thisParent = $this.closest('.lp-form-tpl__field-multi_select'),
  585.                 checkedClass = '_checked';
  586.                
  587.             if (!$this.hasClass(checkedClass)) {
  588.                 $this.addClass(checkedClass);
  589.             } else {
  590.                 $this.removeClass(checkedClass);
  591.             }
  592.            
  593.             var choosenElements = $thisParent.find('.' + checkedClass),
  594.                 choosenElementsText = [];
  595.                
  596.             choosenElements.each(function() {
  597.                 choosenElementsText.push($(this).text());
  598.             });
  599.                
  600.             $thisParent.find('.lp-form-tpl__field-multi_select__input--count').text(choosenElements.length);
  601.             $thisParent.parent().find('input').val(choosenElementsText.join(', '));
  602.         });
  603.        
  604.        
  605.        
  606.         $doc.on('click', function(e) {
  607.             if ($(e.target).closest('.lp-form-tpl__field-select, .lp-form-tpl__field-multi_select').length) return;
  608.            
  609.             $doc.find('.lp-form-tpl__field-select, .lp-form-tpl__field-multi_select').removeClass('_opened');
  610.            
  611.             $doc.find('.lp-form-tpl__field-select__list, .lp-form-tpl__field-multi_select__list').slideUp();
  612.         });
  613.     }
  614.    
  615.     lp_template.queue.calendar = function($self) {
  616.         $doc.on('click', '.js-form-calendar', function() {
  617.             var $this = $(this),
  618.                 thisCalendarInited = $this.data('calendarInited');
  619.                
  620.             if (!thisCalendarInited) {
  621.                 var bb = $this.datepicker().data('datepicker');
  622.                 bb.show();
  623.                 thisCalendarInited = $this.data('calendarInited', true);
  624.                
  625.             }
  626.         });
  627.        
  628.         $doc.on('click', '.js-form-calendar-interval', function() {
  629.             var $this = $(this),
  630.                 thisCalendarInited = $this.data('calendarInited');
  631.                
  632.             if (!thisCalendarInited) {
  633.                 var bb = $this.datepicker({
  634.                     range: true,
  635.                     multipleDatesSeparator: " - "
  636.                 }).data('datepicker');
  637.                 bb.show();
  638.                 thisCalendarInited = $this.data('calendarInited', true);
  639.             }
  640.         });
  641.     }
  642.    
  643.     lp_template.queue.lg = function($self) {
  644.         var $block = $self.find('.js-lg-init');
  645.        
  646.         if ($block.length) {
  647.             $block.lightGallery({
  648.                 selector: '.lg-item',
  649.                 share: false,
  650.                 hash: false,
  651.                 autoplayControls: false,
  652.                 actualSize: false,
  653.                 toogleThumb: false,
  654.                 getCaptionFromTitleOrAlt: false,
  655.                 download: false,
  656.                 thumbWidth: 64,
  657.                 thumbHeight: '64px',
  658.                 nextHtml: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.98528 4.32805C9.3758 3.93753 10.009 3.93753 10.3995 4.32805L17.0563 10.9849C17.4469 11.3754 17.4469 12.0086 17.0563 12.3991L10.3995 19.056C10.009 19.4465 9.3758 19.4465 8.98528 19.056C8.59475 18.6654 8.59475 18.0323 8.98528 17.6418L14.935 11.692L8.98528 5.74226C8.59475 5.35174 8.59475 4.71857 8.98528 4.32805Z" fill="white"/></svg>',
  659.                 prevHtml: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14.8492 5.03516L8.19239 11.692L14.8492 18.3489" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>'
  660.             });
  661.         }
  662.     }
  663.    
  664.     lp_template.queue.qaToggle = function($self) {
  665.         var $block = $self.hasClass('js-qa-toggle') ? $self : $self.find('.js-qa-toggle');
  666.        
  667.         if($block.length) {
  668.             $block.each(function(){
  669.                 var $this = $(this);
  670.                
  671.                 if($('.lp-qa-3-questions-col').length) {
  672.                     var elemLength = $('.lp-qa-3-questions-col:first-child').find('.lp-qa-3-questions__item');
  673.                     function getMaxOfArray(nums) {
  674.                       return Math.max.apply(null, nums);
  675.                     }
  676.                     for (i = 0; i < elemLength.length; i++) {
  677.                         var i = i,
  678.                             numArr = [],
  679.                             $thisElem = $this.find('.lp-qa-3-questions__item:nth-child(' + (i + 1) + ') .lp-qa-3-questions__item-title');
  680.                             $($thisElem).each(function(){
  681.                                 var height = $(this).outerHeight();
  682.                                     numArr.push(height);
  683.                             });
  684.                         $thisElem.css('height', getMaxOfArray(numArr));
  685.                     }
  686.                 }
  687.            
  688.                 if (s3LP.is_cms && !$('body').hasClass('preview_mode')) {
  689.                     setTimeout(function(){
  690.                         $this.find('._col:first-child ._item:first-child').addClass('isCMS').addClass('active');
  691.                     },500);
  692.                 }
  693.        
  694.                 var $button = $this.find('.js-qa-show'),
  695.                     activeClass = 'active',
  696.                     $closeButton = $this.find('.js-qa-hide');
  697.                    
  698.                    
  699.                    
  700.                
  701.                 $button.on('click', function(e) {
  702.                     e.preventDefault();
  703.                     var $parent = $(this).closest('._item'),
  704.                     $wrapScroll = $(window).scrollTop();
  705.                    
  706.                     $parent.addClass(activeClass);
  707.                     $parent.find('._text').slideDown();
  708.                     $(this).siblings('.js-qa-hide').attr('data-scroll-top', $wrapScroll);
  709.                 });
  710.                
  711.                 $closeButton.on('click', function(e) {
  712.                     e.preventDefault();
  713.                     var $parent = $(this).closest('._item'),
  714.                     $scroolTop = $(this).attr('data-scroll-top');
  715.                    
  716.                    
  717.                     $parent.removeClass(activeClass);
  718.                     $parent.find('._text').slideUp();
  719.                     $(window).scrollTop($scroolTop);
  720.                 });
  721.             });
  722.            
  723.         }
  724.     }
  725.    
  726.     lp_template.queue.titleHeight = function($self) {
  727.         var $block = $self.find('.js-title-height'),
  728.             func = function() {
  729.                 $block.each(function(){
  730.                     var $this = $(this),
  731.                         $title = $this.find('._title'),
  732.                         minWidth = $this.data('min-width') || 960,
  733.                         minHeight = 0;
  734.                        
  735.                     $title.css({
  736.                         minHeight: 0
  737.                     });
  738.                    
  739.                     if ($(window).width() >= minWidth) {
  740.                         $title.each(function(){
  741.                             var thisHeight = $(this).height();
  742.                            
  743.                             if (minHeight < thisHeight) {
  744.                                 minHeight = thisHeight;
  745.                             }
  746.                         });
  747.                        
  748.                         $title.css({
  749.                             minHeight: minHeight
  750.                         });
  751.                     }
  752.                 });
  753.             };
  754.            
  755.         $(window).on('resize', func);
  756.         if (s3LP.is_cms) {
  757.             setTimeout(function(){
  758.                 LpController.afterSave(function () {
  759.                     func();
  760.                 });
  761.             },1000);
  762.         }
  763.     }
  764.    
  765.     lp_template.queue.accordeon = function($self) {
  766.         var $block = $self.find('.js-accordeon');
  767.        
  768.         $block.on('click', function() {
  769.             var $thisParent = $(this).closest('._item'),
  770.                 $thisText = $thisParent.find('._text');
  771.            
  772.             if (!$thisText.is(':animated')) {
  773.                 $thisParent.toggleClass('active');
  774.                 $thisText.slideToggle();
  775.             }
  776.         });
  777.        
  778.         if (s3LP.is_cms && !$('body').hasClass('preview_mode')) {
  779.             $block.closest('[data-block-layout]').find('._item:first-child').addClass('isCMS').addClass('active');
  780.         }
  781.     }
  782.    
  783.     lp_template.queue.qa10Tabs = function($self) {
  784.         var $block = $self.find('.js-10-qa');
  785.        
  786.         $win.on('resize', function(){
  787.            
  788.             $block.each(function(){
  789.                 var contentHeight = 0,
  790.                     $this = $(this);
  791.                
  792.                 $this.find('.lp-qa-10-item__text').each(function(){
  793.                     if ($(this).height()>contentHeight){
  794.                         contentHeight = $(this).height()
  795.                     }
  796.                 });
  797.                
  798.                 $this.find('.lp-qa-10-content').css('min-height', contentHeight);
  799.             });
  800.         });
  801.        
  802.         $block.on('click', '.lp-qa-10-item__title', function() {
  803.             var $this = $(this),
  804.                 $parent = $this.closest('.js-10-qa'),
  805.                 $content = $this.parent().find('.lp-qa-10-item__text'),
  806.                 $allTitles = $parent.find('.lp-qa-10-item__title');
  807.                
  808.             if ($win.width() > 959) {
  809.            
  810.                 var qaContent = $parent.find('.lp-qa-10-content');
  811.  
  812.                 if ($this.hasClass('_active')) {
  813.                     qaContent.html('');            
  814.                     $this.removeClass('_active');
  815.                 } else {
  816.                     qaContent.html('');
  817.                     $allTitles.removeClass('_active');
  818.                     $this.addClass('_active');
  819.                     $content.clone(true).removeAttr('style').appendTo(qaContent);
  820.                 }
  821.                
  822.            
  823.             } else {
  824.                
  825.                 if ($this.hasClass('_active')) {
  826.                     $this.removeClass('_active');
  827.                     $content.slideUp();
  828.                 } else {
  829.                     $allTitles.removeClass('_active');
  830.                     $parent.find('.lp-qa-10-item__text').slideUp();
  831.  
  832.                     $this.toggleClass('_active')
  833.                     $content.slideDown();
  834.                 }
  835.             }
  836.         });
  837.        
  838.         $block.each(function(){
  839.             var $this = $(this);
  840.            
  841.             $this.append('<div class="lp-qa-10-content"></div>');
  842.            
  843.             $this.find('.lp-qa-10-item__title').eq(0).trigger('click');
  844.         });
  845.     }
  846.  
  847.     lp_template.queue.videoPlayButton = function($self) {
  848.         $self.find('.js-lp-play-video').remove();
  849.         $self.find('.lp-video-block-wrappper').find('video').attr('controls', 1);
  850.        
  851.     }
  852.    
  853.     lp_template.queue.lpStepForm = function($self) {
  854.       var $block = $self.find('.js-lp-steps-form');
  855.    
  856.       if ($block.length) {
  857.         $block.formsteps();
  858.       }
  859.     }
  860.    
  861.     lp_template.queue.qaSlider1 = function($self) {
  862.         var $block = $self.find('.js-qa-slider-1');
  863.  
  864.         if ($block.length) {
  865.             $block.each(function(){
  866.                 var $this = $(this),
  867.                     autoplay = !!$this.data('autoplay'),
  868.                     count = $this.data('count') || 2,
  869.                     loop = !!$this.data('infinite'),
  870.                     nav = !!$this.data('arrows'),
  871.                     dots = !!$this.data('dots'),
  872.                     pause = $this.data('pause') || 5000,
  873.                     speed = $this.data('speed') || 250,
  874.                     $parent = $this.closest('[data-block-layout]'),
  875.                     $dots = $parent.find('.js-dot-item');
  876.  
  877.                 $this.owlCarousel({
  878.                     autoplay : autoplay,
  879.                     loop : loop,
  880.                     nav : nav,
  881.                     dots : true,
  882.                     smartSpeed: speed,
  883.                     autoplayTimeout: pause,
  884.                     responsive:{
  885.                         0: {
  886.                             items : 1,
  887.                             margin : 0
  888.                         },
  889.                         960: {
  890.                             items: count,
  891.                             margin : count > 1 ? 48 : 0
  892.                         },
  893.                         1200: {
  894.                             items: count,
  895.                             margin : count > 1 ? 24 : 0
  896.                         },
  897.                         1380: {
  898.                             items: count,
  899.                             margin : count > 1 ? 32 : 0
  900.                         }
  901.                     },
  902.                     onInitialized: function() {
  903.                         $dots.eq(0).addClass('active')
  904.                     },
  905.                     onTranslated: function(e) {
  906.                         $dots.removeClass('active');
  907.                     }
  908.                 });
  909.  
  910.                 $parent.on('click', '.js-next-slide', function(e) {
  911.                     e.preventDefault();
  912.                     $this.trigger('next.owl.carousel');
  913.                 });
  914.  
  915.                 $parent.on('click', '.js-prev-slide', function(e) {
  916.                     e.preventDefault();
  917.                     $this.trigger('prev.owl.carousel');
  918.                 });
  919.  
  920.                 $parent.on('click', '.js-dot-item', function(e) {
  921.                     e.preventDefault();
  922.                     $this.trigger('to.owl.carousel', [$(this).index()]);
  923.                 });
  924.  
  925.             });
  926.         }
  927.     }
  928.  
  929.     lp_template.queue.simpleSlider = function($self) {
  930.         var $block = $self.find('.js-simple-slider');
  931.  
  932.             if ($block.length) {
  933.                 $block.each(function(){
  934.                     var $this = $(this),
  935.                         autoplay = !!$this.data('autoplay'),
  936.                         loop = !!$this.data('infinite'),
  937.                         autoWidth = !!$this.data('autowidth'),
  938.                         center = !!$this.data('center'),
  939.                         nav = !!$this.data('arrows'),
  940.                         dotsEach = !!$this.data('dots-each'),
  941.                         dots = 1,
  942.                         pause = $this.data('pause') || 5000,
  943.                         speed = $this.data('speed') || 250,
  944.                         fade = !!$this.data('fade'),
  945.                         parentSelector = $this.data('parent') ? $this.data('parent') : '[data-block-layout]',
  946.                         $parent = $this.closest(parentSelector),
  947.                         dataResponse = $this.data('response'),
  948.                         response = {},
  949.                         $dots = $parent.find('.lp-dots-wrapper');
  950.    
  951.                     response.responsive = dataResponse || {};
  952.                     if ($this.parents('[data-elem-type="block"]').find('.js-lg-init').length) {
  953.                         setTimeout(function(){
  954.                             initSlider()
  955.                         }, 500);
  956.                     } else {
  957.                         initSlider()
  958.                     };
  959.                    
  960.  
  961.                     function initSlider() {
  962.                         $this.owlCarousel($.extend({
  963.                             items : 1,
  964.                             autoplay : autoplay,
  965.                             loop : loop,
  966.                             autoWidth: autoWidth,
  967.                             center: center,
  968.                             nav : nav,
  969.                             dots : true,
  970.                             dotsEach: dotsEach,
  971.                             animateIn: fade ? 'fadeIn' : false,
  972.                             animateOut: fade ? 'fadeOut' : false,
  973.                             smartSpeed: speed,
  974.                             mouseDrag: s3LP.is_cms ? false : true,
  975.                             autoplayTimeout: pause,
  976.                             onInitialized: function(e) {
  977.                                 var $dotsCount = $parent.find('.owl-dot').length;
  978.                                
  979.                                 if (!$dots.length || $dotsCount < 2) {
  980.                                     $dots.html('');
  981.                                    
  982.                                     $parent.find('.js-next-slide, .js-prev-slide').addClass('_hide');
  983.                                     return;
  984.                                 };
  985.                                 var $dotsHTML = '';
  986.                                
  987.                                 for(var i = 0; i < $dotsCount; i++) {
  988.                                     $dotsHTML += '<div class="lp-dots-item js-dot-item" data-elem-type="container" data-lp-selector=".lp-dots-item"></div>';
  989.                                 }
  990.                                
  991.                                 if (!$dots.hasClass('_unchanged')) {
  992.                                
  993.                                     $dots.html($dotsHTML);
  994.                                
  995.                                 }
  996.                                
  997.                                 $dots.find('.lp-dots-item').eq(0).addClass('active');
  998.                                
  999.                             },
  1000.                            
  1001.                             onResized: function(e) {
  1002.                                 if (!$dots.length || e.page.count < 2) {
  1003.                                     $dots.html('');
  1004.                                     $parent.find('.js-next-slide, .js-prev-slide').addClass('_hide');
  1005.                                     $parent.find('.js-next-slide, .js-prev-slide').removeClass('_show');
  1006.                                     return;
  1007.                                 } else {
  1008.                                     $parent.find('.js-next-slide, .js-prev-slide').addClass('_show');
  1009.                                     $parent.find('.js-next-slide, .js-prev-slide').removeClass('_hide');
  1010.                                 }
  1011.                                
  1012.                                 var $dotsHTML = '';
  1013.                                 for(var i = 0; i < e.page.count; i++) {
  1014.                                     $dotsHTML += '<div class="lp-dots-item js-dot-item" data-elem-type="container" data-lp-selector=".lp-dots-item"></div>';
  1015.                                 }
  1016.                                
  1017.                                 if (!$dots.hasClass('_unchanged')) {
  1018.                                     $dots.html($dotsHTML);
  1019.                                 }
  1020.                                 $dots.find('.lp-dots-item').removeClass('active');
  1021.                                 $dots.find('.lp-dots-item').eq(e.page.index).addClass('active');
  1022.                             },
  1023.                             onTranslate: function(e) {
  1024.                                 $dots.find('.lp-dots-item').removeClass('active');
  1025.                                 $dots.find('.lp-dots-item').eq(e.page.index).addClass('active');
  1026.                             }
  1027.                         }, response));
  1028.        
  1029.                         $parent.on('click', '.js-next-slide', function(e) {
  1030.                             e.preventDefault();
  1031.                             $this.trigger('next.owl.carousel');
  1032.                         });
  1033.        
  1034.                         $parent.on('click', '.js-prev-slide', function(e) {
  1035.                             e.preventDefault();
  1036.                             $this.trigger('prev.owl.carousel');
  1037.                         });
  1038.        
  1039.                         $parent.on('click', '.js-dot-item', function(e) {
  1040.                             e.preventDefault();
  1041.                             $this.trigger('to.owl.carousel', [$(this).index()]);
  1042.                         });
  1043.                        
  1044.                         if (s3LP.is_cms) {
  1045.                             setTimeout(function(){
  1046.                                 LpController.afterSave(function () {
  1047.                                     setTimeout(function(){
  1048.                                         $this.trigger('refresh.owl.carousel');
  1049.                                     },500);
  1050.                                 });
  1051.                                 $this.trigger('refresh.owl.carousel');
  1052.                             },3000);
  1053.                         }
  1054.                        
  1055.                         $win.on('load', function(){
  1056.                             setTimeout(function(){
  1057.                                 $this.trigger('refresh.owl.carousel');
  1058.                                
  1059.                                 if($this.hasClass('js-lg-init')) {
  1060.                                     $this.data('lightGallery').destroy(true);
  1061.                                     $this.lightGallery({
  1062.                                         selector: 'div:not(.cloned) .lg-item',
  1063.                                         share: false,
  1064.                                         hash: false,
  1065.                                         autoplayControls: false,
  1066.                                         actualSize: false,
  1067.                                         toogleThumb: false,
  1068.                                         getCaptionFromTitleOrAlt: false,
  1069.                                         download: false,
  1070.                                         thumbWidth: 64,
  1071.                                         thumbHeight: '64px',
  1072.                                         nextHtml: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.98528 4.32805C9.3758 3.93753 10.009 3.93753 10.3995 4.32805L17.0563 10.9849C17.4469 11.3754 17.4469 12.0086 17.0563 12.3991L10.3995 19.056C10.009 19.4465 9.3758 19.4465 8.98528 19.056C8.59475 18.6654 8.59475 18.0323 8.98528 17.6418L14.935 11.692L8.98528 5.74226C8.59475 5.35174 8.59475 4.71857 8.98528 4.32805Z" fill="white"/></svg>',
  1073.                                         prevHtml: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14.8492 5.03516L8.19239 11.692L14.8492 18.3489" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>'
  1074.                                     });
  1075.                                 } // Из за ошибки со слайдером переподключаем галерею
  1076.                             },500);
  1077.                         });
  1078.                     }
  1079.    
  1080.                 });
  1081.             }
  1082.  
  1083.        
  1084.            
  1085.         if ($block.hasClass('lp-video-9-slides-wrapp')) {
  1086.             $('.lp-video-9-slides-wrapp').on('changed.owl.carousel', function(event) {
  1087.               $('.lp-video-9-slides-wrapp video').trigger('pause');
  1088.               $('.lp-video-9-slides-wrapp ._lp-youtube-video').each(function(){
  1089.                   var el_src = $(this).attr("src");
  1090.                     $(this).attr("src",el_src);
  1091.               });
  1092.             })
  1093.         }
  1094.     }
  1095.    
  1096.     lp_template.queue.adv17HalfHeight = function($self) {  
  1097.         var $block = $self.find('.js-advantages-17');
  1098.    
  1099.         $block.each(function(){
  1100.             var $this = $(this);
  1101.    
  1102.    
  1103.             $(window).on('resize', function(){
  1104.                 calcMargin($this);
  1105.             });    
  1106.         });
  1107.    
  1108.         function calcMargin(e) {
  1109.             var itemHalfHeight = e.parent().find('.lp-advantages-17__item').eq(0).outerHeight() / 2;
  1110.            
  1111.             e.css({
  1112.                 paddingBottom: itemHalfHeight,
  1113.                 marginBottom: -itemHalfHeight
  1114.             });    
  1115.         };
  1116.     }
  1117.    
  1118.     lp_template.queue.video13 = function($self) {  
  1119.         var $block = $self.find('.js-video-13');
  1120.    
  1121.         $block.each(function(){
  1122.             var $this = $(this);
  1123.    
  1124.    
  1125.             $(window).on('resize', function(){
  1126.                 calcMargin($this);
  1127.             });    
  1128.         });
  1129.    
  1130.         function calcMargin(e) {
  1131.             var itemHeight = e.parent().find('.lp-video-13__item-video').eq(0).outerHeight();
  1132.            
  1133.             e.css({
  1134.                 paddingBottom: itemHeight,
  1135.                 marginBottom: -itemHeight
  1136.             });    
  1137.         };
  1138.     }
  1139.    
  1140.     lp_template.queue.header15Popup = function($self) {
  1141.         var $block = $self.find('.lp-header-15');
  1142.         $block.find('.js-burger').on('click', function(){
  1143.             $(this).closest('.lp-wrapp').find('.js-menu__wrap').fadeIn().addClass('opened');
  1144.             $('body').css('overflow', 'hidden');
  1145.         });
  1146.         $block.find('.js-close, .js-bg').on('click', function(){
  1147.             $(this).closest('.lp-wrapp').find('.js-menu__wrap').removeClass('opened').fadeOut();
  1148.             $('body').css('overflow','visible');
  1149.         });
  1150.        
  1151.         $block.find('.js-menu a').on('click', function(){
  1152.             setTimeout(function(){
  1153.                 $block.find('.js-menu__wrap').removeClass('opened').fadeOut();
  1154.                 $('body').css('overflow','visible');
  1155.             },300);
  1156.         });
  1157.        
  1158.         $(document).keyup(function(e) {
  1159.              if (e.key === "Escape") { // escape key maps to keycode '27'
  1160.                 $block.find('.js-menu__wrap.opened').removeClass('opened').fadeOut();
  1161.                 $('body').css('overflow','visible');
  1162.             }
  1163.         });
  1164.     }
  1165.    
  1166.     lp_template.queue.lpTimer = function($self) {
  1167.         var $block = $self.find('.js-lp-timer'),
  1168.             htmlLang = document.documentElement.lang,
  1169.             timerDays, timerHours, timerMinutes, timerSeconds, formatOut;
  1170.        
  1171.         if (htmlLang == 'de' || htmlLang == 'en') {
  1172.             timerDays = 'days';
  1173.             timerHours = 'hours';
  1174.             timerMinutes = 'minutes';
  1175.             timerSeconds = 'seconds'
  1176.         } else {
  1177.             timerDays = 'Дней';
  1178.             timerHours = 'Часов';
  1179.             timerMinutes = 'Минут';
  1180.             timerSeconds = 'Секунд'
  1181.         }
  1182.        
  1183.         var formatOut = '<div class="lp-ui-timer__item"><div class="lp-ui-timer__item-number" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-number">%d</div><div class="lp-ui-timer__item-text lp-header-text-4" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-text">' + timerDays + '</div></div><div class="lp-ui-timer__item"><div class="lp-ui-timer__item-number" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-number">%h</div><div class="lp-ui-timer__item-text lp-header-text-4" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-text">' + timerHours + '</div></div><div class="lp-ui-timer__item"><div class="lp-ui-timer__item-number" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-number">%m</div><div class="lp-ui-timer__item-text lp-header-text-4" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-text">' + timerMinutes + '</div></div><div class="lp-ui-timer__item"><div class="lp-ui-timer__item-number" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-number">%s</div><div class="lp-ui-timer__item-text lp-header-text-4" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-text">' + timerSeconds +'</div></div>';
  1184.         var formatEnd = '<div class="lp-ui-timer__item"><div class="lp-ui-timer__item-number" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-number">00</div><div class="lp-ui-timer__item-text lp-header-text-4" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-text">' + timerDays + '</div></div><div class="lp-ui-timer__item"><div class="lp-ui-timer__item-number" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-number">00</div><div class="lp-ui-timer__item-text lp-header-text-4" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-text">' + timerHours + '</div></div><div class="lp-ui-timer__item"><div class="lp-ui-timer__item-number" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-number">00</div><div class="lp-ui-timer__item-text lp-header-text-4" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-text">' + timerMinutes + '</div></div><div class="lp-ui-timer__item"><div class="lp-ui-timer__item-number" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-number">00</div><div class="lp-ui-timer__item-text lp-header-text-4" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-text">' + timerSeconds +'</div></div>';
  1185.        
  1186.        
  1187.        
  1188.         if ($block.length) {
  1189.             $block.each(function(){
  1190.                 var $this = $(this);
  1191.                
  1192.                 $this.timer({
  1193.                     format_in: "%d.%M.%y %h:%m:%s",
  1194.                     language: htmlLang,
  1195.                     update_time: s3LP.is_cms ? 100000 : 1000,
  1196.                     format_out: formatOut,
  1197.                     onEnd: function(){
  1198.                         $this.html(formatEnd);
  1199.                         console.log(123)
  1200.                     }
  1201.                 })
  1202.             });
  1203.         }
  1204.     }
  1205.    
  1206.         lp_template.queue.menu11Popup = function($self) {
  1207.         var $block = $self.hasClass('lp-menu-11') ? $self : $self.find('.lp-menu-11');
  1208.        
  1209.         $($block).append('<div class="lp-menu-block-bg"></div>');
  1210.        
  1211.         if (!$block.length) return;
  1212.            
  1213.         $block.each(function(){
  1214.             var $this = $(this),
  1215.                 contactsMobile = true,
  1216.                 mobile = true;
  1217.            
  1218.             $(window).on('resize', function(){
  1219.                 contactsMobile = contactsPend($this, contactsMobile);
  1220.                 mobile = menuPend($this, mobile);
  1221.             });
  1222.         })
  1223.            
  1224.         function contactsPend($block, bool) {
  1225.        
  1226.             if (window.matchMedia('(max-width : 599px)').matches && !bool) {
  1227.                 $block.find('.lp-menu-11__top').appendTo($block.find('.lp-menu-11__popup .lp-menu-11__menu_inner'));
  1228.                 return true;
  1229.             }
  1230.             else if (window.matchMedia('(min-width : 600px)').matches && bool) {
  1231.                 $block.find('.lp-menu-11__top').prependTo($block.find('.lp-menu-11-wrap_top .lp-wrapp'));
  1232.                 return false;
  1233.             }
  1234.            
  1235.             return bool;
  1236.         }
  1237.        
  1238.         function menuPend($block, bool) {
  1239.             if (window.matchMedia('(max-width : 959px)').matches && !bool) {
  1240.                 $block.find('.js-menu_appedable').prependTo($block.find('.lp-menu-11__popup'));
  1241.                 $block.find('.lp-menu-11__burger').show().css('display', 'flex');
  1242.                 return true;
  1243.             }
  1244.             else if (window.matchMedia('(min-width : 960px)').matches && bool) {
  1245.                 $block.find('.lp-menu-11__logo').after($block.find('.js-menu_appedable'));
  1246.                 return false;
  1247.             }
  1248.            
  1249.             return bool;
  1250.         }
  1251.        
  1252.        
  1253.         var $popup = $block.find('.js-popup'),
  1254.             popupHeight = $(window).height() - $block.height(),
  1255.             menuHeight = $block.outerHeight(),
  1256.             popupTop = menuHeight < 0 ? 0 : menuHeight,
  1257.             popupTop = s3LP.is_cms ? popupTop + 72 : popupTop,
  1258.             $bgTop = $block.height() + 50 < 0 ? 0 : $block.height() + 50,
  1259.             $bgTop = s3LP.is_cms ? $bgTop + 72 : $bgTop;
  1260.            
  1261.         $block.find('.lp-menu-block-bg').css({top: $bgTop});
  1262.        
  1263.         $popup.css({top: popupTop});
  1264.        
  1265.    
  1266.         $block.find('.js-burger').on('click', function(){
  1267.             if ($(this).hasClass('_in-side')) {
  1268.                 $popup.animate({top: 0}, 200);
  1269.                 $block.find('.lp-menu-block-bg').css('top', 0);
  1270.             }
  1271.             if (!$(this).hasClass('_in-side')) {
  1272.                 if (s3LP.is_cms) {
  1273.                     $('html, body').animate({
  1274.                         scrollTop: $block.offset().top - 72
  1275.                     }, 200);
  1276.                 }
  1277.                 else {
  1278.                     $('html, body').animate({
  1279.                         scrollTop: $block.offset().top
  1280.                     }, 200);
  1281.                 }
  1282.             }
  1283.            
  1284.             $popup.css('overflow', 'auto');
  1285.            
  1286.             $block.find('.js-burger').toggleClass('opened');
  1287.             if ($(this).closest('.lp-menu-11').find('.js-popup').hasClass('opened')) {
  1288.                 $(this).closest('.lp-menu-11').find('.js-popup').animate({height: "0%"}, 300,
  1289.                     function() {
  1290.                         $block.css('z-index', '');
  1291.                     }
  1292.                 ).removeClass('opened');
  1293.                 $block.find('.lp-menu-block-bg').fadeOut(300);
  1294.                
  1295.                 $('html').css('overflow', '');
  1296.                 if (s3LP.is_cms) {
  1297.                     $('html').css('overflow', '');
  1298.                 }
  1299.             }
  1300.             else {
  1301.                 $(this).closest('.lp-menu-11').find('.js-popup').animate({height: popupHeight}, 800).addClass('opened');
  1302.                 $block.find('.lp-menu-block-bg').fadeIn(800);
  1303.                 $block.css('z-index', '30');
  1304.                 $('html').css('overflow', 'hidden');
  1305.                 if (s3LP.is_cms) {
  1306.                     $('html').css('overflow', 'hidden');
  1307.                 }
  1308.             }
  1309.            
  1310.         });
  1311.        
  1312.         $(document).on('click', function(e) {
  1313.             if(!$(e.target).closest('.lp-menu-11__popup, .lp-menu-11-button, .lp-block-menu-12__btn, .lp-block-menu-12__menu-in, .lp-menu-21__popup, .lp-menu-21-button').not(this).length){
  1314.                 $(this).find('.js-popup').animate({height: "0%"}, 300,
  1315.                     function() {
  1316.                         $block.css('z-index', '');
  1317.                     }
  1318.                 ).removeClass('opened');
  1319.                 $(this).find('.lp-menu-block-bg').fadeOut(300);
  1320.                 $block.find('.js-burger').removeClass('opened');
  1321.                 $('html').css('overflow', '');
  1322.                 if (s3LP.is_cms) {
  1323.                     $('html').css('overflow', '');
  1324.                 }
  1325.             }
  1326.         });
  1327.        
  1328.         $block.find('.lp-menu-11__menu__link').on('click', function(){
  1329.             $block.find('.js-burger').toggleClass('opened');
  1330.             $popup.animate({height: "0%"}, 100,
  1331.                 function() {
  1332.                     $block.css('z-index', '');
  1333.                 }
  1334.             ).removeClass('opened');
  1335.             $block.find('.lp-menu-block-bg').fadeOut(800);
  1336.             $('html').css('overflow', '');
  1337.         });
  1338.        
  1339.         $(window).on('resize', function(){
  1340.             var $ulWidth = 0,
  1341.                 $ulWrapWidth = $block.find('.lp-menu-11__bot').innerWidth() - ($block.find('.lp-menu-11__logo').width() + $block.find('.lp-menu-11__right').outerWidth(true));
  1342.             $('li.lp-menu-11__menu__list-item').each(function(){
  1343.                 var $width = $(this).outerWidth(true);
  1344.                 $ulWidth += $width;
  1345.             });
  1346.             if (window.matchMedia('(min-width : 961px)').matches && ($ulWidth > $ulWrapWidth)) {
  1347.                 $block.find('.js-menu_appedable').prependTo('.lp-menu-11__popup');
  1348.                 $block.find('.lp-menu-11__burger').show().css('display', 'flex');
  1349.             }
  1350.             else if (window.matchMedia('(min-width : 961px)').matches && ($ulWidth < $ulWrapWidth)) {
  1351.                 $block.find('.lp-menu-11__logo').after($block.find('.js-menu_appedable'));
  1352.                 $block.find('.lp-menu-11__burger').hide();
  1353.             }
  1354.            
  1355.            
  1356.            
  1357.             menuHeight = $block.outerHeight(),
  1358.             popupTop = menuHeight < 0 ? 0 : menuHeight,
  1359.             popupTop = s3LP.is_cms ? popupTop + 72 : popupTop,
  1360.             $bgTop = $block.height() + 50 < 0 ? 0 : $block.height() + 50,
  1361.             $bgTop = s3LP.is_cms ? $bgTop + 72 : $bgTop;
  1362.            
  1363.             $popup.animate({top: popupTop});
  1364.            
  1365.             $block.find('.lp-menu-block-bg').css('top', $bgTop);
  1366.         });
  1367.     }
  1368.    
  1369.     lp_template.queue.lpReviews10Slider = function($self) {
  1370.         var $block = $self.hasClass('lp-reviews-10') ? $self : $self.find('.lp-reviews-10');
  1371.         var $slider = $block.find('.js-review-10-slider');
  1372.         if ($slider.length) {
  1373.    
  1374.             $slider.each(function(){
  1375.                
  1376.                 var $this = $(this);
  1377.                 var $parent = $this.closest('[data-block-layout]');
  1378.                 var $arrows = $this.data('arrows');
  1379.                 var $dots = $this.data('dots');
  1380.                 var $autoplay = $this.data('autoplay');
  1381.                 var $infinite = $this.data('infinite');
  1382.                 var $autoplaySpeed = $this.data('autoplay-speed');
  1383.                 var $speed = $this.data('speed');
  1384.                 var $slide = $this.find('.lp-reviews-10-slider__slide');
  1385.    
  1386.                 // это нужно для того, чтобы последний слайд всегда состоял из 3 отзывов
  1387.                 $slider.on('init', function(slick, currentSlide){
  1388.                     var slides = currentSlide.$slides;
  1389.                     var lastChild = slides[slides.length - 1];//Последний слайд
  1390.                     var children = lastChild.children;
  1391.                     var emptyDivs = [];
  1392.    
  1393.                     if(slides.length > 1) {
  1394.    
  1395.                         for(var i = 0; i < children.length; i++) {
  1396.                             if(children[i].childNodes.length < 1) {
  1397.                                 emptyDivs.push(children[i]);
  1398.                             }
  1399.                         }
  1400.    
  1401.                         for(var j = 0; j < emptyDivs.length; j++) {
  1402.                             emptyDivs[j].appendChild($slide[j].cloneNode(true));
  1403.                         }
  1404.                     }
  1405.                 });
  1406.    
  1407.                 $this.slick({
  1408.                     infinite: $infinite,
  1409.                     mobileFirst: true,
  1410.                     // fade:$fade,
  1411.                     dots:$dots,
  1412.                     autoplay: $autoplay,
  1413.                     autoplaySpeed: $autoplaySpeed,
  1414.                     speed: $speed,
  1415.                     dotsClass:'lp-reviews-10-slider__dots',
  1416.                     appendDots:$parent.find('.lp-reviews-10-slider__dots-block'),
  1417.                     arrows:false,
  1418.                     appendArrows:$parent.find('.lp-reviews-10-slider__arrows-block'),
  1419.                     prevArrow:'<a href="#" data-elem-type="card_container" data-lp-selector=".lp-reviews-10-slider__arrows" class="lp-button lp-button--type-1 lp-reviews-10-slider__arrows lp-reviews-10-slider__arrows--left _v2-icon"><div class="_slider-arrows" data-elem-type="card_container" data-lp-selector="._slider-arrows-inner"><div class="_slider-arrows-inner"></div><div class="_slider-arrows-inner"></div></div></a>',
  1420.                     nextArrow:'<a href="#" data-elem-type="card_container" data-lp-selector=".lp-reviews-10-slider__arrows" class="lp-button lp-button--type-1 lp-reviews-10-slider__arrows lp-reviews-10-slider__arrows--right _v2-icon"><div class="_slider-arrows reverse" data-elem-type="card_container" data-lp-selector="._slider-arrows-inner"><div class="_slider-arrows-inner"></div><div class="_slider-arrows-inner"></div></div></a>',
  1421.                     responsive: [
  1422.                         {
  1423.                             breakpoint: 599.9,
  1424.                             settings: {
  1425.                                 arrows:$arrows
  1426.                             }
  1427.                         },
  1428.                         {
  1429.                             breakpoint: 959.9,
  1430.                             settings: {
  1431.                                 arrows:$arrows,
  1432.                                 slidesPerRow:1,
  1433.                                 rows:3
  1434.    
  1435.                             }
  1436.                         }
  1437.                     ]
  1438.                 });
  1439.             });
  1440.             $(window).on('resize', function(){
  1441.                 setTimeout(function(){
  1442.                     var $dotItem = $block.find('.lp-reviews-10-slider__dots li button');
  1443.                     if ($dotItem.hasClass('lp-reviews-10-slider__dot')) {
  1444.                        
  1445.                     }
  1446.                     else {
  1447.                         $dotItem.attr('data-elem-type', 'card_container');
  1448.                         $dotItem.addClass('lp-reviews-10-slider__dot');
  1449.                         $dotItem.attr('data-lp-selector','.lp-reviews-10-slider__dot');
  1450.                     }
  1451.                 },100);
  1452.             });
  1453.         }
  1454.     }
  1455.    
  1456.     lp_template.queue.lpForm19CalcBottomMargin = function($self) {
  1457.         var $block = $self,
  1458.             margin = ($block.find('.lp-form-19__bottom').height()
  1459.                                 + parseInt($(".lp-form-19__bottom").css("padding-top"))
  1460.                                 + parseInt($(".lp-form-19__bottom").css("padding-bottom")))/2;
  1461.         $block.find('.lp-form-19__top-bg').css({
  1462.             "margin-bottom" : - margin                     
  1463.         });
  1464.     };
  1465.    
  1466.     lp_template.queue.lpGallery1 = function($self) {
  1467.         var $block = $self.hasClass('lp-gallery-1') ? $self : $self.find('.lp-gallery-1'),
  1468.             $mainSlider = $block.find('.js-main-slick'),
  1469.             $thumbSlider = $block.find('.js-thumb-slick'),
  1470.             $prevBtn = $block.find('.js-slider-prev'),
  1471.             $nextBtn = $block.find('.js-slider-next'),
  1472.             $slidesToShowData = $block.data('count');
  1473.    
  1474.         if ($mainSlider.length) {
  1475.             $mainSlider.slick({
  1476.                 slidesToShow: 1,
  1477.                 slidesToScroll: 1,
  1478.                 arrows: false,
  1479.                 fade: true,
  1480.                 asNavFor: $thumbSlider,
  1481.                 adaptiveHeight: false
  1482.             })
  1483.        
  1484.             $thumbSlider.slick({
  1485.                 slidesToShow: 3,
  1486.                 slidesToScroll: 1,
  1487.                 asNavFor: $mainSlider,
  1488.                 dots: false,
  1489.                 centerMode: true,
  1490.                 arrows: false,
  1491.                 touches: true,
  1492.                 prevArrow: $prevBtn,
  1493.                 nextArrow: $nextBtn,
  1494.                 focusOnSelect: true,
  1495.                 adaptiveHeight: false,
  1496.                 centerPadding: '6px',
  1497.                 mobileFirst: true,
  1498.                 swipeToSlide: false,
  1499.                 responsive: [
  1500.                     {
  1501.                         breakpoint: 600,
  1502.                         settings: {
  1503.                             slidesToShow: $slidesToShowData,
  1504.                             centerPadding: '20px'
  1505.                         }
  1506.                     },
  1507.                     {
  1508.                         breakpoint: 960,
  1509.                         settings: {
  1510.                             slidesToShow: $slidesToShowData,
  1511.                             arrows: true,
  1512.                             centerPadding: '0px'
  1513.                         }
  1514.                     }
  1515.                 ]
  1516.             });
  1517.         }
  1518.     };
  1519.    
  1520.     lp_template.queue.lpGallery3 = function ($self) {
  1521.  
  1522.         var $block = $self,
  1523.             owl = $block.find('.js-photo-3-mask'),
  1524.             $nextSlide = $block.find('.js-next-slide'),
  1525.             $prevSlide = $block.find('.js-prev-slide'),
  1526.             $thumbItem = $block.find('.js-preview-item');
  1527.        
  1528.         if (owl.length) {
  1529.        
  1530.             owl.owlCarousel({
  1531.                 items : 1,
  1532.                 autoplay : false,
  1533.                 loop : false,
  1534.                 nav : false,
  1535.                 dots : false,
  1536.                 animateIn: 'fadeIn',
  1537.                 animateOut: 'fadeOut',
  1538.                 smartSpeed: 300,
  1539.                 mouseDrag: false,
  1540.                 touchDrag: false
  1541.             });
  1542.        
  1543.        
  1544.             $($nextSlide).click(function(e) {
  1545.                 e.preventDefault();
  1546.                 owl.trigger('next.owl.carousel');
  1547.             });
  1548.             $($prevSlide).click(function(e) {
  1549.                 e.preventDefault();
  1550.                 owl.trigger('prev.owl.carousel', [300]);
  1551.             });
  1552.        
  1553.             $($thumbItem).on('click', function () {
  1554.                 var click = $(this).index();
  1555.                 owl.trigger( 'to.owl.carousel', [click] );
  1556.                 $(this).addClass('_active').siblings().removeClass('_active');
  1557.             });
  1558.         }
  1559.     };
  1560.    
  1561.     lp_template.queue.products29 = function($self) {
  1562.       $self.on('click', '.js-gallery29-item', function(){
  1563.         var $this = $(this);
  1564.    
  1565.         $this.addClass('_active').siblings().removeClass('_active');
  1566.         $this.closest('[data-block-layout]').find('.lp-prods-29-background__item').removeClass('_active').eq($this.index()).addClass('_active');
  1567.    
  1568.       });
  1569.     }
  1570.    
  1571.     lp_template.queue.lpGallery17 = function($self) {
  1572.        
  1573.         var $block = $self.hasClass('js-grid-gallery') ? $self : $self.find('.js-grid-gallery');
  1574.        
  1575.         $block.each(function(){
  1576.             if ($block.length) {
  1577.                 var $this = $(this),
  1578.                     $slider = $this.find('.js-gallery-items'),
  1579.                     autoplay = !!$slider.data('autoplay'),
  1580.                     infinite = !!$slider.data('infinite'),
  1581.                     nav = !!$slider.data('arrows'),
  1582.                     dotsEach = !!$slider.data('dots-each'),
  1583.                     dots = true,
  1584.                     pause = $slider.data('pause') || 5000,
  1585.                     speed = $slider.data('speed') || 250,
  1586.                     fade = !!$slider.data('fade'),
  1587.                     $parent = $slider.closest('[data-block-layout]'),
  1588.                     dataResponse = $slider.data('response'),
  1589.                     response = {},
  1590.                     $dots = $this.find('.lp-dots-wrapper');
  1591.                 try {
  1592.                     let owl = $this.find('.js-gallery-items.js-owl-carousel'),
  1593.                         windowWidth = $(window).width(),
  1594.                         gridFormer = function(){
  1595.                         let wrapper = '<div class="js-gallery-items-grid"></div>',
  1596.                             itemsCount = $slider.children('.js-gallery-item').length,
  1597.                             sliceFunc = function(itemsInGrid){
  1598.                                 for (var i = 0; i < itemsCount/itemsInGrid; i++) {
  1599.                                     $slider.children('.js-gallery-item').slice(0, itemsInGrid).wrapAll(wrapper);
  1600.                                 }
  1601.                                 $slider.find('.js-gallery-items-grid').each(function(){
  1602.                                     $(this).addClass('_'+$(this).children().length);
  1603.                                 });
  1604.                             };
  1605.        
  1606.                         if (windowWidth<600) {
  1607.                             sliceFunc(2);                  
  1608.                         } else if (windowWidth<1200) {
  1609.                             sliceFunc(4);
  1610.                         } else {
  1611.                             sliceFunc(5);
  1612.                         }
  1613.                     }
  1614.        
  1615.                     let initOwl = function(){
  1616.        
  1617.                         $slider.owlCarousel($.extend({
  1618.                             items : 1,
  1619.                             autoplay : autoplay,
  1620.                             loop : infinite,
  1621.                             rewind: true,
  1622.                             nav : nav,
  1623.                             dots : dots,
  1624.                             animateIn: fade ? 'fadeIn' : false,
  1625.                             animateOut: fade ? 'fadeOut' : false,
  1626.                             smartSpeed: speed,
  1627.                             autoplayTimeout: pause,
  1628.                             margin: 16,
  1629.                             onInitialized: function(e) {
  1630.                                 var $dotsCount = $this.find('.owl-dot').length;
  1631.                                
  1632.                                 if (!$dots.length || $dotsCount < 2) {
  1633.                                     $dots.html('');
  1634.                                     return;
  1635.                                 };
  1636.                                 var $dotsHTML = '';
  1637.                                
  1638.                                 for(var i = 0; i < $dotsCount; i++) {
  1639.                                     $dotsHTML += '<div class="lp-dots-item js-dot-item" data-elem-type="container" data-lp-selector=".lp-dots-item"></div>';
  1640.                                 }
  1641.                                
  1642.                                 if (!$dots.hasClass('_unchanged')) {
  1643.                                
  1644.                                     $dots.html($dotsHTML);
  1645.                                
  1646.                                 }
  1647.                                
  1648.                                 $dots.find('.lp-dots-item').eq(0).addClass('active');
  1649.                                
  1650.                             },
  1651.                            
  1652.                             onResized: function(e) {
  1653.                                 if (!$dots.length || e.page.count < 2) {
  1654.                                     $dots.html('');
  1655.                                     return;
  1656.                                 }
  1657.                                
  1658.                                 var $dotsHTML = '';
  1659.                                 for(var i = 0; i < e.page.count; i++) {
  1660.                                     $dotsHTML += '<div class="lp-dots-item js-dot-item" data-elem-type="container" data-lp-selector=".lp-dots-item"></div>';
  1661.                                 }
  1662.                                
  1663.                                 if (!$dots.hasClass('_unchanged')) {
  1664.                                     $dots.html($dotsHTML);
  1665.                                 }
  1666.                                 $dots.find('.lp-dots-item').removeClass('active');
  1667.                                 $dots.find('.lp-dots-item').eq(e.page.index).addClass('active');
  1668.                             },
  1669.                             onTranslated: function(e) {
  1670.                                 $dots.find('.lp-dots-item').removeClass('active');
  1671.                                 $dots.find('.lp-dots-item').eq(e.page.index).addClass('active');
  1672.                             }
  1673.                         }, response));
  1674.                         $this.find('.js-next-slide').off();
  1675.                         $this.find('.js-next-slide').on('click', function(e) {
  1676.                             e.preventDefault();
  1677.                             owl.trigger('next.owl.carousel');
  1678.                         });
  1679.                         $this.find('.js-prev-slide').off();
  1680.                         $this.find('.js-prev-slide').on('click', function(e) {
  1681.                             e.preventDefault();
  1682.                             owl.trigger('prev.owl.carousel');
  1683.                         });
  1684.        
  1685.                     }
  1686.        
  1687.                     let reInitOwl = function(){
  1688.                         owl.trigger('destroy.owl.carousel');
  1689.                         $this.find('.js-gallery-item').unwrap();
  1690.                         gridFormer();
  1691.                         initOwl();
  1692.                     }
  1693.        
  1694.                     gridFormer();
  1695.                    
  1696.                     initOwl();
  1697.        
  1698.        
  1699.                     $(window).resize(function(){                
  1700.                         let newWindowWidth = $(window).width();
  1701.                         if (windowWidth < 1200 && windowWidth >= 600) {                
  1702.                             if (newWindowWidth >= 1200 || newWindowWidth < 600) {
  1703.                                 windowWidth = newWindowWidth;
  1704.                                 reInitOwl();
  1705.                             }
  1706.                         } else if (windowWidth>=1200){
  1707.                             if (newWindowWidth < 1200) {
  1708.                                 windowWidth = newWindowWidth;
  1709.                                 reInitOwl();
  1710.                             }
  1711.                         } else if (windowWidth<600){
  1712.                             if (newWindowWidth>=600) {
  1713.                                 windowWidth = newWindowWidth;
  1714.                                 reInitOwl();
  1715.                             }
  1716.                         }
  1717.                     });
  1718.        
  1719.                 } catch(exception) {
  1720.                     console.log(exception);
  1721.                 }
  1722.             }
  1723.         });
  1724.     }
  1725.    
  1726.     lp_template.queue.lpGallery19 = function($self) {
  1727.        
  1728.         var $block = $self.hasClass('lp-gallery-19') ? $self : $self.find('.lp-gallery-19');
  1729.        
  1730.         $block.each(function(){
  1731.             if ($block.length) {
  1732.                 var $this = $(this),
  1733.                     $slider = $this.find('.js-gallery-items'),
  1734.                     autoplay = !!$slider.data('autoplay'),
  1735.                     infinite = !!$slider.data('infinite'),
  1736.                     nav = !!$slider.data('arrows'),
  1737.                     dotsEach = !!$slider.data('dots-each'),
  1738.                     dots = true,
  1739.                     pause = $slider.data('pause') || 5000,
  1740.                     speed = $slider.data('speed') || 250,
  1741.                     fade = !!$slider.data('fade'),
  1742.                     $parent = $slider.closest('[data-block-layout]'),
  1743.                     dataResponse = $slider.data('response'),
  1744.                     response = {},
  1745.                     $dots = $this.find('.lp-dots-wrapper');
  1746.                 try {
  1747.                     let owl = $this.find('.js-gallery-items.js-owl-carousel'),
  1748.                         windowWidth = $(window).width(),
  1749.                         gridFormer = function(){
  1750.                         let wrapper = '<div class="lp-gallery-19__slider-item"></div>',
  1751.                             itemsCount = $slider.children('.js-gallery-item').length,
  1752.                             sliceFunc = function(itemsInGrid){
  1753.                                 for (var i = 0; i < itemsCount/itemsInGrid; i++) {
  1754.                                     $slider.children('.js-gallery-item').slice(0, itemsInGrid).wrapAll(wrapper);
  1755.                                 }
  1756.                                 $slider.find('.lp-gallery-19__slider-item').each(function(){
  1757.                                     $(this).addClass('_'+$(this).children().length);
  1758.                                 });
  1759.                             };
  1760.        
  1761.                         if (windowWidth<600) {
  1762.                             sliceFunc(1);                  
  1763.                         } else if (windowWidth<1200) {
  1764.                             sliceFunc(4);
  1765.                         } else {
  1766.                             sliceFunc(4);
  1767.                         }
  1768.                     }
  1769.        
  1770.                     let initOwl = function(){
  1771.        
  1772.                         $slider.owlCarousel($.extend({
  1773.                             items : 1,
  1774.                             autoplay : autoplay,
  1775.                             loop : infinite,
  1776.                             rewind: true,
  1777.                             nav : nav,
  1778.                             dots : dots,
  1779.                             animateIn: fade ? 'fadeIn' : false,
  1780.                             animateOut: fade ? 'fadeOut' : false,
  1781.                             smartSpeed: speed,
  1782.                             autoplayTimeout: pause,
  1783.                             margin: 16,
  1784.                             onInitialized: function(e) {
  1785.                                 var $dotsCount = $this.find('.owl-dot').length;
  1786.                                
  1787.                                 if (!$dots.length || $dotsCount < 2) {
  1788.                                     $dots.html('');
  1789.                                     return;
  1790.                                 };
  1791.                                 var $dotsHTML = '';
  1792.                                
  1793.                                 for(var i = 0; i < $dotsCount; i++) {
  1794.                                     $dotsHTML += '<div class="lp-dots-item js-dot-item" data-elem-type="container" data-lp-selector=".lp-dots-item"></div>';
  1795.                                 }
  1796.                                
  1797.                                 if (!$dots.hasClass('_unchanged')) {
  1798.                                
  1799.                                     $dots.html($dotsHTML);
  1800.                                
  1801.                                 }
  1802.                                
  1803.                                 $dots.find('.lp-dots-item').eq(0).addClass('active');
  1804.                                
  1805.                             },
  1806.                            
  1807.                             onResized: function(e) {
  1808.                                 if (!$dots.length || e.page.count < 2) {
  1809.                                     $dots.html('');
  1810.                                     return;
  1811.                                 }
  1812.                                
  1813.                                 var $dotsHTML = '';
  1814.                                 for(var i = 0; i < e.page.count; i++) {
  1815.                                     $dotsHTML += '<div class="lp-dots-item js-dot-item" data-elem-type="container" data-lp-selector=".lp-dots-item"></div>';
  1816.                                 }
  1817.                                
  1818.                                 if (!$dots.hasClass('_unchanged')) {
  1819.                                     $dots.html($dotsHTML);
  1820.                                 }
  1821.                                 $dots.find('.lp-dots-item').removeClass('active');
  1822.                                 $dots.find('.lp-dots-item').eq(e.page.index).addClass('active');
  1823.                             },
  1824.                             onTranslated: function(e) {
  1825.                                 $dots.find('.lp-dots-item').removeClass('active');
  1826.                                 $dots.find('.lp-dots-item').eq(e.page.index).addClass('active');
  1827.                             }
  1828.                         }, response));
  1829.                         $this.find('.js-next-slide').off();
  1830.                         $this.find('.js-next-slide').on('click', function(e) {
  1831.                             e.preventDefault();
  1832.                             owl.trigger('next.owl.carousel');
  1833.                         });
  1834.                         $this.find('.js-prev-slide').off();
  1835.                         $this.find('.js-prev-slide').on('click', function(e) {
  1836.                             e.preventDefault();
  1837.                             owl.trigger('prev.owl.carousel');
  1838.                         });
  1839.        
  1840.                     }
  1841.        
  1842.                     let reInitOwl = function(){
  1843.                         owl.trigger('destroy.owl.carousel');
  1844.                         $this.find('.js-gallery-item').unwrap();
  1845.                         gridFormer();
  1846.                         initOwl();
  1847.                     }
  1848.        
  1849.                     gridFormer();
  1850.                    
  1851.                     initOwl();
  1852.        
  1853.                     $(window).resize(function(){                
  1854.                         let newWindowWidth = $(window).width();
  1855.                         if (windowWidth < 1200 && windowWidth >= 600) {                
  1856.                             if (newWindowWidth >= 1200 || newWindowWidth < 600) {
  1857.                                 windowWidth = newWindowWidth;
  1858.                                 reInitOwl();
  1859.                             }
  1860.                         } else if (windowWidth>=1200){
  1861.                             if (newWindowWidth < 1200) {
  1862.                                 windowWidth = newWindowWidth;
  1863.                                 reInitOwl();
  1864.                             }
  1865.                         } else if (windowWidth<600){
  1866.                             if (newWindowWidth>=600) {
  1867.                                 windowWidth = newWindowWidth;
  1868.                                 reInitOwl();
  1869.                             }
  1870.                         }
  1871.                     });
  1872.        
  1873.                 } catch(exception) {
  1874.                     console.log(exception);
  1875.                 }
  1876.             }
  1877.         });
  1878.     }
  1879.    
  1880.     lp_template.queue.lpGallery23 = function($self) {
  1881.         var $block = $('.lp-gallery-23');
  1882.         if ($block.length) {
  1883.             $block.each(function(){
  1884.                 var $this = $(this),
  1885.                     $thisCount = $this.hasClass('_3') ? 4 : 3,
  1886.                     $button = $this.find('.lp-gallery-23__button'),
  1887.                     openText = $this.find('.lp-gallery-23__button-in._open-text'),
  1888.                     closeText = $this.find('.lp-gallery-23__button-in._close-text'),
  1889.                     $hiddenElems;
  1890.                
  1891.                
  1892.                 try {
  1893.                     let itemMargin = 0,
  1894.                         itemHeight = 0,
  1895.                         containerHeight = 0,
  1896.                         checkHeight = function(){
  1897.                             itemMargin = parseInt($this.find('.lp-gallery-23-item').css('margin-bottom'), 10),
  1898.                             itemHeight = $this.find('.lp-gallery-23-item').height() + itemMargin,      
  1899.                             containerHeight = $this.find('.lp-gallery-23-items-wrapper').height()
  1900.                             $thisCount = $this.hasClass('_3') ? 4 : 3;
  1901.        
  1902.                             if ($(window).width()<600 && itemHeight < 590) {
  1903.                                 itemHeight *= 2;
  1904.                             }
  1905.                            
  1906.                             if  ($(window).width()<600) {
  1907.                                 $thisCount = 2;
  1908.                             }
  1909.                             else if ($(window).width()<960) {
  1910.                                 $thisCount = 3;
  1911.                             }
  1912.                            
  1913.                             $hiddenElems = $this.find('.lp-gallery-23-item:nth-child(n + ' + $thisCount + ')');
  1914.        
  1915.                             $this.find('.lp-gallery-23-items').css('max-height', itemHeight);
  1916.                             $this.find('.lp-gallery-23-item').show();
  1917.                             $hiddenElems.hide();
  1918.                         };
  1919.                        
  1920.                     checkHeight();
  1921.        
  1922.                     /*$(window).resize(function(){
  1923.                         $button.removeClass('_opened');
  1924.                         closeText.hide();
  1925.                         openText.show();
  1926.                         checkHeight();
  1927.                     });*/
  1928.                    
  1929.                     var win_width=$(window).width();
  1930.                     $(window).resize(function() {
  1931.                         var new_win_width=$(window).width();
  1932.                         if(new_win_width!=win_width) {      
  1933.                             $button.removeClass('_opened');
  1934.                             closeText.hide();
  1935.                             openText.show();
  1936.                             checkHeight();
  1937.                             win_width=new_win_width;
  1938.                         }
  1939.                     });
  1940.        
  1941.                     $button.on('click', function(e){
  1942.                         if ($(this).hasClass('_opened')) {
  1943.                             $this.find('.lp-gallery-23-items').animate({
  1944.                                 'max-height': itemHeight
  1945.                             }, 1000 );
  1946.                             closeText.hide();
  1947.                             openText.show();
  1948.                             $hiddenElems.fadeOut();
  1949.                         } else {
  1950.                             $this.find('.lp-gallery-23-items').animate({
  1951.                                 'max-height': 100000
  1952.                             }, 1000);
  1953.                             closeText.show();
  1954.                             openText.hide();
  1955.                             $hiddenElems.fadeIn();
  1956.                         }
  1957.                         $(this).toggleClass('_opened');
  1958.                     });
  1959.        
  1960.        
  1961.                 } catch(exception) {
  1962.                     console.log(exception);
  1963.                 }
  1964.            
  1965.             });
  1966.         }
  1967.     }
  1968.    
  1969.     lp_template.queue.lpGallery25 = function($self) {
  1970.         var $block = $('.lp-gallery-25');
  1971.         if ($block.length) {
  1972.             try {
  1973.                 let bgPos = function(){
  1974.                     if ($(window).width()<960) {
  1975.                         let headerHeight = $('.lp-gallery-25__title').outerHeight();
  1976.                         $('.lp-gallery-25 .lp-half-bg').css({
  1977.                                 top: headerHeight,
  1978.                                 left: 0,
  1979.                                 right: 0
  1980.                         });
  1981.                     } else {
  1982.                         let headerWidth = 0;
  1983.        
  1984.                         $('.lp-gallery-25 .lp-half-bg').css('top', 0);
  1985.                         if ($('.lp-gallery-25').hasClass('_reverse')) {
  1986.                             headerWidth = $('.lp-gallery-25__title').outerWidth() + $('.lp-gallery-25-items').offset().left;
  1987.                             $('.lp-gallery-25 .lp-half-bg').css({
  1988.                                     right: headerWidth,
  1989.                                     left: 0
  1990.                             });
  1991.                         } else {
  1992.                             headerWidth = $('.lp-gallery-25__title').outerWidth() + $('.lp-gallery-25__title').offset().left;
  1993.                             $('.lp-gallery-25 .lp-half-bg').css({
  1994.                                     right: 0,
  1995.                                     left: headerWidth
  1996.                             });
  1997.                         }
  1998.                     }
  1999.                 }
  2000.        
  2001.                 if ($('div').is(".lp-gallery-25__title")) {
  2002.                     if (s3LP.is_cms && !$('body').hasClass('preview_mode')) {
  2003.                         setTimeout(function(){
  2004.                             bgPos();
  2005.                         },500);
  2006.                     }
  2007.                    
  2008.                     $(window).resize(function(){
  2009.                         bgPos();
  2010.                     });
  2011.                 }
  2012.        
  2013.             } catch(exception) {
  2014.                 console.log(exception);
  2015.             }
  2016.         }
  2017.     }
  2018.    
  2019.     lp_template.queue.lpCertificate15 = function($self) {
  2020.        
  2021.         var $block = $self.hasClass('lp-certificate-15') ? $self : $self.find('.lp-certificate-15');
  2022.        
  2023.         $block.each(function(){
  2024.             if ($block.length) {
  2025.                 var $this = $(this),
  2026.                     $slider = $this.find('.js-gallery-items'),
  2027.                     autoplay = !!$slider.data('autoplay'),
  2028.                     infinite = !!$slider.data('infinite'),
  2029.                     nav = !!$slider.data('arrows'),
  2030.                     dotsEach = !!$slider.data('dots-each'),
  2031.                     dots = true,
  2032.                     pause = $slider.data('pause') || 5000,
  2033.                     speed = $slider.data('speed') || 250,
  2034.                     fade = !!$slider.data('fade'),
  2035.                     $parent = $slider.closest('[data-block-layout]'),
  2036.                     dataResponse = $slider.data('response'),
  2037.                     response = {},
  2038.                     $dots = $this.find('.lp-dots-wrapper');
  2039.                 try {
  2040.                     let owl = $this.find('.js-gallery-items'),
  2041.                         windowWidth = $(window).width(),
  2042.                         gridFormer = function(){
  2043.                         let wrapper = '<div class="lp-certificate-15__slider-item-wr"></div>',
  2044.                             itemsCount = $slider.children('.js-gallery-item').length,
  2045.                             sliceFunc = function(itemsInGrid){
  2046.                                 for (var i = 0; i < itemsCount/itemsInGrid; i++) {
  2047.                                     $slider.children('.js-gallery-item').slice(0, itemsInGrid).wrapAll(wrapper);
  2048.                                 }
  2049.                                 $slider.find('.lp-certificate-15-slider-item').each(function(){
  2050.                                     $(this).addClass('_'+$(this).children().length);
  2051.                                 });
  2052.                             };
  2053.        
  2054.                         if (windowWidth<600) {
  2055.                             sliceFunc(1);                  
  2056.                         } else if (windowWidth<1200) {
  2057.                             sliceFunc(2);
  2058.                         } else {
  2059.                             sliceFunc(2);
  2060.                         }
  2061.                     }
  2062.        
  2063.                     let initOwl = function(){
  2064.        
  2065.                         $slider.owlCarousel($.extend({
  2066.                             items : 1,
  2067.                             autoplay : autoplay,
  2068.                             loop : infinite,
  2069.                             rewind: true,
  2070.                             nav : nav,
  2071.                             dots : dots,
  2072.                             animateIn: fade ? 'fadeIn' : false,
  2073.                             animateOut: fade ? 'fadeOut' : false,
  2074.                             smartSpeed: speed,
  2075.                             autoplayTimeout: pause,
  2076.                             margin: 0,
  2077.                             onInitialized: function(e) {
  2078.                                 var $dotsCount = $this.find('.owl-dot').length;
  2079.                                
  2080.                                 if (!$dots.length || $dotsCount < 2) {
  2081.                                     $dots.html('');
  2082.                                     return;
  2083.                                 };
  2084.                                 var $dotsHTML = '';
  2085.                                
  2086.                                 for(var i = 0; i < $dotsCount; i++) {
  2087.                                     $dotsHTML += '<div class="lp-dots-item js-dot-item" data-elem-type="container" data-lp-selector=".lp-dots-item"></div>';
  2088.                                 }
  2089.                                
  2090.                                 if (!$dots.hasClass('_unchanged')) {
  2091.                                
  2092.                                     $dots.html($dotsHTML);
  2093.                                
  2094.                                 }
  2095.                                
  2096.                                 $dots.find('.lp-dots-item').eq(0).addClass('active');
  2097.                                
  2098.                             },
  2099.                            
  2100.                             onResized: function(e) {
  2101.                                 if (!$dots.length || e.page.count < 2) {
  2102.                                     $dots.html('');
  2103.                                     return;
  2104.                                 }
  2105.                                
  2106.                                 var $dotsHTML = '';
  2107.                                 for(var i = 0; i < e.page.count; i++) {
  2108.                                     $dotsHTML += '<div class="lp-dots-item js-dot-item" data-elem-type="container" data-lp-selector=".lp-dots-item"></div>';
  2109.                                 }
  2110.                                
  2111.                                 if (!$dots.hasClass('_unchanged')) {
  2112.                                     $dots.html($dotsHTML);
  2113.                                 }
  2114.                                 $dots.find('.lp-dots-item').removeClass('active');
  2115.                                 $dots.find('.lp-dots-item').eq(e.page.index).addClass('active');
  2116.                             },
  2117.                             onTranslated: function(e) {
  2118.                                 $dots.find('.lp-dots-item').removeClass('active');
  2119.                                 $dots.find('.lp-dots-item').eq(e.page.index).addClass('active');
  2120.                             }
  2121.                         }, response));
  2122.                         $this.find('.js-next-slide').off();
  2123.                         $this.find('.js-next-slide').on('click', function(e) {
  2124.                             e.preventDefault();
  2125.                             owl.trigger('next.owl.carousel');
  2126.                         });
  2127.                         $this.find('.js-prev-slide').off();
  2128.                         $this.find('.js-prev-slide').on('click', function(e) {
  2129.                             e.preventDefault();
  2130.                             owl.trigger('prev.owl.carousel');
  2131.                         });
  2132.        
  2133.                     }
  2134.        
  2135.                     let reInitOwl = function(){
  2136.                         owl.trigger('destroy.owl.carousel');
  2137.                         $this.find('.js-gallery-item').unwrap();
  2138.                         gridFormer();
  2139.                         initOwl();
  2140.                     }
  2141.        
  2142.                     gridFormer();
  2143.                    
  2144.                     initOwl();
  2145.        
  2146.                     $(window).resize(function(){                
  2147.                         let newWindowWidth = $(window).width();
  2148.                         if (windowWidth < 1200 && windowWidth >= 600) {                
  2149.                             if (newWindowWidth >= 1200 || newWindowWidth < 600) {
  2150.                                 windowWidth = newWindowWidth;
  2151.                                 reInitOwl();
  2152.                             }
  2153.                         } else if (windowWidth>=1200){
  2154.                             if (newWindowWidth < 1200) {
  2155.                                 windowWidth = newWindowWidth;
  2156.                                 reInitOwl();
  2157.                             }
  2158.                         } else if (windowWidth<600){
  2159.                             if (newWindowWidth>=600) {
  2160.                                 windowWidth = newWindowWidth;
  2161.                                 reInitOwl();
  2162.                             }
  2163.                         }
  2164.                     });
  2165.        
  2166.                 } catch(exception) {
  2167.                     console.log(exception);
  2168.                 }
  2169.             }
  2170.         });
  2171.     }
  2172.    
  2173.     lp_template.queue.lpPromo10 = function($self) {
  2174.         var $block = $self,
  2175.             $block_slider = $block.find('.js-promo10-slider');
  2176.        
  2177.         if ($block_slider.length) {
  2178.             $block_slider.each(function(){
  2179.                
  2180.                 var $this = $(this),
  2181.                     $parent = $this.closest('[data-block-layout]'),
  2182.                     $dots = $this.data('dots'),
  2183.                     $autoplay = $this.data('autoplay'),
  2184.                     $infinite = $this.data('infinite'),
  2185.                     $autoplaySpeed = $this.data('autoplay-speed'),
  2186.                     $speed = $this.data('speed');
  2187.                
  2188.                 $this.slick({
  2189.                     arrows: false,
  2190.                     dots: $dots,
  2191.                     infinite: $infinite,
  2192.                     fade: true,
  2193.                     speed: $speed,
  2194.                     slidesToShow: 1,
  2195.                     autoplay: $autoplay,
  2196.                     autoplaySpeed: $autoplaySpeed,
  2197.                     dotsClass:'lp-promo10__slider-dots',
  2198.                     appendDots:$this
  2199.                 });
  2200.             });
  2201.            
  2202.             $(window).on('resize', function(){
  2203.                 setTimeout(function(){
  2204.                     var $dotItem = $block.find('.lp-promo10__slider-dots li button');
  2205.                     if ($dotItem.hasClass('lp-promo10__slider-dot')) {
  2206.                        
  2207.                     }
  2208.                     else {
  2209.                         $dotItem.attr('data-elem-type', 'card_container');
  2210.                         $dotItem.addClass('lp-promo10__slider-dot');
  2211.                         $dotItem.attr('data-lp-selector','.lp-promo10__slider-dot');
  2212.                         $dotItem.attr('data-has-event','1');
  2213.                     }
  2214.                 },500);
  2215.             });
  2216.         }
  2217.     }
  2218.    
  2219.     lp_template.queue.lpPromo12 = function ($self) {
  2220.  
  2221.         var $block = $self,
  2222.             $slider = $self.find('.js-promo12-slider');
  2223.    
  2224.         if ($slider.length) {
  2225.             $slider.each(function(){
  2226.    
  2227.                 let $this = $(this);
  2228.                 let $parent = $this.closest('[data-block-layout]');
  2229.                
  2230.                 var $dots = $this.data('dots'),
  2231.                     $autoplay = $this.data('autoplay'),
  2232.                     $infinite = $this.data('infinite'),
  2233.                     $autoplaySpeed = $this.data('autoplay-speed'),
  2234.                     $speed = $this.data('speed');
  2235.    
  2236.                 $this.slick({
  2237.                     slidesToShow: 1,
  2238.                     slidesToScroll: 1,
  2239.                     fade: true,
  2240.                     infinite: $infinite,
  2241.                     dots: $dots,
  2242.                     autoplay: $autoplay,
  2243.                     autoplaySpeed: $autoplaySpeed,
  2244.                     speed: $speed,
  2245.                     dotsClass: 'lp-promo-12-slider__dots',
  2246.                     appendDots: $parent.find('.lp-promo-12-slider'),
  2247.                     prevArrow: $parent.find('.lp-promo-12-slider__arrow--left'),
  2248.                     nextArrow: $parent.find('.lp-promo-12-slider__arrow--right')
  2249.                 });
  2250.                
  2251.                 $(window).on('resize', function(){
  2252.                     setTimeout(function(){
  2253.                         var $dotItem = $block.find('.lp-promo-12-slider__dots li button');
  2254.                         if ($dotItem.hasClass('lp-promo-12-slider__dot')) {
  2255.                            
  2256.                         }
  2257.                         else {
  2258.                             $dotItem.attr('data-elem-type', 'card_container');
  2259.                             $dotItem.addClass('lp-promo-12-slider__dot');
  2260.                             $dotItem.attr('data-lp-selector','.lp-promo-12-slider__dot');
  2261.                             $dotItem.attr('data-has-event','1');
  2262.                         }
  2263.                     },100);
  2264.                 });
  2265.             });
  2266.         }
  2267.     }
  2268.    
  2269.     lp_template.queue.lpPromo17 = function ($self) {
  2270.  
  2271.         var $slider = $self.find('.js-promo-17-slider');
  2272.    
  2273.         if ($slider.length) {
  2274.             $slider.each(function(){
  2275.    
  2276.                 var $this = $(this);
  2277.                 var $parent = $this.closest('[data-block-layout]');
  2278.    
  2279.                 $this.slick({
  2280.                     infinite: true,
  2281.                     slidesToShow: 1,
  2282.                     slidesToScroll: 1,
  2283.                     fade: true,
  2284.                     dots:true,
  2285.                     dotsClass: 'lp-promo-17__dots',
  2286.                     appendDots: $parent.find('.lp-promo-17'),
  2287.                     prevArrow: $parent.find('.lp-promo-17__slider-arrow--left'),
  2288.                     nextArrow: $parent.find('.lp-promo-17__slider-arrow--right')
  2289.                 });
  2290.             });
  2291.         }
  2292.     }
  2293.    
  2294.     lp_template.queue.check_age = function($self) {
  2295.         $self.on('click', '.js-close-popup.lp-popup-block-3__button', function(e){
  2296.             e.preventDefault();
  2297.             var $parent = $(this).closest('[data-block-id]');
  2298.             createCookie('block_' + $parent.data('block-id'), 1, 30);
  2299.         });
  2300.  
  2301.         $self.on('click', '.js-little-age', function(e) {
  2302.             e.preventDefault();
  2303.             var $parent = $(this).closest('[data-block-id]');
  2304.  
  2305.             $parent.find('.lp-popup-block-3__confirm').hide();
  2306.             $parent.find('.lp-popup-block-3__alert').show();           
  2307.  
  2308.             createCookie('little_age', 1, 30);
  2309.         });
  2310.  
  2311.         function createCookie(name,value,days) {
  2312.             if (days) {
  2313.                 var date = new Date();
  2314.                 date.setTime(date.getTime()+(days*24*60*60*1000));
  2315.                 var expires = "; expires="+date.toGMTString();
  2316.             }
  2317.             else var expires = "";
  2318.             document.cookie = name+"="+encodeURIComponent(value)+expires+"; path=/";
  2319.         }
  2320.     }
  2321.    
  2322.     lp_template.queue.certificates8 = function($self) {
  2323.  
  2324.         var $block = $self.hasClass('lp-certificate-8') ? $self : $self.find('.lp-certificate-8');
  2325.        
  2326.         $block.each(function(){
  2327.             var $this = $(this),
  2328.                 $imageSlider = $this.find('.js-image-slider'),
  2329.                 $textSlider = $this.find('.js-text-slider'),
  2330.                 $sliderArrows = $this.find('.js-slider-arrows'),
  2331.                 $autoplay = $imageSlider.data('autoplay'),
  2332.                 $pause = $imageSlider.data('pause'),
  2333.                 $speed = $imageSlider.data('speed'),
  2334.                 $dots = $imageSlider.data('dots'),
  2335.                 $infinite = !!$imageSlider.data('infinite');
  2336.        
  2337.             if ($('.lp-certificate-8__content').length) {
  2338.                 if ($imageSlider.find('.js-image-slider-item').length > 3) {
  2339.                     $imageSlider.slick({
  2340.                         asNavFor: $textSlider,
  2341.                         prevArrow: $this.find('.js-prev-slide'),
  2342.                         nextArrow: $this.find('.js-next-slide'),
  2343.                         mobileFirst: true,
  2344.                         slidesToScroll: 1,
  2345.                         slidesToShow: 1,
  2346.                         centerMode: true,
  2347.                         centerPadding: '0',
  2348.                         focusOnSelect: false,
  2349.                         autoplay: $autoplay,
  2350.                         autoplaySpeed: $pause,
  2351.                         speed: $speed,
  2352.                         infinite: $infinite,
  2353.                         dots: $dots,
  2354.                         dotsClass:'lp-certificate-8-slider__dots',
  2355.                         appendDots:$('.lp-certificate-8__dots-block'),
  2356.                         responsive: [{
  2357.                             breakpoint: 960,
  2358.                             settings: {
  2359.                                 centerMode: true,
  2360.                                 slidesToShow: 3
  2361.                             }
  2362.                         }]
  2363.                     });
  2364.                 } else {
  2365.                     $sliderArrows.hide();
  2366.                     $imageSlider.css('display', 'flex');
  2367.                 }
  2368.                
  2369.                
  2370.                 $(window).on('resize', function(){
  2371.                     setTimeout(function(){
  2372.                         var $dotItem = $this.find('.lp-certificate-8-slider__dots li button');
  2373.                         if ($dotItem.hasClass('lp-certificate-8-slider__dot')) {
  2374.                            
  2375.                         }
  2376.                         else {
  2377.                             $dotItem.attr('data-elem-type', 'card_container');
  2378.                             $dotItem.addClass('lp-certificate-8-slider__dot');
  2379.                             $dotItem.attr('data-lp-selector','.lp-certificate-8-slider__dot');
  2380.                         }
  2381.                     },100);
  2382.                 });
  2383.        
  2384.                 $textSlider.slick({
  2385.                     slidesToShow: 1,
  2386.                     slidesToScroll: 1,
  2387.                     fade: true,
  2388.                     autoplay: $autoplay,
  2389.                     autoplaySpeed: $pause,
  2390.                     speed: $speed,
  2391.                     infinite: $infinite,
  2392.                     arrows: false,
  2393.                     selector: '.js-text-slider-item',
  2394.                     mobileFirst: true,
  2395.                     asNavFor: $imageSlider,
  2396.                     accessibility: false
  2397.                 });
  2398.                
  2399.                 $this.find('.js-lg-init').lightGallery({
  2400.                     selector: '.lg-item',
  2401.                     toogleThumb: false,
  2402.                     getCaptionFromTitleOrAlt: false,
  2403.                     download: false,
  2404.                     thumbWidth: 64,
  2405.                     thumbHeight: '64px',
  2406.                     nextHtml: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.98528 4.32805C9.3758 3.93753 10.009 3.93753 10.3995 4.32805L17.0563 10.9849C17.4469 11.3754 17.4469 12.0086 17.0563 12.3991L10.3995 19.056C10.009 19.4465 9.3758 19.4465 8.98528 19.056C8.59475 18.6654 8.59475 18.0323 8.98528 17.6418L14.935 11.692L8.98528 5.74226C8.59475 5.35174 8.59475 4.71857 8.98528 4.32805Z" fill="white"/></svg>',
  2407.                     prevHtml: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14.8492 5.03516L8.19239 11.692L14.8492 18.3489" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>'
  2408.                 });
  2409.             }
  2410.         });
  2411.     }
  2412.    
  2413.     lp_template.queue.menuSimplePopup = function($self) {
  2414.        
  2415.         var $block = $self.hasClass('js-menu-wrap') ? $self : $self.find('.js-menu-wrap');
  2416.        
  2417.         $block.each(function(){
  2418.             var $this = $(this),
  2419.                 $topMenuWrap = $this.find('.js-menu__wrap'),
  2420.                 $menu = $this.find('.js-menu_appedable'),
  2421.                 $burger = $this.find('.js-burger'),
  2422.                 $popup = $this.find('.js-popup'),
  2423.                 popupHeight = $(window).height() - $this.height(),
  2424.                 menuHeight = $this.outerHeight(),
  2425.                 popupTop = menuHeight < 0 ? 0 : menuHeight,
  2426.                 popupTop = s3LP.is_cms ? popupTop + 72 : popupTop,
  2427.                 $bgTop = $this.height() + 50 < 0 ? 0 : $this.height() + 50,
  2428.                 $bgTop = s3LP.is_cms ? $bgTop + 72 : $bgTop,
  2429.                 $liHaschild = $this.find('.haschild');
  2430.            
  2431.             $this.find('.lp-menu-block-bg').animate({top: $bgTop}, 400);
  2432.            
  2433.             $popup.css('top', popupTop);
  2434.                
  2435.             $menu.clone().prependTo($topMenuWrap);
  2436.            
  2437.             $(this).append('<div class="lp-menu-block-bg"></div>');
  2438.            
  2439.             function menuShow() {
  2440.                 var $ulWidth = 0,
  2441.                     $ulWrapWidth = $this.find('.js-menu__wrap').width();
  2442.        
  2443.                 $($menu).children('li').each(function(){
  2444.                     var $width = $(this).children('a').outerWidth(true);
  2445.                     $ulWidth += $width;
  2446.                 });
  2447.                 if (window.matchMedia('(min-width : 960px)').matches) {
  2448.                     if ($ulWidth < $ulWrapWidth) {
  2449.                         $this.find('.js-menu__wrap').addClass('show');
  2450.                         $this.find('.js-burger').hide();
  2451.                     }
  2452.                     else {
  2453.                         $this.find('.js-menu__wrap').removeClass('show');
  2454.                         $this.find('.js-burger').show();
  2455.                     }
  2456.                 }
  2457.                 else if (window.matchMedia('(max-width : 959px)').matches) {
  2458.                     $this.find('.js-menu__wrap').removeClass('show');
  2459.                     $this.find('.js-burger').show();
  2460.                 }
  2461.                
  2462.                 var $bgTop = $this.offset().top + $this.height();
  2463.                
  2464.                 menuHeight = $this.outerHeight(),
  2465.                 popupTop = menuHeight < 0 ? 0 : menuHeight,
  2466.                 popupTop = s3LP.is_cms ? popupTop + 72 : popupTop,
  2467.                 $bgTop = $this.height() < 0 ? 0 : $this.height(),
  2468.                 $bgTop = s3LP.is_cms ? $bgTop + 72 : $bgTop;
  2469.                
  2470.                 $this.find('.lp-menu-block-bg').animate({top: $bgTop}, 400);
  2471.                
  2472.                 $popup.css('top', popupTop);
  2473.                
  2474.                 $this.find('.lp-menu-block-bg').css('top', $bgTop);
  2475.             }
  2476.            
  2477.             $(window).on('resize', function(){
  2478.                
  2479.                 setTimeout(function(){
  2480.                     menuShow();
  2481.                 },500);
  2482.                
  2483.             }).trigger('resize');
  2484.        
  2485.             $burger.on('click', function(){
  2486.                 $menu.find('li a').addClass('menu-popup-item-custom');
  2487.                 if ($(this).hasClass('_in-side')) {
  2488.                     $popup.animate({top: 0}, 400);
  2489.                     $this.find('.lp-menu-block-bg').css('top', 0);
  2490.                 }
  2491.                 if (!$(this).hasClass('_in-side')) {
  2492.                     if (s3LP.is_cms) {
  2493.                         $('html, body').animate({
  2494.                             scrollTop: $this.offset().top - 72
  2495.                         }, 100);
  2496.                     }
  2497.                     else {
  2498.                         $('html, body').animate({
  2499.                             scrollTop: $this.offset().top
  2500.                         }, 100);
  2501.                     }
  2502.                 }
  2503.                
  2504.                 $popup.find('.js-popup__inner').css({
  2505.                     'overflow' : 'auto',
  2506.                     'max-height' : '100%'
  2507.                 });
  2508.                
  2509.                 $burger.toggleClass('opened');
  2510.                 if ($popup.hasClass('opened')) {
  2511.                     $popup.animate({height: "0%"}, {duration: 800, complete: function() {$this.css('z-index', '')}}).removeClass('opened');
  2512.                     $this.find('.lp-menu-block-bg').fadeOut(600);
  2513.                    
  2514.                     $('html').css('overflow', '');
  2515.                 }
  2516.                 else {
  2517.                     $popup.animate({height: popupHeight}, {duration: 800}).addClass('opened');
  2518.                     $this.find('.lp-menu-block-bg').fadeIn(600);
  2519.                     $this.css('z-index', '999')
  2520.                     $('html').css('overflow', 'hidden');
  2521.                 }
  2522.             });
  2523.            
  2524.             $this.find('.haschild').on('click', function(e){
  2525.                 e.stopPropagation();
  2526.                 $(this).toggleClass('_open').children('ul').slideToggle();
  2527.             });
  2528.            
  2529.             $popup.find('.js-menu_appedable').on('click', 'a', function(){
  2530.                 $burger.toggleClass('opened');
  2531.                 $popup.animate({height: "0%"}, 800).removeClass('opened');
  2532.                 $this.find('.lp-menu-block-bg').fadeOut(600);
  2533.                 $this.css('z-index', '');
  2534.                 $('html').css('overflow', '');
  2535.             });
  2536.            
  2537.             if (s3LP.is_cms) {
  2538.                 setTimeout(function(){
  2539.                     LpController.afterSave(function () {
  2540.                         menuShow();
  2541.                         setTimeout(function(){
  2542.                             $(window).trigger('resize');
  2543.                         },500);
  2544.                     });
  2545.                 },2000);
  2546.             }
  2547.         });
  2548.     }
  2549.    
  2550.     lp_template.queue.productsTabs10 = function($self) {
  2551.         let $tabsBlock = $self.find('.js-prods10');
  2552.    
  2553.         if ($tabsBlock.length) {
  2554.             $tabsBlock.each(function(){
  2555.    
  2556.                 let $this = $(this),
  2557.                     $tabItem = $this.find('.js-tab-item'),
  2558.                     $tabContent = $this.find('.js-content'),
  2559.                     $firstTabItem = $tabItem.first(),
  2560.                     $firstTabContent = $tabContent.first(),
  2561.    
  2562.                 activeFirstTab = function(){
  2563.                     $firstTabItem.addClass('_active');
  2564.                     $firstTabContent.addClass('_active');
  2565.                 }
  2566.    
  2567.                 activeFirstTab();
  2568.    
  2569.    
  2570.                 $tabItem.on('click', function() {
  2571.                     $(this).addClass('_active').siblings().removeClass('_active');
  2572.                     $tabContent.removeClass('_active').eq($(this).index()).addClass('_active');
  2573.                 });
  2574.             })
  2575.         }
  2576.     }
  2577.    
  2578.     lp_template.queue.setPropsForCircled = function($self) {
  2579.         var $block = $self.find('.circled_container');
  2580.        
  2581.         var resizedFunction = function() {
  2582.             $block.each(function(){
  2583.                 var $this = $(this);
  2584.                
  2585.                 $this.css({
  2586.                     'width' : '',
  2587.                     'height' : ''
  2588.                 });
  2589.                
  2590.                 var $thisHeight = $this.height(),
  2591.                     $thisWidth = $this.width(),
  2592.                     maxValue = $thisHeight > $thisWidth ? $thisHeight : $thisWidth;
  2593.                
  2594.                 setTimeout(function(){
  2595.                     $this.css({
  2596.                         'width' : maxValue,
  2597.                         'height' : maxValue
  2598.                     });
  2599.                 },1000);
  2600.             });
  2601.         }
  2602.        
  2603.         $(window).on('resize', resizedFunction);
  2604.         if (s3LP.is_cms) {
  2605.             setTimeout(function(){
  2606.                 LpController.afterSave(function () {
  2607.                     resizedFunction();
  2608.                 });
  2609.             },1000);
  2610.         }
  2611.     }
  2612.    
  2613.     lp_template.queue.equalHeight = function($self) {
  2614.         var $block = $self.find('.equal-height');
  2615.        
  2616.         var resizedFunction = function() {
  2617.             $block.each(function(){
  2618.                 var $this = $(this);
  2619.                
  2620.                 $this.css({
  2621.                     'height' : ''
  2622.                 });
  2623.                
  2624.                 var $thisWidth = $this.width(),
  2625.                     maxValue = $thisWidth;
  2626.                
  2627.                 setTimeout(function(){
  2628.                     $this.css({
  2629.                         'height' : maxValue
  2630.                     });
  2631.                 },1000);
  2632.             });
  2633.         }
  2634.        
  2635.         $(window).on('resize', resizedFunction);
  2636.         if (s3LP.is_cms) {
  2637.             setTimeout(function(){
  2638.                 LpController.afterSave(function () {
  2639.                     resizedFunction();
  2640.                 });
  2641.             },1000);
  2642.         }
  2643.     }
  2644.    
  2645.     lp_template.queue.steps17 = function($self) {
  2646.         var $block = $self.hasClass('lp-steps-17') ? $self : $self.find('.lp-steps-17');
  2647.         $block.each(function(){
  2648.             if ($(this).length) {
  2649.                 $(this).find('.js-counter-btn').on('click', function(){
  2650.                     var $this = $(this),
  2651.                         $thisIndex = $this.index(),
  2652.                         $item = $this.parents('.lp-steps-17').find('.js-slider-item').eq($thisIndex);
  2653.                     if (!$this.hasClass('_active')) $this.addClass('_active').siblings().removeClass('_active');
  2654.                     if (!$item.hasClass('_active')) $($item).fadeIn().addClass('_active').css('display', 'flex').siblings().hide().removeClass('_active');
  2655.                 });
  2656.             }
  2657.         });
  2658.     }
  2659.    
  2660.     lp_template.queue.qa13 = function($self) {
  2661.         var $block = $self.hasClass('lp-qa-13') ? $self : $self.find('.lp-qa-13');
  2662.         if ($block.length)  {
  2663.             $block.each(function(){
  2664.                 var $this = $(this);
  2665.                 try {
  2666.                     let colWrapper = '<div class="lp-qa-13-items-col"></div>',
  2667.                         windowWidth = $(window).width(),
  2668.                         evenElems = $this.find('.lp-qa-13-item:nth-child(even)');
  2669.            
  2670.                    
  2671.                     $this.find('.lp-qa-13-item').each(function(index, element){
  2672.                         $(this).css('order', index+1);
  2673.                         evenElems.addClass('_even');
  2674.                     });
  2675.                    
  2676.                     let splitInCols = function() {
  2677.                         if (windowWidth >= 960) {
  2678.                         /*  $this.find('.lp-qa-13-items > .lp-qa-13-item:odd').wrapAll(colWrapper);
  2679.                             $this.find('.lp-qa-13-items > .lp-qa-13-item').wrapAll(colWrapper);*/
  2680.                            
  2681.                             $this.find('.lp-qa-13-item._even').prependTo($this.find('.lp-qa-13-items-col').last());
  2682.                         }
  2683.                     }
  2684.            
  2685.                     let setItemHeight = function(windowWidth) {
  2686.                         if (windowWidth >= 960) {
  2687.                             $this.find('.lp-qa-13-items-col').first().children('.lp-qa-13-item').each(function(index, element){
  2688.                                    
  2689.                                 let firstColItem = $(this).children('.lp-qa-13-item-title-wrapper'),
  2690.                                     secColItem = $this.find('.lp-qa-13-items-col').last().children('.lp-qa-13-item').eq(index).children('.lp-qa-13-item-title-wrapper');
  2691.                                 if (firstColItem.height()<secColItem.height()) {
  2692.                                     firstColItem.css('min-height', secColItem.height());   
  2693.                                 } else {
  2694.                                     secColItem.css('min-height', firstColItem.height());
  2695.                                 }  
  2696.                             });
  2697.                         } else {
  2698.                             $this.find('.lp-qa-13-item-title-wrapper').css('min-height', '');
  2699.                         }
  2700.                     }
  2701.                     splitInCols();
  2702.                     setItemHeight(windowWidth);
  2703.                     $(window).resize(function(){
  2704.                         let newWindowWidth = $(window).width();
  2705.                         if (windowWidth>=960){
  2706.                             if (newWindowWidth < 960) {
  2707.                                 windowWidth = newWindowWidth;
  2708.                                 //$this.find('.lp-qa-13-item').unwrap();
  2709.                                 $this.find('.lp-qa-13-items-col').last().find('.lp-qa-13-item._even').appendTo($this.find('.lp-qa-13-items-col').first());
  2710.                             }
  2711.                         } else if (windowWidth<960){
  2712.                             if (newWindowWidth>=960) {
  2713.                                 windowWidth = newWindowWidth;
  2714.                                 splitInCols();
  2715.                             }
  2716.                         }
  2717.                         setItemHeight(newWindowWidth);
  2718.                     });
  2719.            
  2720.                 } catch(e) {
  2721.                     console.log(e);
  2722.                 }
  2723.             });
  2724.         }
  2725.     }
  2726.    
  2727.     lp_template.queue.header11 = function($self) {
  2728.         var $block = $self.hasClass('has-one-line-menu') ? $self : $self.find('.has-one-line-menu');
  2729.         if ($block.length) {
  2730.             $block.each(function(){
  2731.                 var $this = $(this),
  2732.                     $menu = $this.find('.js-nav-menu'),
  2733.                     $menuControls = !!$this.data('menu-controls') ? $this.data('menu-controls') : 'border, indents, shadow, background',
  2734.                     $dots = $this.find('.js-nav-menu-dots'),
  2735.                     $navMenu = $this.find('.js-menu-wrap .js-nav-menu'),
  2736.                     $lastLi = $this.find('.js-hidden-nav-menu'),
  2737.                     $burger = $this.find('.js-side-menu-open-btn'),
  2738.                     $sideMenu = $this.find('.js-side-menu');
  2739.                    
  2740.                 function oneLineMenu() {
  2741.                     $navMenu.oneLineMenu({
  2742.                         minWidth  : 599,
  2743.                         lastClass : 'lp-header-hidden-nav js-hidden-nav-menu',
  2744.                         left: -25,
  2745.                         kebabHtml: '<div class="lp-header-dots js-nav-menu-dots" data-has-event="1" data-elem-type="container" data-lp-selector=".lp-header-dots"><div class="lp-header-dots-in" data-lp-selector=".circle" data-elem-type="container"><div class="circle"></div><div class="circle"></div><div class="circle"></div></div></div>'
  2746.                     });
  2747.                    
  2748.                     $(window).on('resize', function(){
  2749.                         $dots = $this.find('.js-nav-menu-dots'),
  2750.                         $lastLi = $this.find('.js-hidden-nav-menu');
  2751.                         $dots.on('click', function(){
  2752.                             $this.find('.js-hidden-nav-menu > ul').toggleClass('_open');
  2753.                         });
  2754.                        
  2755.                         $lastLi.find('a').on('click', function(){
  2756.                             $this.find('.js-hidden-nav-menu > ul').toggleClass('_open');
  2757.                         });
  2758.                        
  2759.                         $this.find('.js-hidden-nav-menu > ul').attr('data-elem-type', 'generate').attr('data-lp-controls-list', $menuControls).addClass('lp-menu-19-inner').attr('data-lp-selector', '.lp-menu-19-inner');
  2760.                         $this.find('.lp-block-bg .lp-block-overlay').clone().prependTo($this.find('.js-hidden-nav-menu > ul'));
  2761.                     }).trigger('resize');
  2762.                    
  2763.                     $burger.on('click', function(){
  2764.                         $sideMenu.toggleClass('_open');
  2765.                         $this.find('._overlay').toggleClass('_open');
  2766.                         $this.toggleClass('_opened');
  2767.                         $burger.toggleClass('is-active');
  2768.                         $('body').toggleClass('overflow');
  2769.                     });
  2770.                    
  2771.                     $sideMenu.on('click', 'a', function(){
  2772.                         $sideMenu.toggleClass('_open');
  2773.                         $this.find('._overlay').toggleClass('_open');
  2774.                         $this.toggleClass('_opened');
  2775.                         $burger.toggleClass('is-active');
  2776.                         $('body').toggleClass('overflow');
  2777.                     });
  2778.                 }
  2779.                
  2780.                 oneLineMenu();
  2781.                
  2782.                 if (s3LP.is_cms) {
  2783.                     setTimeout(function(){
  2784.                         LpController.afterSave(function () {
  2785.                             $navMenu.destroy();
  2786.                             oneLineMenu();
  2787.                         });
  2788.                     },1000);
  2789.                 }
  2790.             });
  2791.         }
  2792.     }
  2793.    
  2794.     lp_template.queue.steps14 = function($self) {
  2795.        
  2796.         var $block = $self.hasClass('lp-steps-14') ? $self : $self.find('.lp-steps-14');
  2797.        
  2798.         if ($block.length) {
  2799.             $block.each(function(){
  2800.                 var $this = $(this);
  2801.                 try {
  2802.                     var wrapRows = function wrapRows() {
  2803.                         var itemsCount = $this.find('.lp-steps-14-content>.lp-steps-14-item').length
  2804.                           , sliceFunc = function sliceFunc(itemsInRow) {
  2805.                             for (var i = 0; i < itemsCount / itemsInRow; i++) {
  2806.                                 $this.find('.lp-steps-14-content>.lp-steps-14-item').slice(0, itemsInRow).wrapAll(wrapper);
  2807.                             }
  2808.                         };
  2809.        
  2810.                         if (windowWidth < 600) {} else if (windowWidth < 960) {
  2811.                             sliceFunc(2);
  2812.                         } else if (windowWidth < 1200) {
  2813.                             sliceFunc(3);
  2814.                         } else {
  2815.                             sliceFunc(itemsInRow);
  2816.                         }
  2817.                     };
  2818.        
  2819.                     var windowWidth = $(window).width()
  2820.                       , wrapper = '<div class="lp-steps-14-row"></div>'
  2821.                       , itemsInRow = $this.find('.lp-steps-14-content').attr('data-count');
  2822.                     wrapRows();
  2823.                     $(window).resize(function() {
  2824.                         var newWindowWidth = $(window).width();
  2825.        
  2826.                         if (windowWidth < 960 && windowWidth >= 600) {
  2827.                             if (newWindowWidth >= 960 || newWindowWidth < 600) {
  2828.                                 windowWidth = newWindowWidth;
  2829.                                 $this.find('.lp-steps-14-row>.lp-steps-14-item').unwrap();
  2830.                                 wrapRows();
  2831.                             }
  2832.                         } else if (windowWidth < 1200 && windowWidth >= 960) {
  2833.                             if (newWindowWidth >= 1200 || newWindowWidth < 960) {
  2834.                                 windowWidth = newWindowWidth;
  2835.                                 $this.find('.lp-steps-14-row>.lp-steps-14-item').unwrap();
  2836.                                 wrapRows();
  2837.                             }
  2838.                         } else if (windowWidth >= 1200) {
  2839.                             if (newWindowWidth < 1200) {
  2840.                                 windowWidth = newWindowWidth;
  2841.                                 $this.find('.lp-steps-14-row>.lp-steps-14-item').unwrap();
  2842.                                 wrapRows();
  2843.                             }
  2844.                         } else if (windowWidth < 600) {
  2845.                             if (newWindowWidth >= 600) {
  2846.                                 windowWidth = newWindowWidth;
  2847.                                 $this.find('.lp-steps-14-row>.lp-steps-14-item').unwrap();
  2848.                                 wrapRows();
  2849.                             }
  2850.                         }
  2851.                        
  2852.                        
  2853.                             if (window.matchMedia('(min-width : 600px)').matches) {
  2854.                                 var $circle = $this.find('.lp-steps-14-item__counter'),
  2855.                                     $circleHeight = $circle.outerHeight() / 2,
  2856.                                     $lastItem = $this.find('.lp-steps-14-item:not(:last-child)'),
  2857.                                     $arrow = $lastItem.find('.lp-steps-14-item__arrow');
  2858.                                    
  2859.                                 $('.lp-steps-14-item__arrow').css('top', '');
  2860.                                 $arrow.css('top', $circleHeight);
  2861.                             }
  2862.                            
  2863.                             else {
  2864.                                 $('.lp-steps-14-item__arrow').css('top', '');
  2865.                             }
  2866.                        
  2867.                        
  2868.                        
  2869.                     });
  2870.                 } catch (e) {
  2871.                     console.log(e);
  2872.                 }
  2873.             });
  2874.         }
  2875.     }
  2876.    
  2877.     lp_template.queue.features28 = function($self) {
  2878.         var $block = $self.hasClass('lp-features-28') ? $self : $self.find('.lp-features-28');
  2879.  
  2880.         if ($block.length) {
  2881.  
  2882.             $block.each(function() {
  2883.                 var $this = $(this),
  2884.                     pie28 = '';
  2885.                
  2886.                 function donutInit() {
  2887.                     console.log(listData);
  2888.                     var listData = new Array(),
  2889.                         listColor = new Array(),
  2890.                         $pie = '.lp-features-28-pie';
  2891.                        
  2892.                     $this.find('.lp-features-28-item').each(function(index, element){
  2893.                         let itemValue = parseInt($(this).find('.lp-features-28-item__text').text()),
  2894.                             itemText = $(this).find('.lp-features-28-item__text').text();
  2895.                            
  2896.                         listColor.push($(this).find('.lp-features-28-item__color').css('background-color')),
  2897.                         listData.push([itemText, itemValue]);
  2898.                     });
  2899.            
  2900.                     pie28 = $.jqplot($pie, [listData], {
  2901.                         seriesDefaults: {
  2902.                             renderer:$.jqplot.DonutRenderer,
  2903.                             rendererOptions:{
  2904.                                 padding: 0,
  2905.                                 shadowOffset: 0,
  2906.                                 sliceMargin: 0,
  2907.                                 startAngle: 180,
  2908.                                 showDataLabels: true,
  2909.                                 dataLabels: 'label',
  2910.                                 totalLabel: false,
  2911.                                 seriesColors: listColor,
  2912.                                 borderWidth: 0.0
  2913.                             }
  2914.                         },
  2915.                         grid: {
  2916.                             borderWidth: 0.0,
  2917.                             shadow: false,
  2918.                             background: '#ffffff',
  2919.                             backgroundColor: 'rgba(255, 255, 255, 0)'
  2920.                            
  2921.                         }
  2922.                     });
  2923.        
  2924.                     $this.find('.lp-features-28-pie .jqplot-data-label').addClass('lp-header-title-6 lp-features-28-item__text').attr('data-elem-type', 'text');
  2925.                     $this.find('.lp-features-28-pie .jqplot-data-label').attr('data-lp-selecttor', '.lp-features-28-item__text');
  2926.                 }
  2927.                
  2928.                 donutInit();
  2929.                
  2930.                 if (s3LP.is_cms) {
  2931.                     setTimeout(function(){
  2932.                         LpController.afterSave(function () {
  2933.                            
  2934.                             pie28.destroy();
  2935.                             setTimeout(function(){
  2936.                                 donutInit();
  2937.                             },1000);
  2938.                            
  2939.                         });
  2940.                     },1000);
  2941.                 }
  2942.                
  2943.                 $(window).resize(function(){
  2944.                     if (window.matchMedia('(max-width : 600px)').matches) {
  2945.                         pie28.destroy();
  2946.                         donutInit();
  2947.                     }
  2948.                     else {
  2949.                         pie28.destroy();
  2950.                         donutInit();
  2951.                     }
  2952.                 });
  2953.                
  2954.             });
  2955.         }      
  2956.     };
  2957.    
  2958.     lp_template.queue.features31 = function($self) {
  2959.         var $block = $self.hasClass('lp-features-31') ? $self : $self.find('.lp-features-31');
  2960.  
  2961.         if ($block.length) {
  2962.  
  2963.             $block.each(function() {
  2964.                 var $this = $(this);
  2965.                    
  2966.                 $this.find('.lp-features-31-item').each(function(index, element){
  2967.                     var listData = new Array(),
  2968.                         listColor = new Array(),
  2969.                         $pie = '#' + $this.find('.lp-features-31-pie').eq(index).attr('id'),
  2970.                         $innerDiameter = 250;
  2971.                    
  2972.                     let itemValue = parseInt($(this).find('.lp-features-31-item__title').attr('data-value')),
  2973.                         itemValueHidden = parseInt($(this).find('.lp-features-31-item__title._hidden').attr('data-value')),
  2974.                         itemText = $(this).find('.lp-features-31-item__text').text(),
  2975.                         itemTextHidden = $(this).find('.lp-features-31-item__title._hidden + .lp-features-31-item__text').text();
  2976.                         listColor.push($(this).find('.lp-features-31-item__color._active-color').css('background-color'));
  2977.                         listColor.push($(this).find('.lp-features-31-item__color._disabled-color').css('background-color'));
  2978.                         listData.push([itemTextHidden, itemValueHidden]);
  2979.                         listData.push([itemText, itemValue]);
  2980.                    
  2981.                     $(window).on('resize', function(){
  2982.                        
  2983.                         if (window.matchMedia('(min-width : 1380px)').matches) {
  2984.                             $innerDiameter = 222;
  2985.                         } else if (window.matchMedia('(min-width : 1200px)').matches) {
  2986.                             $innerDiameter = 224;
  2987.                         } else if (window.matchMedia('(min-width : 960px)').matches) {
  2988.                             $innerDiameter = 228;
  2989.                         } else if (window.matchMedia('(min-width : 600px)').matches) {
  2990.                             $innerDiameter = 241;
  2991.                         }
  2992.                        
  2993.                         if(!$('.lp-features-31-pie').eq(index).is(':empty')) {
  2994.                             $('.lp-features-31-pie').html('');
  2995.                         }
  2996.                        
  2997.                         var pie31 = $.jqplot($pie, [listData], {
  2998.                             seriesDefaults: {
  2999.                                 renderer:$.jqplot.DonutRenderer,
  3000.                                 rendererOptions:{
  3001.                                     padding: 0,
  3002.                                     shadowOffset: 0,
  3003.                                     innerDiameter: $innerDiameter,
  3004.                                     sliceMargin: 0,
  3005.                                     startAngle: -90,
  3006.                                     showDataLabels: true,
  3007.                                     dataLabels: 'label',
  3008.                                     totalLabel: false,
  3009.                                     seriesColors: listColor,
  3010.                                     borderWidth: 0.0
  3011.                                 }
  3012.                             },
  3013.                             grid: {
  3014.                                 borderWidth: 0.0,
  3015.                                 shadow: false,
  3016.                                 background: 'rgba(255, 255, 255, 0)'
  3017.                             }
  3018.                         });
  3019.                        
  3020.                         $this.find('.lp-features-31-pie .jqplot-data-label').addClass('lp-header-title-1 lp-features-31-item__text').attr('data-elem-type','text').attr('data-lp-selector','.lp-features-31-item__text');
  3021.                     }).trigger('resize');
  3022.                    
  3023.                 });
  3024.        
  3025.             });
  3026.         }      
  3027.     };
  3028.    
  3029.  
  3030.     lp_template.queue.sertificate5 = function($self) {
  3031.         var $block = $self.hasClass('lp-certificate-5') ? $self : $self.find('.lp-certificate-5');
  3032.  
  3033.         if ($block.length) {
  3034.  
  3035.             $block.each(function() {
  3036.                 var $this = $(this);
  3037.                    
  3038.                 function isotopeinit () {  
  3039.                     var $mansoryItem = $this.find('.js-main-item'),
  3040.                         $isotope = $this.find('.js-isotope');
  3041.                    
  3042.                     setTimeout(function(){
  3043.                         $isotope.isotope({
  3044.                             itemSelector: '.js-isotope-item',
  3045.                             originLeft: true
  3046.                         });
  3047.                     }, 0.100);
  3048.                 }
  3049.                 isotopeinit();
  3050.            
  3051.                 if (s3LP.is_cms) {
  3052.                     setTimeout(function(){
  3053.                         LpController.afterSave(function () {
  3054.                             isotopeinit();
  3055.                         });
  3056.                     },1000);
  3057.                 }
  3058.             });
  3059.         }      
  3060.     };
  3061.    
  3062.    
  3063.     lp_template.queue.sertificate9 = function($self) {
  3064.         var $block = $self.hasClass('lp-certificate-9') ? $self : $self.find('.lp-certificate-9');
  3065.  
  3066.         if ($block.length) {
  3067.  
  3068.             $block.each(function() {
  3069.                 var $this = $(this);
  3070.                    
  3071.                
  3072.                 if ($this.find('.lp-certificate-9-item').hasClass('_not_con')) {
  3073.                     $this.find('.lp-certificate-9-arrow').hide();
  3074.                 }
  3075.             });
  3076.         }      
  3077.     };
  3078.    
  3079.     lp_template.queue.Init221303 = function ($self) {
  3080.                    
  3081.         var $gallery = $self.find('.lp-gallery-2');
  3082.    
  3083.         if ($gallery.length) {
  3084.             $gallery.each(function(){
  3085.                 var $thisBlock = $(this);
  3086.                 var $window = $(window);
  3087.                 var $maskPhoto = $(this).find('.js-photo-mask');
  3088.                 var $mainPhoto = $(this).find('.js-main-item');
  3089.                 var $previewPhoto = $(this).find('.js-preview-item');
  3090.                 var $touchStartX = 0;
  3091.                 var $touchEndX = 0;
  3092.                 var $nextPhotoBtn = $(this).find('.js-next-item');
  3093.                 var $prevPhotoBtn = $(this).find('.js-prev-item');
  3094.                 var $showMoreBtn = $(this).find('.js-show-more');
  3095.                 var $lightGallery = $(this).find('.js-light-gallery');
  3096.    
  3097.    
  3098.                 $mainPhoto.on('touchstart', function() {
  3099.                     // event.preventDefault();
  3100.                     // event.stopPropagation();
  3101.                     $touchStartX = event.targetTouches[0].screenX;
  3102.                 });
  3103.    
  3104.                 $mainPhoto.on('touchend', function() {
  3105.                     // event.preventDefault();
  3106.                     // event.stopPropagation();
  3107.                     $touchEndX = event.changedTouches[0].screenX;
  3108.                     handleGesture();
  3109.                 });
  3110.    
  3111.                 function showNextPhoto() {
  3112.                     if ($mainPhoto.length <= 7) {
  3113.                         if ( !$mainPhoto.last().hasClass('_active')) {
  3114.                             $mainPhoto.siblings('._active').next().addClass('_active');
  3115.                             $previewPhoto.siblings('._active').next().addClass('_active');
  3116.                             $mainPhoto.siblings('._active').first().removeClass('_active');
  3117.                             $previewPhoto.siblings('._active').first().removeClass('_active');
  3118.                         } else {
  3119.                             $mainPhoto.siblings().removeClass('_active');
  3120.                             $previewPhoto.siblings().removeClass('_active');
  3121.                             $mainPhoto.first().addClass('_active');
  3122.                             $previewPhoto.first().addClass('_active');
  3123.                         }
  3124.                     } else {
  3125.                         if ( !$mainPhoto.eq(5).hasClass('_active')) {
  3126.                             $mainPhoto.siblings('._active').next().addClass('_active');
  3127.                             $previewPhoto.siblings('._active').next().addClass('_active');
  3128.                             $mainPhoto.siblings('._active').first().removeClass('_active');
  3129.                             $previewPhoto.siblings('._active').first().removeClass('_active');
  3130.                         } else {
  3131.                             $mainPhoto.siblings().removeClass('_active');
  3132.                             $previewPhoto.siblings().removeClass('_active');
  3133.                             $mainPhoto.first().addClass('_active');
  3134.                             $previewPhoto.first().addClass('_active');
  3135.                         }
  3136.                     }
  3137.                    
  3138.                     $thisBlock.find('.lp-gallery-2-photo__preview-item-mask._active').removeClass('_active').attr('data-lp-selector', '.lp-gallery-2-photo__preview-item-mask');
  3139.                     $thisBlock.find('.lp-gallery-2-photo__preview-item._active .lp-gallery-2-photo__preview-item-mask').addClass('_active').attr('data-lp-selector', '.lp-gallery-2-photo__preview-item-mask._active');
  3140.                 }
  3141.    
  3142.                 function showPrevPhoto() {
  3143.    
  3144.                     if ($mainPhoto.length <= 7) {
  3145.                         if ( !$mainPhoto.first().hasClass('_active')) {
  3146.                             $mainPhoto.siblings('._active').prev().addClass('_active');
  3147.                             $previewPhoto.siblings('._active').prev().addClass('_active');
  3148.                             $mainPhoto.siblings('._active').last().removeClass('_active');
  3149.                             $previewPhoto.siblings('._active').last().removeClass('_active');
  3150.                         } else {
  3151.                             $mainPhoto.siblings().removeClass('_active');
  3152.                             $previewPhoto.siblings().removeClass('_active');
  3153.                             $mainPhoto.last().addClass('_active');
  3154.                             $previewPhoto.last().addClass('_active');
  3155.                         }
  3156.                     } else {
  3157.                         if ( !$mainPhoto.first().hasClass('_active')) {
  3158.                             $mainPhoto.siblings('._active').prev().addClass('_active');
  3159.                             $previewPhoto.siblings('._active').prev().addClass('_active');
  3160.                             $mainPhoto.siblings('._active').last().removeClass('_active');
  3161.                             $previewPhoto.siblings('._active').last().removeClass('_active');
  3162.                         } else {
  3163.                             $mainPhoto.siblings().removeClass('_active');
  3164.                             $previewPhoto.siblings().removeClass('_active');
  3165.                             $mainPhoto.eq(5).addClass('_active');
  3166.                             $previewPhoto.eq(5).addClass('_active');
  3167.                         }
  3168.                     }
  3169.    
  3170.                     $thisBlock.find('.lp-gallery-2-photo__preview-item-mask._active').removeClass('_active').attr('data-lp-selector', '.lp-gallery-2-photo__preview-item-mask');
  3171.                     $thisBlock.find('.lp-gallery-2-photo__preview-item._active .lp-gallery-2-photo__preview-item-mask').addClass('_active').attr('data-lp-selector', '.lp-gallery-2-photo__preview-item-mask._active');
  3172.                 }
  3173.    
  3174.    
  3175.    
  3176.                 function handleGesture() {
  3177.                     var $touchPath = $touchStartX - $touchEndX;
  3178.                     if (Math.abs($touchPath) > 50) {
  3179.                         if ($touchPath > 0) {
  3180.                             //Next
  3181.                             showNextPhoto();
  3182.                         } else {
  3183.                             //Prev
  3184.                             showPrevPhoto();
  3185.                         }
  3186.                     }
  3187.                 }
  3188.    
  3189.                 var setPhotoMaskSize = function() {
  3190.                     $maskPhoto.height($maskPhoto.width());
  3191.                 }
  3192.    
  3193.    
  3194.                 var showFirstPhoto = function() {
  3195.                     $mainPhoto.first().addClass('_active');
  3196.                     $previewPhoto.first().addClass('_active');
  3197.                     $previewPhoto.first().find('.lp-gallery-2-photo__preview-item-mask').addClass('_active').attr('data-lp-selector', '.lp-gallery-2-photo__preview-item-mask._active');
  3198.                 }
  3199.    
  3200.                 showFirstPhoto();
  3201.    
  3202.                 if ($(window).width() < 600) {
  3203.                     setPhotoMaskSize();
  3204.                 }
  3205.    
  3206.                 $window.resize(function() {
  3207.                     if ($(window).width() < 600) {
  3208.                         setPhotoMaskSize();
  3209.                     }
  3210.                 })
  3211.    
  3212.                 $nextPhotoBtn.on ('click', function (e) {
  3213.                     e.preventDefault();
  3214.                     showNextPhoto();
  3215.                 })
  3216.    
  3217.                 $prevPhotoBtn.on('click', function (e) {
  3218.                     e.preventDefault();
  3219.                     showPrevPhoto();
  3220.                 })
  3221.    
  3222.                 $previewPhoto.on('click', function() {
  3223.                     var $this = $(this);
  3224.                     if (!$this.hasClass('_active')) {
  3225.                         $this.addClass('_active');
  3226.                         $this.find('.lp-gallery-2-photo__preview-item-mask').addClass('_active').attr('data-lp-selector', '.lp-gallery-2-photo__preview-item-mask._active');
  3227.                         $this.siblings().removeClass('_active');
  3228.                         $this.siblings().find('.lp-gallery-2-photo__preview-item-mask').removeClass('_active').attr('data-lp-selector', '.lp-gallery-2-photo__preview-item-mask');
  3229.                     }
  3230.                     $mainPhoto.eq($this.index()).addClass('_active').siblings().removeClass('_active');
  3231.                 })
  3232.    
  3233.                 $lightGallery.lightGallery({
  3234.                     thumbnail: true,
  3235.                     hideControlOnEnd: true,
  3236.                     slideEndAnimatoin: false,
  3237.                     loop: true,
  3238.                     download: false,
  3239.                     thumbWidth: 64,
  3240.                     thumbContHeight: 96,
  3241.                     toogleThumb: false,
  3242.                     thumbMargin: 8,
  3243.                     selector: '.js-main-item'
  3244.                 })
  3245.    
  3246.                 $showMoreBtn.on('click', function() {
  3247.                     $mainPhoto.eq(6).trigger('click')
  3248.                 })
  3249.             })
  3250.         }
  3251.     }
  3252.    
  3253.     lp_template.queue.lpGallery20 = function ($self) {
  3254.                    
  3255.         var $block = $self.hasClass('lp-gallery-20') ? $self : $self.find('.lp-gallery-20');
  3256.        
  3257.         if ($block.length) {
  3258.             $block.each(function(){
  3259.                 var $this = $(this),
  3260.                     $photos = $this.find('.js-photos');
  3261.                
  3262.                 function placePhotoToMosaic() {
  3263.                     $photos.find('.js-photo').each(function(index) {
  3264.                         if (window.outerWidth < 960) {
  3265.                             if (index % 3 == 0) { // wrap by 2 items
  3266.                            
  3267.                                 $(this).add($(this).next('.js-photo')).add(
  3268.                                     $(this).next().next('.js-photo')
  3269.                                 ).wrapAll('<div class="lp-gallery-20-photo__item-wrap" />');
  3270.                             }
  3271.                         } else {
  3272.                             // костыль для ЛП в СУ, чтобы не ставил две обертки
  3273.                             if ($photos.find('.js-photo').parent().hasClass('lp-gallery-20-photo__item-wrap')) {
  3274.                                 return;
  3275.                             }
  3276.                             if (index % 5 == 0) { // wrap by 2 items
  3277.                                 $(this).add(
  3278.                                     $(this).next('.js-photo')).add(
  3279.                                         $(this).next().next('.js-photo').add(
  3280.                                             $(this).next().next().next('.js-photo').add(
  3281.                                                 $(this).next().next().next().next('.js-photo')
  3282.                                             )
  3283.                                         )
  3284.                                     ).wrapAll('<div class="lp-gallery-20-photo__item-wrap" />');
  3285.                             }
  3286.                         }
  3287.                     });
  3288.            
  3289.                     $photos.find('.lp-gallery-20-photo__item-wrap').each(function(el) {
  3290.                         $(this).addClass('_' + $(this).children().length + '-item')
  3291.                     });
  3292.                 }
  3293.            
  3294.                 $(window).on('resize', function(){
  3295.                     if ($photos.find('.js-photo').parent().hasClass('lp-gallery-20-photo__item-wrap')) {
  3296.                         $photos.find('.js-photo').unwrap();
  3297.                     }
  3298.                    
  3299.                     setTimeout(function(){
  3300.                         placePhotoToMosaic();
  3301.                     },0);
  3302.                 });
  3303.             })
  3304.         }
  3305.     }
  3306.  
  3307.    
  3308.     lp_template.queue.lpGallery22 = function($self) {
  3309.         var $block = $self.hasClass('lp-gallery-22') ? $self : $self.find('.lp-gallery-22');
  3310.  
  3311.         if ($block.length) {
  3312.             return
  3313.             $block.each(function(){
  3314.                 var $this = $(this),
  3315.                     $slider = $this.find('.js-owl-carousel'),
  3316.                     autoplay = !!$slider.data('autoplay'),
  3317.                     loop = !!$slider.data('infinite'),
  3318.                     nav = !!$slider.data('arrows'),
  3319.                     dotsEach = !!$slider.data('dots-each'),
  3320.                     dots = 1,
  3321.                     pause = $slider.data('pause') || 5000,
  3322.                     speed = $slider.data('speed') || 250,
  3323.                     fade = !!$slider.data('fade'),
  3324.                     $parent = $slider.closest('[data-block-layout]'),
  3325.                     dataResponse = $slider.data('response'),
  3326.                     response = {},
  3327.                     $dots = $parent.find('.lp-dots-wrapper'),
  3328.                     $window = $(window),
  3329.                     $itemsInRow;
  3330.            
  3331.            
  3332.                 $slider.find('.js-photo-item').each(function(index) {
  3333.                     if (index % 2 == 0) { // wrap by 2 items
  3334.                         $(this).add($(this).next('.js-photo-item')).wrapAll('<div class="lp-gallery-22-gallery-item-wrap js-owl-carousel-item" />');
  3335.                     }
  3336.                 });
  3337.            
  3338.                 var $sliderItem = $this.find('.js-owl-carousel-item');
  3339.            
  3340.                 if ($this.hasClass('_6')) {
  3341.                     $itemsInRow = 6;
  3342.                 } else if ($this.hasClass('_8')) {
  3343.                     $itemsInRow = 8;
  3344.                 } else if ($this.hasClass('_12')) {
  3345.            
  3346.                     if ($window.width() < 960) {
  3347.                       $itemsInRow = 8
  3348.                     } else {
  3349.                         $itemsInRow = 12;
  3350.                     }
  3351.                 } else {
  3352.                     $itemsInRow = 4;
  3353.                 }
  3354.            
  3355.                 console.log($sliderItem.length);
  3356.                 console.log($itemsInRow);
  3357.            
  3358.                 if ($sliderItem.length > $itemsInRow) {
  3359.                     $slider.owlCarousel({
  3360.                         autoplay : autoplay,
  3361.                         loop : loop,
  3362.                         nav : nav,
  3363.                         dots : true,
  3364.                         dotsEach: dotsEach,
  3365.                         animateIn: fade ? 'fadeIn' : false,
  3366.                         animateOut: fade ? 'fadeOut' : false,
  3367.                         smartSpeed: speed,
  3368.                         mouseDrag: s3LP.is_cms ? false : true,
  3369.                         autoplayTimeout: pause,
  3370.                         responsive: {
  3371.                             0: {
  3372.                                 items: 2,
  3373.                                 slideBy: 2
  3374.                             },
  3375.                             600: {
  3376.                                 items: $itemsInRow,
  3377.                                 slideBy: 1
  3378.                             }
  3379.                         },
  3380.                         onInitialized: function(e) {
  3381.                             var $dotsCount = $parent.find('.owl-dot').length;
  3382.                            
  3383.                             if (!$dots.length || $dotsCount < 2) {
  3384.                                 $dots.html('');
  3385.                                
  3386.                                 $parent.find('.js-next-slide, .js-prev-slide').addClass('_hide');
  3387.                                 return;
  3388.                             };
  3389.                             var $dotsHTML = '';
  3390.                            
  3391.                             for(var i = 0; i < $dotsCount; i++) {
  3392.                                 $dotsHTML += '<div class="lp-dots-item js-dot-item" data-elem-type="container" data-lp-selector=".lp-dots-item"></div>';
  3393.                             }
  3394.                            
  3395.                             if (!$dots.hasClass('_unchanged')) {
  3396.                            
  3397.                                 $dots.html($dotsHTML);
  3398.                            
  3399.                             }
  3400.                            
  3401.                             $dots.find('.lp-dots-item').eq(0).addClass('active');
  3402.                            
  3403.                         },
  3404.                        
  3405.                         onResized: function(e) {
  3406.                             if (!$dots.length || e.page.count < 2) {
  3407.                                 $dots.html('');
  3408.                                 $parent.find('.js-next-slide, .js-prev-slide').addClass('_hide');
  3409.                                 return;
  3410.                             } else {
  3411.                                 $parent.find('.js-next-slide, .js-prev-slide').addClass('_show');
  3412.                             }
  3413.                            
  3414.                             var $dotsHTML = '';
  3415.                             for(var i = 0; i < e.page.count; i++) {
  3416.                                 $dotsHTML += '<div class="lp-dots-item js-dot-item" data-elem-type="container" data-lp-selector=".lp-dots-item"></div>';
  3417.                             }
  3418.                            
  3419.                             if (!$dots.hasClass('_unchanged')) {
  3420.                                 $dots.html($dotsHTML);
  3421.                             }
  3422.                             $dots.find('.lp-dots-item').removeClass('active');
  3423.                             $dots.find('.lp-dots-item').eq(e.page.index).addClass('active');
  3424.                         },
  3425.                         onTranslate: function(e) {
  3426.                             $dots.find('.lp-dots-item').removeClass('active');
  3427.                             $dots.find('.lp-dots-item').eq(e.page.index).addClass('active');
  3428.                         }
  3429.                     });
  3430.                    
  3431.                     $parent.on('click', '.js-next-slide', function(e) {
  3432.                         e.preventDefault();
  3433.                         $slider.trigger('next.owl.carousel');
  3434.                     });
  3435.    
  3436.                     $parent.on('click', '.js-prev-slide', function(e) {
  3437.                         e.preventDefault();
  3438.                         $slider.trigger('prev.owl.carousel');
  3439.                     });
  3440.    
  3441.                     $parent.on('click', '.js-dot-item', function(e) {
  3442.                         e.preventDefault();
  3443.                         $slider.trigger('to.owl.carousel', [$(this).index()]);
  3444.                     });
  3445.                 }
  3446.                 console.log($slider.owlCarousel);
  3447.             });
  3448.         }
  3449.     }
  3450.    
  3451.     lp_template.queue.lpPromo13 = function($self) {
  3452.         var $slider = $self.find('.js-promo-13-slider');
  3453.    
  3454.         if ($slider.length) {
  3455.             $slider.each(function(){
  3456.    
  3457.                 var $this = $(this),
  3458.                     $parent = $this.closest('[data-block-layout]'),
  3459.                     $currentSlideBlock = $parent.find('.js-promo-13-current'),
  3460.                     $totalSlidesBlock = $parent.find('.js-promo-13-total'),
  3461.                     $autoplay = $this.data('autoplay'),
  3462.                     $infinite = $this.data('infinite'),
  3463.                     $autoplaySpeed = $this.data('autoplay-speed'),
  3464.                     $speed = $this.data('speed');
  3465.    
  3466.    
  3467.                 function changeProgressWidth($progressWidth) {
  3468.                     var $progressWidthBlock =  $parent.find('.js-promo-13-progress'),
  3469.                         outerWidth = $progressWidthBlock.outerWidth(),
  3470.                         innerWidth = $progressWidthBlock.innerWidth(),
  3471.                         $progressMaxWidthBlock = outerWidth - innerWidth;
  3472.                        
  3473.                     $progressWidthBlock.css('width', 'calc(' + $progressWidth + '%' + ' - ' + $progressMaxWidthBlock + 'px');
  3474.                 }
  3475.    
  3476.                 $this.on('init reInit', function(event, slick) {
  3477.                     var $totalSlides = slick.slideCount;
  3478.    
  3479.                     if($totalSlides > 1) {
  3480.                         var $progressWidth = 1 /$totalSlides*100;
  3481.                         $totalSlidesBlock.text($totalSlides);
  3482.                         changeProgressWidth($progressWidth);
  3483.                     } else {
  3484.                         $parent.find('.js-promo-13-progress-block').css('display', 'none')
  3485.                     }
  3486.    
  3487.    
  3488.                 });
  3489.    
  3490.                 $this.slick({
  3491.                     infinite: $infinite,
  3492.                     speed: $speed,
  3493.                     autoplay: $autoplay,
  3494.                     autoplaySpeed: $autoplaySpeed,
  3495.                     slidesToShow: 1,
  3496.                     slidesToScroll: 1,
  3497.                     fade: true,
  3498.                     dots:false,
  3499.                     prevArrow: $parent.find('.lp-promo-13-slider__arrow--left'),
  3500.                     nextArrow: $parent.find('.lp-promo-13-slider__arrow--right')
  3501.                 });
  3502.    
  3503.                 $this.on('afterChange', function(event, slick, currentSlide){
  3504.                     var $currentSlide = currentSlide + 1,
  3505.                         $totalSlides = slick.slideCount,
  3506.                         $progressWidth = $currentSlide/$totalSlides*100;
  3507.                     $currentSlideBlock.text($currentSlide);
  3508.                     changeProgressWidth($progressWidth);
  3509.                 });
  3510.    
  3511.             });
  3512.         }
  3513.     }
  3514.    
  3515.     lp_template.queue.lpPromo16 = function($self) {
  3516.         var $slider = $self.find('.js-promo-16-slider');
  3517.  
  3518.         if ($slider.length) {
  3519.             $slider.each(function(){
  3520.    
  3521.                 var $this = $(this),
  3522.                     $parent = $this.closest('[data-block-layout]'),
  3523.                     $currentSlideBlock = $parent.find('.js-promo-16-current'),
  3524.                     $totalSlidesBlock = $parent.find('.js-promo-16-total'),
  3525.                     $autoplay = $this.data('autoplay'),
  3526.                     $infinite = $this.data('infinite'),
  3527.                     $autoplaySpeed = $this.data('autoplay-speed'),
  3528.                     $speed = $this.data('speed');
  3529.    
  3530.                 $this.on('init reInit afterChange', function(event, slick) {
  3531.                     var $totalSlides = slick.slideCount;
  3532.    
  3533.                     if($totalSlides > 1) {
  3534.                         $totalSlidesBlock.text($totalSlides);
  3535.                     } else {
  3536.                         $('.js-promo-16-progress-block').css('display', 'none')
  3537.                     }
  3538.                 });
  3539.    
  3540.                 $this.on('afterChange', function(event, slick, currentSlide){
  3541.                     var $currentSlide = currentSlide + 1;
  3542.                     $currentSlideBlock.text($currentSlide);
  3543.                 });
  3544.    
  3545.                 $this.slick({
  3546.                     infinite: $infinite,
  3547.                     speed: $speed,
  3548.                     autoplay: $autoplay,
  3549.                     autoplaySpeed: $autoplaySpeed,
  3550.                     slidesToShow: 1,
  3551.                     slidesToScroll: 1,
  3552.                     fade: true,
  3553.                     dots:false,
  3554.                     prevArrow: $parent.find('.lp-promo-16-slide__arrow--left'),
  3555.                     nextArrow: $parent.find('.lp-promo-16-slide__arrow--right')
  3556.                 });
  3557.             });
  3558.         }
  3559.     }
  3560.    
  3561.     lp_template.queue.lpProducts39 = function($self) {
  3562.         var $block = $self.hasClass('lp-prods-39') ? $self : $self.find('.lp-prods-39');
  3563.            
  3564.         if ($block.length) {
  3565.             var func = function() {
  3566.                 $block.each(function(){
  3567.                     var $this = $(this);
  3568.                     if (window.matchMedia('(min-width: 1200px)').matches) {
  3569.                         $this.find('.lp-prods-39__subblock').each(function(index) {
  3570.                             var item = $(this).find('.lp-prods-39__item:first-child()'),               
  3571.                                     itemHeight = item.height() + 2*parseInt(item.css('border-width'));                 
  3572.            
  3573.                             $(this).find('.lp-prods-39__title-wrap').css('min-height', itemHeight);
  3574.            
  3575.                         });
  3576.                     } else {
  3577.                         $this.find('.lp-prods-39__title-wrap').css('min-height', '');
  3578.                     }
  3579.                 });
  3580.             };
  3581.            
  3582.             $(window).on('resize', func);
  3583.             if (s3LP.is_cms) {
  3584.                 setTimeout(function(){
  3585.                     LpController.afterSave(function () {
  3586.                         func();
  3587.                     });
  3588.                 },1000);
  3589.             }
  3590.         }
  3591.     }
  3592.    
  3593.     lp_template.queue.lpContacts6 = function($self) {
  3594.         var $contactsBlock = $self.hasClass('js-contacts-6') ? $self : $self.find('.js-contacts-6');
  3595.        
  3596.         setTimeout(function() {
  3597.             $('.lp-contacts-6-data-column').removeClass('lp-contacts-6-data-column-load'); 
  3598.         }, 1000);
  3599.            
  3600.         if ($contactsBlock.length) {
  3601.             $contactsBlock.each(function() {
  3602.        
  3603.                 var $tab = $contactsBlock.find('.js-tab'),
  3604.                     $tabsBlock = $contactsBlock.find('.js-tabs'),
  3605.                     $contactsData = $contactsBlock.find('.js-contacts-data');
  3606.        
  3607.                 // Одинаковая высота у всех блоков
  3608.        
  3609.                 function setHeight() {
  3610.                     var maxHeight = $contactsData.eq(0).height();
  3611.                     $contactsData.each(function () {
  3612.                         if ( $(this).height() > maxHeight ) {
  3613.                             maxHeight = $(this).height();
  3614.                         }
  3615.                     });
  3616.                     $contactsData.css('minHeight', maxHeight);
  3617.        
  3618.                     setTimeout(function(){
  3619.                         $contactsData.hide();
  3620.                         $contactsData.eq(0).addClass('_active');
  3621.                     }, 500);
  3622.                 }
  3623.        
  3624.                 // Табы
  3625.        
  3626.                 function tabsInit() {
  3627.                     $tab.on('click', function() {
  3628.                         $(this).addClass('_active').siblings().removeClass('_active');
  3629.                         $contactsData.removeClass('_active').eq($(this).index()).addClass('_active');
  3630.                         lp_template.checkMapInitialization($contactsData.eq($(this).index()).find('.js-lp-simple-map'));
  3631.                         if ($contactsBlock.find('.lp-contacts-6-map').data('map-type') == 'yandex') {
  3632.                             console.log($contactsData.eq($(this).index()).find('.js-lp-simple-map').data());
  3633.                             $contactsData.eq($(this).index()).find('.js-lp-simple-map').data('ymaps').container.fitToViewport();
  3634.                         }
  3635.                     });
  3636.                 }
  3637.        
  3638.                 // Кастомный скролл
  3639.        
  3640.                 function scrollInit() {
  3641.        
  3642.                     // Показывать скролл, если он нужен
  3643.                     var widthSum = 0;
  3644.                     $tab.each(function () {
  3645.                         widthSum +=  +$(this).outerWidth(true)
  3646.                     })
  3647.        
  3648.                     if(widthSum > $tabsBlock.width()) {
  3649.                         baron({
  3650.                             root: '.lp-contacts-6-scroll',
  3651.                             scroller: '.lp-contacts-6-scroll__inner',
  3652.                             bar: '.lp-contacts-6-scroll__bar',
  3653.                             scrollingCls: '_scrolling',
  3654.                             draggingCls: '_dragging',
  3655.                             direction: 'h',
  3656.        
  3657.                         })
  3658.                     }
  3659.                 }
  3660.        
  3661.                 // Карты
  3662.        
  3663.                 setHeight();
  3664.                 tabsInit();
  3665.                 //scrollInit();
  3666.        
  3667.             });
  3668.         }
  3669.     }
  3670.    
  3671.     lp_template.queue.lpReviews18 = function($self) {
  3672.  
  3673.         var $block = $self.hasClass('lp-reviews-18') ? $self : $self.find('.lp-reviews-18');
  3674.         if ($block.length) {
  3675.             $block.each(function(){
  3676.                 var $this = $(this);
  3677.                
  3678.                     try {
  3679.                         adjustHeight();
  3680.            
  3681.                         $(window).on('resize', function(){             
  3682.                             adjustHeight();
  3683.                         });          
  3684.                     } catch(exception) {
  3685.                         console.log(exception);
  3686.                     }
  3687.            
  3688.                 function adjustHeight() {
  3689.                     if (window.matchMedia('(min-width: 960px)').matches) {
  3690.                         var wrapTopPadding = parseInt($this.find('.lp-reviews-18__wrap').css('padding-top')),                  
  3691.                                 headerHeight = $this.find('.lp-reviews-18__header').height(),              
  3692.                                 imgHeight = $this.find('.lp-reviews-18__bg-img').height(),
  3693.                                 top = wrapTopPadding + headerHeight,                   
  3694.                                 contentMinHeight = imgHeight + headerHeight;                               
  3695.                        
  3696.                         $this.find('.lp-reviews-18__bg-img').css({top: top});
  3697.                         $this.find('.lp-reviews-18__content').css({minHeight:contentMinHeight});           
  3698.                     } else {
  3699.                         $this.find('.lp-reviews-18__bg-img').css({top: ''});
  3700.                         $this.find('.lp-reviews-18__content').css({minHeight: ''});        
  3701.                     }
  3702.                 };
  3703.                
  3704.                 if (s3LP.is_cms) {
  3705.                     setTimeout(function(){
  3706.                         LpController.afterSave(function () {
  3707.                             $(window).trigger('resize');
  3708.                         });
  3709.                     },3000);
  3710.                 }
  3711.             });
  3712.         }
  3713.     }
  3714.    
  3715.     lp_template.queue.lpReviews19 = function($self) {
  3716.  
  3717.         var $block = $self.hasClass('lp-reviews-19') ? $self : $self.find('.lp-reviews-19');
  3718.        
  3719.         $block.each(function(){
  3720.             var $this = $(this);
  3721.            
  3722.                 try {
  3723.                     setTimeout(function(){
  3724.                         imgHeight();
  3725.                     },3000);
  3726.                    
  3727.                     $(window).on('resize', function(){             
  3728.                         setTimeout(function(){
  3729.                             imgHeight();
  3730.                         },300);
  3731.                     });
  3732.                    
  3733.                     if (s3LP.is_cms) {
  3734.                    
  3735.                         setTimeout(function(){
  3736.                             LpController.afterSave(function () {
  3737.                                 imgHeight();
  3738.                             });
  3739.                         },3000);
  3740.                    
  3741.                     }
  3742.                    
  3743.                 } catch(exception) {
  3744.                     console.log(exception);
  3745.                 }
  3746.        
  3747.             function imgHeight() {
  3748.                 if (window.matchMedia('(min-width: 960px)').matches) {
  3749.                     var topHeight = $this.find('.lp-reviews-19__top').height();
  3750.                    
  3751.                     $this.find('.lp-reviews-19__block-img').css({height: topHeight});
  3752.                                
  3753.                 } else {
  3754.                     $this.find('.lp-reviews-19__block-img').css({height: ''});
  3755.                 }
  3756.             };
  3757.         });
  3758.     }
  3759.    
  3760.    
  3761.     lp_template.queue.lpVideo17 = function($self) {
  3762.         var $block = $self.hasClass('lp-video-17') ? $self : $self.find('.lp-video-17');
  3763.  
  3764.         if ($block.length) {
  3765.             $block.each(function(){
  3766.                 var $this = $(this),
  3767.                     $sliderBig = $this.find('.lp-video-17__slider-big'),
  3768.                     slider_thumbs = $this.find('.lp-video-17__slider-thumbs'),
  3769.                     $nav = !!slider_thumbs.data('arrows'),
  3770.                     $dot = !!slider_thumbs.data('dots'),
  3771.                     $autoplay = !!$sliderBig.data('autoplay'),
  3772.                     $infinite = $sliderBig.data('infinite'),
  3773.                     $autoplaySpeed = $sliderBig.data('pause'),
  3774.                     $speed = $sliderBig.data('speed');
  3775.  
  3776.                 try {
  3777.  
  3778.                     initSlick();
  3779.                    
  3780.                 } catch(exception) {
  3781.                     console.log(exception);
  3782.                 }
  3783.  
  3784.                 function initSlick() {
  3785.                     $this.find('.lp-video-17__slider-big').slick({
  3786.                         infinite: $infinite,
  3787.                         speed: $speed,
  3788.                         vertical: false,
  3789.                         verticalSwiping: true,
  3790.                         slidesPerRow: 1,
  3791.                         slidesToShow: 1,
  3792.                         slidesToScroll: 1,         
  3793.                         asNavFor: $this.find('.lp-video-17__slider-thumbs'),
  3794.                         arrows: false,
  3795.                         fade: true,
  3796.                         dots: false,
  3797.                         adaptiveHeight: true,
  3798.                         draggable: true,           
  3799.                         responsive: [
  3800.                             {
  3801.                                 breakpoint: 1200,
  3802.                                 settings: {
  3803.                                     vertical: false,
  3804.                                     fade: true,
  3805.                                     cssEase: 'ease',
  3806.                                     verticalSwiping: false,
  3807.                                 }
  3808.                             },
  3809.                             {
  3810.                                 breakpoint: 600,
  3811.                                 settings: {
  3812.                                     vertical: false,
  3813.                                     verticalSwiping: false,
  3814.                                     dots: true,
  3815.                                     arrows: true,
  3816.                                     appendArrows: $this.find('.lp-video-17__big-controls'),
  3817.                                     prevArrow: '<button data-has-event="1" data-elem-type="container" data-lp-selector=".lp-video-17__arrow" class="lp-video-17__arrow lp-video-17__arrow-prev js-prev-item _primary-fill _svg-light-fill"><div data-elem-type="container" class="arrow-line-wr" data-lp-selector=".arrow-line"><div class="arrow-line"></div><div class="arrow-line"></div></div></button>',
  3818.                                     nextArrow: '<button data-has-event="1" data-elem-type="container" data-lp-selector=".lp-video-17__arrow" class="lp-video-17__arrow lp-video-17__arrow-next js-next-item _primary-fill _svg-light-fill"><div data-elem-type="container" class="arrow-line-wr" data-lp-selector=".arrow-line"><div class="arrow-line"></div><div class="arrow-line"></div></div></button>',
  3819.                                     appendDots: $this.find('.lp-video-17__big-dots'),                      
  3820.                                 }
  3821.                             }
  3822.                         ]
  3823.                     });
  3824.                
  3825.                     $this.find(".lp-video-17__slider-thumbs").slick({
  3826.                         infinite: $infinite,
  3827.                         speed: $speed,
  3828.                         autoplay: $autoplay,
  3829.                         autoplaySpeed: $autoplaySpeed,
  3830.                         vertical: true,
  3831.                         verticalSwiping: true,
  3832.                         slidesPerRow: 1,
  3833.                         slidesToShow: 4,   
  3834.                         asNavFor: $this.find('.lp-video-17__slider-big'),
  3835.                         focusOnSelect: true,
  3836.                         arrows: true,
  3837.                         dots: true,
  3838.                         adaptiveHeight: true,
  3839.                         appendArrows: $this.find('.lp-video-17__thumbs-controls'),         
  3840.                         appendDots: $this.find('.lp-video-17__thumbs-dots'),
  3841.                         prevArrow: '<button data-has-event="1" data-elem-type="container" data-lp-selector=".lp-video-17__arrow" class="lp-video-17__arrow lp-video-17__arrow-prev js-prev-item _primary-fill _svg-light-fill"><div data-elem-type="container" class="arrow-line-wr" data-lp-selector=".arrow-line"><div class="arrow-line"></div><div class="arrow-line"></div></div></button>',
  3842.                         nextArrow: '<button data-has-event="1" data-elem-type="container" data-lp-selector=".lp-video-17__arrow" class="lp-video-17__arrow lp-video-17__arrow-next js-next-item _primary-fill _svg-light-fill"><div data-elem-type="container" class="arrow-line-wr" data-lp-selector=".arrow-line"><div class="arrow-line"></div><div class="arrow-line"></div></div></button>',
  3843.                         responsive: [
  3844.                             {
  3845.                                 breakpoint: 1200,
  3846.                                 settings: {
  3847.                                     vertical: false,
  3848.                                     slidesToShow: 3,
  3849.                                     slidesPerRow: 1,
  3850.                                     infinite: $infinite,
  3851.                                     slidesToScroll: 3, 
  3852.                                     verticalSwiping: false,
  3853.                                 }
  3854.                             },
  3855.                             {
  3856.                                 breakpoint: 960,
  3857.                                 settings: {
  3858.                                     vertical: false,               
  3859.                                     slidesPerRow: 1,
  3860.                                     slidesToShow: 2,
  3861.                                     slidesToScroll: 1,
  3862.                                     infinite: $infinite,
  3863.                                     verticalSwiping: false,
  3864.                                 }
  3865.                             },
  3866.                         ]
  3867.                     });
  3868.                 };
  3869.                 $('.slick-slider.lp-video-17__slider-thumbs').on('beforeChange', function(event, slick, currentSlide, nextSlide){
  3870.                   $('.lp-video-17__slider-big video').trigger('pause');
  3871.                   $('.lp-video-17__slider-big ._lp-youtube-video').each(function(){
  3872.                       var el_src = $(this).attr("src");
  3873.                         $(this).attr("src",el_src);
  3874.                        
  3875.                   });
  3876.                 });
  3877.                
  3878.                
  3879.                 $(window).on('resize', function(){
  3880.                     setTimeout(function(){
  3881.                         var $dotItem = $block.find('.lp-video-17__thumbs-dots li button');
  3882.                         if ($dotItem.hasClass('lp-video-17__slider-dot')) {
  3883.                            
  3884.                         }
  3885.                         else {
  3886.                             $dotItem.attr('data-elem-type', 'card_container');
  3887.                             $dotItem.addClass('lp-video-17__slider-dot');
  3888.                             $dotItem.attr('data-lp-selector','.lp-video-17__slider-dot');
  3889.                             $dotItem.attr('data-has-event','1');
  3890.                         }
  3891.                     },500);
  3892.                 });
  3893.             });
  3894.         }
  3895.     }
  3896.    
  3897.     lp_template.queue.lpSteps7 = function($self) {
  3898.         var $block = $self.find('.js-simple-tabs');
  3899.  
  3900.         if ($block.length) {
  3901.             $block.each(function(){
  3902.                 var $this = $(this);
  3903.                 if (!s3LP.is_cms) {
  3904.                     $this.bind('mousewheel', function(e){
  3905.                         if(e.originalEvent.wheelDelta /120 > 0) {
  3906.                             $this.find('.active:not(:first-child)').removeClass('active').delay(800).prev().addClass('active').delay(800);
  3907.                         }
  3908.                         else{
  3909.                             $this.find('.active:not(:last-child)').removeClass('active').delay(800).next().addClass('active').delay(800);
  3910.                         }
  3911.                        
  3912.                         if ($this.find('.count').last().hasClass('active') || $this.find('.count').first().hasClass('active')) {
  3913.                             return;
  3914.                         }
  3915.                         else {
  3916.                             e.stopPropagation();
  3917.                             e.preventDefault();
  3918.                         }
  3919.                     });
  3920.                 }
  3921.                
  3922.               $('.js-tab').on('click', function(){
  3923.                     var $index = $(this).index() + 1;
  3924.                     $this.find('.js-tab-content:nth-child(' + $index + ')').addClass('active').siblings().removeClass('active');
  3925.                     $(this).addClass('active').siblings().removeClass('active')
  3926.                 });
  3927.             });
  3928.         }
  3929.     }
  3930.    
  3931.     lp_template.queue.lpMenu20 = function($self) {
  3932.         var $block = $self.find('.js-phone-btn');
  3933.  
  3934.         if ($block.length) {
  3935.             $block.each(function(){
  3936.                 var $this = $(this);
  3937.                
  3938.                 $this.on('click', function(){
  3939.                     $(this).siblings('.js-phone').toggleClass('active');
  3940.                 });
  3941.                
  3942.                 if (!s3LP.is_cms) {
  3943.                     $(document).mouseup(function (e){
  3944.                         var div = $(".lp-menu-20-phone");
  3945.                         if (!div.is(e.target)
  3946.                             && div.has(e.target).length === 0) {
  3947.                             div.find('.js-phone').removeClass('active');
  3948.                         }
  3949.                     });
  3950.                 }
  3951.             });
  3952.         }
  3953.     }
  3954.    
  3955.    
  3956.     lp_template.queue.lpCertificate19 = function($self) {
  3957.         var $block = $self.hasClass('lp-certificate-19') ? $self : $self.find('.lp-certificate-19');
  3958.        
  3959.         if ($block.length) {
  3960.             $block.each(function(){
  3961.                 var $this = $(this),
  3962.                     $mainSlider = $this.find('.js-main-slick'),
  3963.                     $thumbSlider = $this.find('.js-thumb-slick'),
  3964.                     $prevBtn = $this.find('.js-slider-prev'),
  3965.                     $nextBtn = $this.find('.js-slider-next'),
  3966.                     $dots = !!$mainSlider.data('dots'),
  3967.                     $arrows = !!$mainSlider.data('arrows'),
  3968.                     $autoplay = $mainSlider.data('autoplay'),
  3969.                     $infinite = $mainSlider.data('infinite'),
  3970.                     $autoplaySpeed = $mainSlider.data('pause'),
  3971.                     $speed = $mainSlider.data('speed');
  3972.                
  3973.                 $mainSlider.slick({
  3974.                     slidesToShow: 1,
  3975.                     slidesToScroll: 1,
  3976.                     arrows: false,
  3977.                     fade: true,
  3978.                     asNavFor: $thumbSlider,
  3979.                     infinite: $infinite,
  3980.                     speed: $speed,
  3981.                     autoplay: $autoplay,
  3982.                     autoplaySpeed: $autoplaySpeed,
  3983.                     adaptiveHeight: false,
  3984.                     responsive: [
  3985.                         {
  3986.                             breakpoint: 600,
  3987.                             settings: {
  3988.                                 slidesToShow: 1,
  3989.                                 arrows: $arrows
  3990.                             }
  3991.                         }
  3992.                     ]
  3993.                 })
  3994.            
  3995.                 $thumbSlider.slick({
  3996.                     slidesToShow: 5,
  3997.                     slidesToScroll: 1,
  3998.                     asNavFor: $mainSlider,
  3999.                     dots: $dots,
  4000.                     dotsClass:'lp-certificate-19__thumbs-dots-in',
  4001.                     appendDots:$this.find('.lp-certificate-19__thumbs-dots'),
  4002.                     infinite: $infinite,
  4003.                     speed: $speed,
  4004.                     autoplay: $autoplay,
  4005.                     autoplaySpeed: $autoplaySpeed,
  4006.                     centerMode: false,
  4007.                     arrows: $arrows,
  4008.                     touches: true,
  4009.                     prevArrow: $prevBtn,
  4010.                     nextArrow: $nextBtn,
  4011.                     focusOnSelect: true,
  4012.                     adaptiveHeight: false,
  4013.                     centerPadding: '6px',
  4014.                     mobileFirst: true,
  4015.                     swipeToSlide: false,
  4016.                     responsive: [
  4017.                         {
  4018.                             breakpoint: 600,
  4019.                             settings: {
  4020.                                 slidesToShow: 4,
  4021.                                 centerPadding: '20px'
  4022.                             }
  4023.                         },
  4024.                         {
  4025.                             breakpoint: 960,
  4026.                             settings: {
  4027.                                 slidesToShow: 4,
  4028.                                 arrows: true,
  4029.                                 centerPadding: '0px'
  4030.                             }
  4031.                         },
  4032.                         {
  4033.                             breakpoint: 1380,
  4034.                             settings: {
  4035.                                 slidesToShow: 5,
  4036.                                 arrows: true,
  4037.                                 centerPadding: '0px'
  4038.                             }
  4039.                         }
  4040.                     ]
  4041.                 });
  4042.                
  4043.                 $(window).on('resize', function(){
  4044.                     setTimeout(function(){
  4045.                         var $dotItem = $this.find('.lp-certificate-19__thumbs-dots li button');
  4046.                         if ($dotItem.hasClass('lp-certificate-19__thumbs-dot')) {
  4047.                            
  4048.                         }
  4049.                         else {
  4050.                             $dotItem.attr('data-elem-type', 'card_container');
  4051.                             $dotItem.addClass('lp-certificate-19__thumbs-dot');
  4052.                             $dotItem.attr('data-lp-selector','.lp-certificate-19__thumbs-dot');
  4053.                             $dotItem.attr('data-has-event','1');
  4054.                         }
  4055.                     },500);
  4056.                 });
  4057.             });
  4058.         }
  4059.     };
  4060.    
  4061.     lp_template.queue.lpPartners15 = function($self) {
  4062.        
  4063.         var $block = $self.hasClass('lp-partners-15') ? $self : $self.find('.lp-partners-15');
  4064.        
  4065.         $block.each(function(){
  4066.             if ($block.length) {
  4067.                 var $this = $(this),
  4068.                     $slider = $this.find('.lp-partners-15-items.js-owl-carousel'),
  4069.                     autoplay = !!$slider.data('autoplay'),
  4070.                     infinite = !!$slider.data('infinite'),
  4071.                     nav = !!$slider.data('arrows'),
  4072.                     dotsEach = !!$slider.data('dots-each'),
  4073.                     dots = true,
  4074.                     pause = $slider.data('pause') || 5000,
  4075.                     speed = $slider.data('speed') || 250,
  4076.                     fade = !!$slider.data('fade'),
  4077.                     $parent = $slider.closest('[data-block-layout]'),
  4078.                     dataResponse = $slider.data('response'),
  4079.                     response = {},
  4080.                     $dots = $this.find('.lp-dots-wrapper');
  4081.                
  4082.                
  4083.                 try {
  4084.                     let owl = $slider,
  4085.                         windowWidth = $(window).width(),
  4086.                         gridFormer = function(){
  4087.                         let wrapper = '<div class="lp-partners-15-items-grid"></div>',
  4088.                             itemsCount = $this.find('.lp-partners-15-items>.lp-partners-15-item').length,
  4089.                             sliceFunc = function(itemsInGrid){
  4090.                                 for (var i = 0; i < itemsCount/itemsInGrid; i++) {
  4091.                                     $this.find('.lp-partners-15-items>.lp-partners-15-item').slice(0, itemsInGrid).wrapAll(wrapper);
  4092.                                 }
  4093.                                 $this.find('.lp-partners-15-items-grid').each(function(){
  4094.                                     $(this).addClass('_'+$(this).children().length);
  4095.                                 });
  4096.                             };
  4097.        
  4098.                         if (windowWidth>=600) {
  4099.                             sliceFunc(4);                  
  4100.                         }
  4101.                     }
  4102.        
  4103.                     let initOwl = function(){
  4104.                         owl.owlCarousel({
  4105.                             dots: true,
  4106.                             nav: true,
  4107.                             mouseDrag: false,
  4108.                             margin: 16,
  4109.                             autoplay : autoplay,
  4110.                             loop : infinite,
  4111.                             smartSpeed: speed,
  4112.                             autoplayTimeout: pause,
  4113.                             items: 1,
  4114.                             onInitialized: function(e) {
  4115.                                 var $dotsCount = $this.find('.owl-dot').length;
  4116.                                
  4117.                                 if (!$dots.length || $dotsCount < 2) {
  4118.                                     $dots.html('');
  4119.                                     return;
  4120.                                 };
  4121.                                 var $dotsHTML = '';
  4122.                                
  4123.                                 for(var i = 0; i < $dotsCount; i++) {
  4124.                                     $dotsHTML += '<div class="lp-dots-item js-dot-item" data-elem-type="container" data-lp-selector=".lp-dots-item"></div>';
  4125.                                 }
  4126.                                
  4127.                                 if (!$dots.hasClass('_unchanged')) {
  4128.                                
  4129.                                     $dots.html($dotsHTML);
  4130.                                
  4131.                                 }
  4132.                                
  4133.                                 $dots.find('.lp-dots-item').eq(0).addClass('active');
  4134.                                
  4135.                             },
  4136.                            
  4137.                             onResized: function(e) {
  4138.                                 if (!$dots.length || e.page.count < 2) {
  4139.                                     $dots.html('');
  4140.                                     return;
  4141.                                 }
  4142.                                
  4143.                                 var $dotsHTML = '';
  4144.                                 for(var i = 0; i < e.page.count; i++) {
  4145.                                     $dotsHTML += '<div class="lp-dots-item js-dot-item" data-elem-type="container" data-lp-selector=".lp-dots-item"></div>';
  4146.                                 }
  4147.                                
  4148.                                 if (!$dots.hasClass('_unchanged')) {
  4149.                                     $dots.html($dotsHTML);
  4150.                                 }
  4151.                                 $dots.find('.lp-dots-item').removeClass('active');
  4152.                                 $dots.find('.lp-dots-item').eq(e.page.index).addClass('active');
  4153.                             },
  4154.                             onTranslated: function(e) {
  4155.                                 $dots.find('.lp-dots-item').removeClass('active');
  4156.                                 $dots.find('.lp-dots-item').eq(e.page.index).addClass('active');
  4157.                             }
  4158.                         });
  4159.                        
  4160.                         $this.find('.js-next-slide').off();
  4161.                         $this.find('.js-next-slide').on('click', function(e) {
  4162.                             e.preventDefault();
  4163.                             owl.trigger('next.owl.carousel');
  4164.                         });
  4165.                         $this.find('.js-prev-slide').off();
  4166.                         $this.find('.js-prev-slide').on('click', function(e) {
  4167.                             e.preventDefault();
  4168.                             owl.trigger('prev.owl.carousel');
  4169.                         });
  4170.                        
  4171.                         $this.find('.js-dot-item').on('click', function(e) {
  4172.                             e.preventDefault();
  4173.                             owl.trigger('to.owl.carousel', [$(this).index()]);
  4174.                         });
  4175.                        
  4176.                     }
  4177.        
  4178.                     let reInitOwl = function(){
  4179.                         owl.trigger('destroy.owl.carousel');
  4180.                         if (windowWidth<600) {
  4181.                             $this.find('.lp-partners-15-item').unwrap();
  4182.                         }              
  4183.                         gridFormer();
  4184.                         initOwl();
  4185.                     }
  4186.        
  4187.                     gridFormer();
  4188.                    
  4189.                     initOwl();
  4190.        
  4191.        
  4192.                     $(window).resize(function(){               
  4193.                         let newWindowWidth = $(window).width();
  4194.                         if (windowWidth<600){
  4195.                             if (newWindowWidth>=600) {
  4196.                                 windowWidth = newWindowWidth;
  4197.                                 reInitOwl();
  4198.                             }
  4199.                         } else if (windowWidth>=600){
  4200.                             if (newWindowWidth<600) {
  4201.                                 windowWidth = newWindowWidth;
  4202.                                 reInitOwl();
  4203.                             }
  4204.                         }
  4205.                     });
  4206.        
  4207.                 } catch(exception) {
  4208.                     console.log(exception);
  4209.                 }
  4210.             }
  4211.         });
  4212.     }
  4213.    
  4214.     lp_template.queue.lpStaff7 = function($self) {
  4215.        
  4216.         var $block = $self.hasClass('lp-staff-7') ? $self : $self.find('.lp-staff-7');
  4217.        
  4218.         if ($block.length) {
  4219.             $block.each(function(){
  4220.            
  4221.                 var $this = $(this);
  4222.                
  4223.                 $this.find('.lp-header-tab').not('._active').on('click', function(){
  4224.                     $(this).addClass('_active').siblings().removeClass('_active');
  4225.                     $this.find('.lp-staff-body-items').removeClass('_active').eq($(this).index()).addClass('_active');
  4226.                 });
  4227.    
  4228.                 $this.find('.lp-header-tab').first().addClass('_active');
  4229.                 $this.find('.lp-staff-body-items').first().addClass('_active');
  4230.    
  4231.                 var widthSum = 0;
  4232.                 $this.find('.lp-header-tab').each(function () {
  4233.                     widthSum +=  +$(this).outerWidth(true)
  4234.                 })
  4235.    
  4236.                 if(widthSum > $('.lp-header-tabs').width()) {
  4237.                     baron({
  4238.                         root: '.lp-staff-7-scroll',
  4239.                         scroller: '.lp-staff-7-scroll__inner',
  4240.                         bar: '.lp-staff-7-scroll__bar',
  4241.                         scrollingCls: '_scrolling',
  4242.                         draggingCls: '_dragging',
  4243.                         direction: 'h',
  4244.    
  4245.                     })
  4246.                 }
  4247.            
  4248.             });
  4249.         }
  4250.     }
  4251.    
  4252.     lp_template.queue.lpForm29 = function($self) {
  4253.         var $block = $self.hasClass('lp-form-29') ? $self : $self.find('.lp-form-29');
  4254.  
  4255.         if ($block.length) {
  4256.  
  4257.             $block.each(function() {
  4258.                 var $this = $(this);
  4259.        
  4260.                 try {      
  4261.                         setMinHeight();
  4262.                         $(window).on('resize', function(){
  4263.                         setMinHeight();        
  4264.                     });      
  4265.                 } catch(exception) {
  4266.                     console.log(exception);
  4267.                 }
  4268.                
  4269.                 function setMinHeight() {
  4270.                     if (window.matchMedia('(min-width: 960px)').matches) {
  4271.                         var formHeight = $this.find('.lp-form-29__form').height()
  4272.                         + parseInt($this.find('.lp-form-29__form').css('padding-top'))
  4273.                         + parseInt($this.find('.lp-form-29__form').css('padding-bottom')),
  4274.                         minHeight = formHeight - 160;
  4275.                
  4276.                         $this.find('.lp-form-29__top').css({
  4277.                             minHeight : minHeight          
  4278.                         });
  4279.                        
  4280.                         var topHeight = $this.find('.lp-form-29__top').height();
  4281.                        
  4282.                         if (topHeight > (formHeight + 40)) {
  4283.                             $this.find('.lp-form-29__top').css({'margin-top' : '40px'});
  4284.                         } else {
  4285.                             $this.find('.lp-form-29__top').css({'margin-top' : ''});
  4286.                         }
  4287.                     } else {
  4288.                         $this.find('.lp-form-29__top').css({
  4289.                             minHeight : '',
  4290.                             'margin-top' : ''          
  4291.                         });
  4292.                     }
  4293.                 };
  4294.             });
  4295.         }      
  4296.     };
  4297.    
  4298.     lp_template.queue.lpFeatures29 = function($self) {
  4299.         var $block = $self.find('.lp-features-29-item__percentage');
  4300.         if ($block.length) {
  4301.             function perc() {
  4302.                 $block.each(function(){
  4303.                     var $this = $(this),
  4304.                         $parent = $this.closest('.lp-features-29-item'),
  4305.                         $inner = $parent.find('.lp-features-29-item__field-inner'),
  4306.                         $percent = Number.isNaN(parseInt($this.text())) ? 0 : parseInt($this.text()),
  4307.                         $percent = $percent < 101 ? $percent : 100;
  4308.                    
  4309.                     $inner.css('width', $percent + '%');
  4310.                     $this.text($percent + '%');
  4311.                 });
  4312.             }
  4313.                            
  4314.             if (s3LP.is_cms) {
  4315.                 setTimeout(function(){
  4316.                     LpController.afterSave(function () {
  4317.                         perc();
  4318.                     });
  4319.                 },1000);
  4320.             }
  4321.         }
  4322.     }
  4323.    
  4324.     lp_template.queue.scrollTop = function($self) {
  4325.         var $block = $self.find('.scrollHide');
  4326.         if ($block.length) {
  4327.             var $this = $(this),
  4328.                 $scrollBtn = $self.find('.js-19-elem');
  4329.             $(window).on('scroll', function(){
  4330.                 var $scrollTop = $(this).scrollTop();
  4331.                 if ($scrollTop > 500) {
  4332.                     $scrollBtn.addClass('_show');
  4333.                 }
  4334.                 else {
  4335.                     $scrollBtn.removeClass('_show');
  4336.                 }
  4337.             });
  4338.         }
  4339.     }
  4340.    
  4341.     lp_template.queue.minHeight = function($self) {
  4342.         var $block = $self.find('.js-min-height'),
  4343.             func = function() {
  4344.                 $block.each(function(){
  4345.                     var $this = $(this),
  4346.                         $title = $this.find('.js-item'),
  4347.                         $border = $this.find('._title'),
  4348.                         minWidth = $this.data('min-width') || 0,
  4349.                         minHeight = $title.eq(0).height();
  4350.                        
  4351.                     $border.css({
  4352.                         minHeight: 0
  4353.                     });
  4354.                    
  4355.                     if ($(window).width() >= minWidth) {
  4356.                         $title.each(function(){
  4357.                             var thisHeight = $(this).height();
  4358.                            
  4359.                             if (minHeight > thisHeight) {
  4360.                                 minHeight = thisHeight;
  4361.                             }
  4362.                         });
  4363.                        
  4364.                         $border.css({
  4365.                             minHeight: minHeight
  4366.                         });
  4367.                     }
  4368.                 });
  4369.             };
  4370.            
  4371.         $(window).on('resize', func);
  4372.         if (s3LP.is_cms) {
  4373.             setTimeout(function(){
  4374.                 LpController.afterSave(function () {
  4375.                     func();
  4376.                 });
  4377.             },1000);
  4378.         }
  4379.     }
  4380.    
  4381.     lp_template.queue.animatedAnchor = function($self) {
  4382.         var $block = $self;
  4383.        
  4384.         if ($(".js-19-elem").length) {
  4385.             $block.find(".js-19-elem").on('click touch', function(e){
  4386.                 e.preventDefault();
  4387.                 $('html, body').animate({
  4388.                     scrollTop: $("body").offset().top
  4389.                 }, 2000);
  4390.             });
  4391.         }
  4392.     }
  4393.    
  4394.     lp_template.queue.previewModeIsCms = function($self) {
  4395.         setTimeout(function(){
  4396.             if ($('body').hasClass('preview_mode')) {
  4397.                 $('._is-cms').removeClass('_is-cms');
  4398.             }
  4399.         }, 2000);
  4400.     }
  4401.    
  4402.    
  4403.     lp_template.queue.fixedMenu = function($self) {
  4404.         var $block = $self.hasClass('js-fixed-menu') ? $self : $self.find('.js-fixed-menu');
  4405.         var $fixedElem = $block.find('._fixed-element');
  4406.        
  4407.         $block.data('isFixed', false);
  4408.        
  4409.         $fixedElem = $fixedElem.length ? $fixedElem : $block;
  4410.        
  4411.         $block.each(function(){
  4412.             var $this = $(this);
  4413.            
  4414.             $this.data('topPosition', $this.offset().top);
  4415.         });
  4416.        
  4417.         if ($block.length) {
  4418.             $win.on('scroll', function(e){
  4419.                 $block.each(function(){
  4420.                     var $this = $(this),
  4421.                         isAfterScroll = !!$this.data('after-scroll'),
  4422.                         $thisBurger = $this.find('.js-burger'),
  4423.                         $fixedElem = $this.find('._fixed-element');
  4424.                    
  4425.                     $fixedElem = $fixedElem.length ? $fixedElem : $this;
  4426.                    
  4427.                     var position = $this.data('isFixed') ? $fixedElem[0].parentNode.getBoundingClientRect() : this.getBoundingClientRect();
  4428.                    
  4429.                     if ( !$this.data('isFixed') && ((!isAfterScroll && position.top <= 0) || (isAfterScroll && position.top <= 0 - $this.outerHeight()))) {
  4430.                         if (!s3LP.is_cms) {
  4431.                             $fixedElem.wrap('<div class="fixed-element-wrap"></div>');
  4432.                             $(window).on('resize', function(){
  4433.                                     $fixedElem.closest('.fixed-element-wrap').height($fixedElem.height());
  4434.                             });
  4435.                             $win.trigger('resize');
  4436.                             //$fixedElem.closest('.fixed-element-wrap').height($fixedElem.height());
  4437.                             $fixedElem.addClass('_to-fix-menu');
  4438.                             $this.data('isFixed', true);
  4439.                             if ($thisBurger.hasClass('add_in-side')) $thisBurger.addClass('_in-side');
  4440.                         }
  4441.                     } else if ($this.data('isFixed') && (position.top > 0 || (isAfterScroll && $win.scrollTop() < $this.data('topPosition')))) {
  4442.                         $fixedElem.removeClass('_to-fix-menu');
  4443.                         $this.data('isFixed', false);
  4444.                         $thisBurger.removeClass('_in-side');
  4445.                         $win.trigger('resize');
  4446.                         $fixedElem.unwrap();
  4447.                     }
  4448.                 });
  4449.             }).trigger('scroll');
  4450.         }
  4451.     };
  4452.    
  4453.     lp_template.queue.autoplayVideo = function($self) {
  4454.         var $block = $self.find('[data-autoplay-video="1"]');
  4455.    
  4456.         if ($block.length) {
  4457.            
  4458.             $block.on('autoplayVideo', function(e, type, nodeName) {
  4459.                
  4460.                 var video = this.querySelector(nodeName);
  4461.                 if (nodeName === 'video') {
  4462.                     if (type === 'play') {
  4463.                         video.play();
  4464.                     } else {
  4465.                         video.pause();
  4466.                     }                  
  4467.                 } else if (nodeName === 'iframe') {
  4468.                     var video = $(video).data('youtube');
  4469.                     if (type === 'play') {
  4470.                         setTimeout(function() {
  4471.                         video.playVideo();
  4472.                          }, 500);
  4473.                        
  4474.                     } else {
  4475.                         video.pauseVideo();
  4476.                     }
  4477.                 }
  4478.             });
  4479.         }
  4480.     }
  4481.    
  4482.     window.lp_init = function($block) {
  4483.    
  4484.         var partners_2_img_h = $('.lp-partners_2__list-item').data('image-height');
  4485.         $('.lp-partners_2__list-item').css('height', partners_2_img_h);
  4486.         setTimeout(function() {
  4487.             $('.lp-partners_2__list-item').removeAttr('style');
  4488.         }, 2500);
  4489.    
  4490.         var $autoplayVideo = $doc.find('[data-autoplay-video="1"]');
  4491.         var $maps = $block.find('.js-lp-simple-map');
  4492.  
  4493.         if ($maps.length) {
  4494.           $win.on('scroll', function() {
  4495.             lp_template.checkMapInitialization($maps);
  4496.           });
  4497.         }
  4498.        
  4499.         if ($autoplayVideo.length && !s3LP.is_cms) {
  4500.             $win.on('scroll', function() {
  4501.                 lp_template.checkAutoplayVideo($autoplayVideo);
  4502.             });
  4503.         }
  4504.    
  4505.         Object.keys(lp_template.queue).forEach(function(func) {
  4506.             var thisFunction = lp_template.queue[func];
  4507.             if (typeof thisFunction == 'function') {
  4508.                 thisFunction($block);
  4509.             }
  4510.         });
  4511.        
  4512.         $win.trigger('resize');
  4513.        
  4514.         setTimeout(function() {
  4515.             $win.trigger('resize');
  4516.         }, 700);
  4517.        
  4518.        
  4519.         $.getScript("/g/s3/misc/animator/1.1.0/js/s3.animator.js", function(){
  4520.             $('body').append('<link rel="stylesheet" type="text/css" href="/g/s3/misc/animator/1.0.0/css/s3.animator.scss.css">');
  4521.             s3Animator.once = true;
  4522.         });
  4523.  
  4524.        
  4525.         setTimeout(function() {
  4526.             $win.trigger('scroll');
  4527.         }, 2000);
  4528.        
  4529.     }
  4530.  
  4531.     window.onYouTubeIframeAPIReady = function() {
  4532.         $(function(){
  4533.             var listYoutube = $('.js-lp-video-youtube');
  4534.            
  4535.             listYoutube.each(function(){
  4536.                 var $this = $(this),
  4537.                     isFullFrame = $this.hasClass('_not-paused');
  4538.                
  4539.                 var player = new YT.Player(this.id, {
  4540.                     iv_load_policy: 3,
  4541.                     modestbranding: 1,
  4542.                     rel: 0,
  4543.                     mute: isFullFrame ? 1 : 0,
  4544.                     playsinline: 1,
  4545.                     showinfo: isFullFrame ? 0 : 1,
  4546.                     events: {
  4547.                         'onStateChange': function(event) {
  4548.                             if (event.data == YT.PlayerState.ENDED && isFullFrame) {
  4549.                                 event.target.playVideo();
  4550.                             }
  4551.                         }
  4552.                     }
  4553.                 });
  4554.    
  4555.                 $this.data('youtube', player);
  4556.                
  4557.                 $('.slick-slider').on('beforeChange', function(event, slick, currentSlide, nextSlide){
  4558.                 });
  4559.             });
  4560.         });
  4561.     }
  4562.    
  4563.     function isElementInViewport(el) {
  4564.         var rect = el.getBoundingClientRect();
  4565.         return (
  4566.             rect.top <= window.innerHeight-200 &&
  4567.             rect.bottom >= 50
  4568.         );
  4569.     }
  4570.  
  4571. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement