PageSourceSearch

https://allcorp3-demo.ru/bitrix/templates/aspro-allcorp3/js/general.js

js allcorp3-demo.ru collected 2026-10-09 00:42:10 UTC 195,501 bytes, 5,893 lines download raw bytes

1getRandomInt = function (min, max) {
2  return Math.floor(Math.random() * (max - min)) + min;
3};
4
5ShowOverlay = function () {
6  $('<div class="jqmOverlay waiting"></div>').appendTo("body");
7};
8
9function readyDOM(callback) {
10  if (document.readyState !== "loading") callback();
11  else document.addEventListener("DOMContentLoaded", callback);
12}
13
14if (!$(this).next().hasClass("collapsing"))
15window.addEventListener("popstate", function (event) {
16  if (typeof startActions == "function") {
17    setTimeout(startActions, 500);
18  }
19});
20
21function throttle(f, t) {
22  let throttled, saveThis, saveArgs;
23  const wrapper = function () {
24    if (throttled) {
25      saveThis = this;
26      saveArgs = arguments;
27      return;
28    }
29    throttled = true;
30    f.apply(this, arguments);
31    setTimeout(function () {
32      throttled = false;
33      if (saveArgs) {
34        wrapper.apply(saveThis, saveArgs);
35        saveThis = saveArgs = null;
36      }
37    }, t);
38  };
39  return wrapper;
40}
41
42function debounce(f, t) {
43  return function (args) {
44    var previousCall = this.lastCall;
45    this.lastCall = Date.now();
46    if (previousCall && this.lastCall - previousCall <= t) {
47      clearTimeout(this.lastCallTimer);
48    }
49    this.lastCallTimer = setTimeout(function () {
50      f(args);
51    }, t);
52  };
53}
54
55window.addEventListener("popstate", function (event) {
56  if (typeof startActions == "function") {
57    setTimeout(startActions, 500);
58  }
59});
60
61$(document).on("change", ".uploader input[type=file]", function () {
62  if (!$(this).next().length || !$(this).next().hasClass("resetfile")) {
63    $(
64      '<span class="resetfile" title="' +
65        BX.message("CLEAR_FILE") +
66        '"><svg width="10" height="10" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9 1.00161L1 9M9 9L1 1" stroke="#999999" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></span>'
67    ).insertAfter($(this));
68  }
69});
70
71$(document).on("click", ".uploader .resetfile", function () {
72  var $uploader = $(this).closest(".uploader");
73  $uploader.removeClass("error files_add");
74  $uploader.find(".error").hide();
75
76  var $input = $uploader.find("input[type=file]");
77  $input.val("");
78  $.uniform.update($input);
79
80  $(this).remove();
81});
82
83$(document).on("click", ".region-close", function () {
84  $(".confirm_region").fadeOut();
85});
86
87headerInit = function (targetBlock) {
88  var header = $("header");
89  if (header.length) {
90    setTimeout(function () {
91      CheckTopMenuDotted();
92      CheckTopMenuDotted();
93    }, 1);
94  }
95};
96
97typeofExt = function (item) {
98  const _toString = Object.prototype.toString;
99  return _toString.call(item).slice(8, -1).toLowerCase();
100};
101
102HideOverlay = function () {
103  $(".jqmOverlay").detach();
104  CloseMobilePhone();
105};
106
107if (!funcDefined("pauseYmObserver")) {
108  // pause ya metrika webvisor MutationObserver callback (DOM indexer)
109  // use before insert html with some animation
110  pauseYmObserver = function () {
111    if (
112      typeof MutationObserver === "function" &&
113      typeof MutationObserver.observers === "object" &&
114      typeof MutationObserver.observers.ym === "object"
115    ) {
116      if (typeof pauseYmObserver.cnt === "undefined") {
117        pauseYmObserver.cnt = 0;
118      }
119
120      ++pauseYmObserver.cnt;
121
122      if (!MutationObserver.observers.ym.paused) {
123        MutationObserver.observers.ym.pause();
124      }
125    }
126  };
127}
128
129if (!funcDefined("resumeYmObserver")) {
130  // resume ya metrika webvisor MutationObserver callback
131  // use when animation finished
132  resumeYmObserver = function () {
133    if (
134      typeof MutationObserver === "function" &&
135      typeof MutationObserver.observers === "object" &&
136      typeof MutationObserver.observers.ym === "object"
137    ) {
138      if (typeof pauseYmObserver.cnt === "undefined") {
139        pauseYmObserver.cnt = 1;
140      }
141
142      pauseYmObserver.cnt -= pauseYmObserver.cnt > 0 ? 1 : 0;
143
144      if (!pauseYmObserver.cnt && MutationObserver.observers.ym.paused) {
145        MutationObserver.observers.ym.resume();
146      }
147    }
148  };
149}
150
151if (!funcDefined("declOfNum")) {
152  declOfNum = function (number, titles) {
153    var cases = [2, 0, 1, 1, 1, 2];
154    return number + " " + titles[number % 100 > 4 && number % 100 < 20 ? 2 : cases[Math.min(number % 10, 5)]];
155  };
156}
157
158if (!funcDefined('decodeHtmlEntity')) {
159  decodeHtmlEntity = function(str) {
160    return str.replace(/&#(\d+);/g, function(match, dec) {
161      return String.fromCharCode(dec);
162    });
163  };
164}
165
166if (!funcDefined("togglePropBlock")) {
167  togglePropBlock = function (className) {
168    var all_props_block = className.closest(".bx_filter_parameters_box_container").find(".hidden_values");
169    if (all_props_block.length && (className.hasClass("inner_text") || className.hasClass("expand_block"))) {
170      if (all_props_block.is(":visible")) {
171        className.text(BX.message("FILTER_EXPAND_VALUES"));
172        all_props_block.hide();
173      } else {
174        className.text(BX.message("FILTER_HIDE_VALUES"));
175        all_props_block.show();
176      }
177    }
178  };
179}
180
181/*countdown start*/
182if (!funcDefined("initCountdown")) {
183  var initCountdown = function initCountdown() {
184    $(".countdown:not(.countdown-inited)").each(function () {
185      var _this = $(this);
186
187      if (_this.hasClass("init-if-visible") && !_this.is(":visible")) return;
188      _this.addClass("countdown-inited");
189
190      var activeTo = _this.find(".countdown__active-to").text(),
191        dateTo = new Date(activeTo.replace(/(\d+)\.(\d+)\.(\d+)/, "$3/$2/$1"));
192
193      var checkDate = new Date() < dateTo;
194
195      if (checkDate) {
196        if (_this.hasClass("compact"))
197          _this.find(".countdown__items").countdown(
198            {
199              until: dateTo,
200              format: "dHMS",
201              compact: true,
202              padZeroes: true,
203              layout:
204                '{d<}<span class="days countdown__item">{dn}<div class="text">{dl}</div></span>{d>}<span class="hours countdown__item">{hn}<div class="text">{hl}</div></span><span class="minutes countdown__item">{mn}<div class="text">{ml}</div></span><span class="sec countdown__item">{sn}<div class="text">{sl}</div></span>',
205              onExpiry: onExpiryCountdown,
206            },
207            $.countdown.regionalOptions["ru"]
208          );
209        else
210          _this.find(".countdown__items").countdown(
211            {
212              until: dateTo,
213              format: "dHMS",
214              padZeroes: true,
215              layout:
216                '{d<}<span class="days countdown__item">{dnn}<div class="text">{dl}</div></span>{d>}<span class="hours countdown__item">{hnn}<div class="text">{hl}</div></span><span class="minutes countdown__item">{mnn}<div class="text">{ml}</div></span><span class="sec countdown__item">{snn}<div class="text">{sl}</div></span>',
217              onExpiry: onExpiryCountdown,
218            },
219            $.countdown.regionalOptions["ru"]
220          );
221      } else {
222        _this.hide();
223      }
224    });
225  };
226}
227
228if (!funcDefined("onExpiryCountdown")) {
229  function onExpiryCountdown() {
230    var _this = $(this);
231    var countdownBlock = _this.parents(".countdown");
232
233    if (countdownBlock.length) {
234      countdownBlock.hide();
235    }
236  }
237}
238
239if (!funcDefined("initCountdownTime")) {
240  var initCountdownTime = function initCountdownTime(block, time) {
241    if (time) {
242      var dateTo = new Date(time.replace(/(\d+)\.(\d+)\.(\d+)/, "$3/$2/$1"));
243      block.find(".countdown__items").countdown("destroy");
244      if (block.hasClass("compact"))
245        block.find(".countdown__items").countdown(
246          {
247            until: dateTo,
248            format: "dHM",
249            compact: true,
250            padZeroes: true,
251            layout:
252              '{d<}<span class="days countdown__item">{dn}<div class="text">{dl}</div></span>{d>}<span class="hours countdown__item">{hn}<div class="text">{hl}</div></span><span class="minutes countdown__item">{mn}<div class="text">{ml}</div></span><span class="sec countdown__item">{sn}<div class="text">{sl}</div></span>',
253            onExpiry: onExpiryCountdownTime,
254          },
255          $.countdown.regionalOptions["ru"]
256        );
257      elsecountdown__items;
258      block.find(".countdown__items").countdown(
259        {
260          until: dateTo,
261          format: "dHMS",
262          padZeroes: true,
263          layout:
264            '{d<}<span class="days countdown__item">{dnn}<div class="text">{dl}</div></span>{d>}<span class="hours countdown__item">{hnn}<div class="text">{hl}</div></span><span class="minutes countdown__item">{mnn}<div class="text">{ml}</div></span><span class="sec countdown__item">{snn}<div class="text">{sl}</div></span>',
265          onExpiry: onExpiryCountdownTime,
266        },
267        $.countdown.regionalOptions["ru"]
268      );
269      block.find(".countdown").show();
270    } else {
271      block.find(".countdown").hide();
272    }
273  };
274}
275if (!funcDefined("onExpiryCountdownTime")) {
276  function onExpiryCountdownTime() {}
277}
278/*countdown end*/
279$.fn.iAppear = function (callback, options) {
280  if (typeof $.fn.iAppear.useObserver === "undefined") {
281    $.fn.iAppear.useObserver = typeof window["IntersectionObserver"] === "function";
282
283    if (!$.fn.iAppear.useObserver && typeof $.fn.appear !== "function") {
284      $.fn.iAppear.queue = [];
285      BX.loadScript(arAsproOptions.SITE_TEMPLATE_PATH + "/vendor/js/jquery.appear.js", function () {
286        if (typeof $.fn.iAppear.queue === "object") {
287          $.fn.iAppear.queue.forEach(function (queueItem) {
288            $(queueItem.items).iAppear(queueItem.callback, queueItem.options);
289          });
290        }
291      });
292
293      return;
294    }
295  }
296
297  if ($.fn.iAppear.useObserver) {
298    var options = $.extend(
299      {
300        root: null,
301        rootMargin: "150px 0px 150px 0px",
302        threshold: 0.0,
303      },
304      options
305    );
306
307    $(this).each(function (i, appearBlock) {
308      var observer = new IntersectionObserver(function (entries, observer) {
309        entries.forEach(function (element) {
310          if (element.intersectionRatio > 0 && !element.target.dataset.iAppeared) {
311            element.target.dataset.iAppeared = true;
312
313            if (typeof callback === "function") {
314              callback.call(element.target);
315            }
316          }
317        });
318      }, options);
319
320      observer.observe(appearBlock);
321    });
322  } else {
323    if (typeof $.fn.appear !== "function") {
324      if ($(this).length) {
325        $.fn.iAppear.queue.push({
326          items: this,
327          callback: callback,
328          options: options,
329        });
330      }
331
332      return;
333    } else {
334      if ($(this).length) {
335        $(this).each(function (i, appearBlock) {
336          $(appearBlock).appear(function () {
337            if (typeof callback === "function") {
338              callback.call(appearBlock);
339            }
340          }, options);
341        });
342      }
343    }
344  }
345};
346
347$.fn.mCustomScrollbarDeferred = function (config) {
348  $(this).addClass("scroll-init");
349  $(this).data("plugin-options", config);
350
351  if ($(this).hasClass("destroyed")) {
352    return;
353  }
354
355  $(this).hover(
356    function (e) {
357      var $this = $(this);
358      if (!$this.hasClass("mCustomScrollbar") && !$(this).hasClass("destroyed")) {
359        $this.data(
360          "scrollTimer",
361          setTimeout(function () {
362            $this.mCustomScrollbar(config);
363            $this.off("touchstart touchmove touchend mousewheel mouseenter mouseleave");
364          }, 200)
365        );
366      }
367    },
368    function (e) {
369      clearTimeout($(this).data("scrollTimer"));
370    }
371  );
372
373  $(this).on("touchstart touchmove", function (e) {
374    var $this = $(this);
375    if (!$this.hasClass("mCustomScrollbar") && !$(this).hasClass("destroyed")) {
376      $this.mCustomScrollbar(config);
377    }
378
379    var $scrollContainer = $this.find(">.mCustomScrollBox>.mCSB_container");
380    if ($scrollContainer.length) {
381      var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
382
383      var newTouch = new Touch({
384        identifier: 42,
385        target: $scrollContainer[0],
386        clientX: touch.clientX,
387        clientY: touch.clientY,
388        screenX: touch.screenX,
389        screenY: touch.screenY,
390        pageX: touch.pageX,
391        pageY: touch.pageY,
392        radiusX: 1,
393        radiusY: 1,
394      });
395
396      var newEvent = new TouchEvent(e.type, {
397        cancelable: true,
398        bubbles: false,
399        composed: true,
400        touches: [newTouch],
401        targetTouches: [newTouch],
402        changedTouches: [newTouch],
403      });
404
405      $scrollContainer[0].dispatchEvent(newEvent);
406    }
407  });
408
409  $(this).on("touchend", function (e) {
410    $(this).off("touchstart touchmove touchend mousewheel mouseenter mouseleave");
411  });
412
413  if ($.event.special.mousewheel) {
414    $(this).on("mousewheel", function (e) {
415      var $this = $(this);
416      if (!$this.hasClass("mCustomScrollbar") && !$(this).hasClass("destroyed")) {
417        $this.mCustomScrollbar(config);
418        $this.off("touchstart touchmove touchend mousewheel mouseenter mouseleave");
419      }
420    });
421  }
422};
423
424InitScrollBar = function (el, initOptions) {
425  var block;
426  if (typeof el === "undefined") {
427    block = $(".srollbar-custom:not(.mobile-scroll):not(.scroll-init)");
428  } else {
429    block = el.filter(":not(.scroll-init)");
430  }
431  var blockParent = $(".scrollbar-parent");
432
433  if (
434    (block.length || blockParent.length) &&
435    !isMobile
436    // (!isMobile || window.matchMedia('(min-width:992px)').matches)
437  ) {
438    block.addClass("scroll-init");
439
440    var options,
441      defaults = {
442        mouseWheel: {
443          scrollAmount: 150,
444          preventDefault: true,
445        },
446      };
447    if (block.length) {
448      var config = $.extend({}, defaults, options, block.data("plugin-options"), initOptions);
449    } else if (blockParent.length) {
450      var config = $.extend({}, defaults, options, blockParent.data("plugin-options"), initOptions);
451    }
452
453    config.callbacks = {
454      onScroll: function () {
455        if ($(this).find(".mCSB_buttonLeft").hasClass("disabled"))
456          $(this).find(".mCSB_buttonLeft").removeClass("disabled");
457        if ($(this).find(".mCSB_buttonRight").hasClass("disabled"))
458          $(this).find(".mCSB_buttonRight").removeClass("disabled");
459      },
460      onTotalScrollBack: function () {
461        $(this).find(".mCSB_buttonLeft").addClass("disabled");
462      },
463      onTotalScroll: function () {
464        $(this).find(".mCSB_buttonRight").addClass("disabled");
465      },
466      onInit: function () {
467        $(this).find(".mCSB_buttonLeft").addClass("disabled");
468      },
469    };
470
471    if (block.length) {
472      block.filter(":not(.scroll-deferred)").mCustomScrollbar(config);
473      block.filter(".scroll-deferred").mCustomScrollbarDeferred(config);
474    }
475
476    if (blockParent.length) {
477      blockParent.find(".scroll-deferred").mCustomScrollbarDeferred(config);
478    }
479  }
480};
481
482InitCustomScrollBar = function (el) {
483  var block;
484  if (typeof el === "undefined") {
485    block = $(".scrollbar:not(.mobile-scroll):not(.scroll-init)");
486  } else {
487    block = el.filter(":not(.scroll-init)");
488  }
489
490  if (block.length) {
491    block.addClass("scroll-init");
492
493    var options,
494      defaults = {
495        effect: "fadeIn",
496        effectTime: 300,
497        threshold: 0,
498        // threshold: 30
499      };
500
501    var config = $.extend({}, defaults, options, block.data("plugin-options"));
502
503    block.filter(":not(.scroll-deferred)").mCustomScrollbar(config);
504    block.filter(".scroll-deferred").mCustomScrollbarDeferred(config);
505  }
506};
507
508/* slider gallery for fancybox */
509const InitFancyboxThumbnailsGallery = function (instance) {
510	const bUseThumbs = instance.group[0].opts.$orig[0].classList.contains('fancy-thumbs') && instance.group.length > 1;
511	if (bUseThumbs)
512		instance.Thumbs.show();
513	else
514		return;
515
516	if (
517		bUseThumbs &&
518		$(".fancybox-thumbs") &&
519		$(".fancybox-thumbs__list a").length > 1 &&
520		!$(".fancybox-thumbs .swiper").length &&
521		typeof initSwiperSlider === "function"
522	) {
523		instance.Thumbs.$grid.find(".fancybox-thumbs__list a").each(function (i, el) {
524			$(el).css("background-image", "url(\"" + location.origin + encodeURI(instance.group[i].src) + "\")");
525		});
526		const SLIDER_RESIZE_BREAKPOINT = 600;
527		const $thumbsContainer = $(".fancybox-thumbs");
528		const $swiperSlides = $(".fancybox-thumbs__list a");
529		const $swiperWrapper = $(".fancybox-thumbs__list");
530		const sliderDirection = (window.innerWidth >= SLIDER_RESIZE_BREAKPOINT ? 'vertical' : 'horizontal');
531
532		const options = {
533			centerInsufficientSlides: true,
534			direction: sliderDirection,
535			mousewheelControl: true,
536			slidesPerView: 'auto',
537			spaceBetween: 16,
538			watchSlidesProgress: true,
539		};
540
541		options.navigation = {
542			nextEl: ".fancybox-thumbs__wrapper .swiper-button-next",
543			prevEl: ".fancybox-thumbs__wrapper .swiper-button-prev",
544		};
545
546		$('.fancybox-container').addClass('detail-gallery-big--vertical with-slider');
547		$('.fancybox-inner').addClass('with-slider');
548		$thumbsContainer.addClass('detail-gallery-big-slider-thumbs with-slider');
549		$thumbsContainer.wrapInner(
550			`<div class='fancybox-thumbs__wrapper gallery-slider-thumb__container'>
551        <div class='swiper slider-solution' data-plugin-options='`+ JSON.stringify(options) + `'/>
552      </div>`
553		);
554		const $swiperContainerWrapper = $('.fancybox-thumbs__wrapper');
555
556		$swiperContainerWrapper.append(
557			`<div class='gallery-slider-thumb-button gallery-slider-thumb-button--next slider-nav slider-nav--no-auto-hide swiper-button-next'>
558        <i class='svg inline stroke-dark-light'><svg width='7' height='12'><use xlink:href='`+ arAsproOptions.SITE_TEMPLATE_PATH + `/images/svg/arrows.svg#right-hollow'></use></svg></i>
559      </div>`
560		);
561		$swiperContainerWrapper.prepend(
562			`<div class='gallery-slider-thumb-button gallery-slider-thumb-button--prev slider-nav slider-nav--no-auto-hide swiper-button-prev'>
563        <i class='svg inline stroke-dark-light'><svg width='7' height='12'><use xlink:href='`+ arAsproOptions.SITE_TEMPLATE_PATH + `/images/svg/arrows.svg#left-hollow'></use></svg></i>
564      </div>`
565		);
566
567		$swiperWrapper.addClass('fancybox-thumb__list--slider-wrapper swiper-wrapper gallery__thumb-wrapper');
568		$swiperSlides.addClass('swiper-slide gallery__item gallery__item--thumb rounded-4 pointer');
569		$swiperSlides.each(function () {
570			const background = $(this).css('background-image').replace(/url\(|\"|\'|\)/g, '');
571			$(this).css('background-image', '');
572			$(this).wrapInner("<img src='" + background + "' class='rounded-4' alt='' title='' />");
573		})
574
575		initSwiperSlider();
576
577		const swiper = $thumbsContainer.find('.swiper').data('swiper');
578		swiper.slideTo(instance.curPos, 10);
579		swiper.on('resize', function () {
580			if (window.innerWidth >= SLIDER_RESIZE_BREAKPOINT && options.direction === 'horizontal') {
581				options.direction = 'vertical';
582				swiper.changeDirection(options.direction, false);
583				swiper.update();
584			} else if (window.innerWidth < SLIDER_RESIZE_BREAKPOINT && options.direction === 'vertical') {
585				options.direction = 'horizontal';
586				swiper.changeDirection(options.direction, false);
587				swiper.update();
588			}
589		})
590	}
591}
592/** */
593
594InitFancyBox = function () {
595  if (typeof $.fn.fancybox !== "function") {
596    return;
597  }
598
599  if (!$(".fancy").length) {
600    return;
601  }
602
603  $(".fancy").fancybox({
604    padding: [40, 40, 64, 40],
605    openEffect: "fade",
606    closeEffect: "fade",
607    nextEffect: "fade",
608    prevEffect: "fade",
609    opacity: true,
610    tpl: {
611      closeBtn:
612        '<span title="' +
613        BX.message("FANCY_CLOSE") +
614        '" class="fancybox-item fancybox-close inline svg"><svg class="svg svg-close" width="14" height="14" viewBox="0 0 14 14"><path data-name="Rounded Rectangle 568 copy 16" d="M1009.4,953l5.32,5.315a0.987,0.987,0,0,1,0,1.4,1,1,0,0,1-1.41,0L1008,954.4l-5.32,5.315a0.991,0.991,0,0,1-1.4-1.4L1006.6,953l-5.32-5.315a0.991,0.991,0,0,1,1.4-1.4l5.32,5.315,5.31-5.315a1,1,0,0,1,1.41,0,0.987,0.987,0,0,1,0,1.4Z" transform="translate(-1001 -946)"></path></svg></span>',
615      next:
616        '<a title="' +
617        BX.message("FANCY_NEXT") +
618        '" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
619      prev:
620        '<a title="' +
621        BX.message("FANCY_PREV") +
622        '" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>',
623    },
624    touch: "enabled",
625    buttons: [
626      //"zoom",
627      //"share",
628      // "slideShow",
629      //"fullScreen",
630      //"download",
631      //"thumbs",
632      "close",
633    ],
634    backFocus: false,
635    onActivate: function (instance) {
636			InitFancyboxThumbnailsGallery(instance);
637		},
638    beforeShow: function (event) {
639      if ($(".fancybox-thumbs .swiper").length) {
640				const swiper = $(".fancybox-thumbs .swiper").data("swiper");
641
642				if (typeof event.current !== 'undefined') {
643					swiper.slideTo(event.current.index);
644				}
645			}
646      var bCurrentSrc =
647        typeof event.current !== "undefined" && event.current.contentType == "html" && $(event.current.src).length;
648      var video_block = [];
649
650      if (bCurrentSrc) {
651        video_block = $(event.current.src).find("source.video-content");
652      }
653      // else {
654      //   video_block = $(".company-item source.video-content");
655      // }
656      if (video_block.length) {
657        if (video_block.attr("src") == "#") {
658          var video_block_wrapper = video_block.closest("video");
659          var video_block_clone = video_block_wrapper.clone();
660
661          video_block_clone.find("source").attr("src", video_block_clone.find("source").data("src"));
662          video_block.attr("src", video_block.data("src"));
663          video_block_clone.insertAfter(video_block_wrapper);
664          video_block_clone.siblings("video").remove();
665        }
666      }
667      var video_block_frame = [];
668      if (bCurrentSrc) {
669        video_block_frame = $(event.current.src).find(".company-item__video-iframe");
670      }
671      // else {
672      //   video_block_frame = $(".company-item .company-item__video-iframe");
673      // }
674      if (video_block_frame.length) {
675        var data_src_iframe = video_block_frame.attr("data-src");
676        video_block_frame.attr("src", data_src_iframe);
677        video_block_frame.attr("allow", "autoplay");
678      }
679    },
680    afterShow: function (event) {
681      if ($(".fancybox-overlay").css("opacity") == 0) {
682        setTimeout(function () {
683          $(".fancybox-overlay").css("opacity", 1);
684          $("html").addClass("overflow_html");
685        }, 200);
686      }
687
688      $(".fancybox-nav").css("opacity", 0);
689      setTimeout(function () {
690        $(".fancybox-nav").css("opacity", 1);
691      }, 150);
692
693      var bCurrentSrc =
694        typeof event.current !== "undefined" && event.current.contentType == "html" && $(event.current.src).length;
695      var companyVideo = [];
696      if (bCurrentSrc) {
697        companyVideo = event.current.src[0].getElementsByClassName("company-item__video");
698      }
699      // else {
700      //   companyVideo = $(".fancybox-inner .company-item__video");
701      // }
702      if (companyVideo.length) {
703        setTimeout(function () {
704          $(".fancybox-wrap video").resize();
705          setTimeout(function () {
706            $(".fancybox-wrap").addClass("show_video");
707            if (companyVideo[0].currentTime === 0 || companyVideo[0].paused) {
708              companyVideo[0].currentTime = 0;
709              companyVideo[0].play();
710            }
711          }, 300);
712        }, 150);
713      } else if ($(".fancybox-wrap iframe").length) {
714        $(".fancybox-inner").height("100%");
715      }
716    },
717    beforeClose: function (event) {
718      // closeModal();
719      $(".fancybox-overlay").fadeOut();
720      var bCurrentSrc =
721        typeof event.current !== "undefined" && event.current.contentType == "html" && $(event.current.src).length;
722      var companyVideo = [];
723      if (bCurrentSrc) {
724        companyVideo = event.current.src[0].getElementsByClassName("company-item__video");
725      }
726      // else {
727      //   companyVideo = $(".fancybox-inner .company-item__video");
728      // }
729      if (companyVideo.length) {
730        companyVideo[0].currentTime = 0;
731      }
732
733      $("html").removeClass("overflow_html");
734      var video_block_frame = [];
735      if (bCurrentSrc) {
736        video_block_frame = $(event.current.src).find(".company-item__video-iframe");
737      }
738      // else {
739      //   video_block_frame = $(".company-item .company-item__video-iframe");
740      // }
741      if (video_block_frame.length) {
742        video_block_frame.attr("src", "");
743      }
744    },
745    onClosed: function (event) {
746      var companyVideo = [];
747      if (bCurrentSrc) {
748        companyVideo = event.current.src[0].getElementsByClassName("company-item__video");
749      }
750      // else {
751      //   companyVideo = $(".fancybox-wrap .company-item__video");
752      // }
753      if (companyVideo.length) {
754        companyVideo[0].pause();
755      }
756    },
757  });
758};
759
760InitFancyBoxVideo = function () {
761  if (typeof $.fn.fancybox !== "function") {
762    return;
763  }
764
765  if (!$(".video_link").length) {
766    return;
767  }
768
769  $(".video_link").fancybox({
770    type: "iframe",
771		iframe: {
772			preload: false,
773		},
774    maxWidth: 800,
775    maxHeight: 600,
776    fitToView: false,
777    width: "70%",
778    height: "70%",
779    autoSize: false,
780    closeClick: false,
781    opacity: true,
782    tpl: {
783      closeBtn:
784        '<span title="' +
785        BX.message("FANCY_CLOSE") +
786        '" class="fancybox-item fancybox-close inline svg"><svg class="svg svg-close" width="14" height="14" viewBox="0 0 14 14"><path data-name="Rounded Rectangle 568 copy 16" d="M1009.4,953l5.32,5.315a0.987,0.987,0,0,1,0,1.4,1,1,0,0,1-1.41,0L1008,954.4l-5.32,5.315a0.991,0.991,0,0,1-1.4-1.4L1006.6,953l-5.32-5.315a0.991,0.991,0,0,1,1.4-1.4l5.32,5.315,5.31-5.315a1,1,0,0,1,1.41,0,0.987,0.987,0,0,1,0,1.4Z" transform="translate(-1001 -946)"></path></svg></span>',
787      next:
788        '<a title="' +
789        BX.message("FANCY_NEXT") +
790        '" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
791      prev:
792        '<a title="' +
793        BX.message("FANCY_PREV") +
794        '" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>',
795    },
796    beforeShow: function (event) {
797      /*if(!$('.cd-modal-bg').hasClass('is-visible')){
798				var scaleValue = retrieveScale($('.cd-modal-bg'));
799
800				$('.cd-modal-bg').show().addClass('is-visible').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(){
801					animateLayer($('.cd-modal-bg'), scaleValue, true);
802				});
803			}*/
804    },
805    afterShow: function () {
806      if ($(".fancybox-overlay").css("opacity") == 0) {
807        setTimeout(function () {
808          $(".fancybox-overlay").css("opacity", 1);
809          $("html").addClass("overflow_html");
810        }, 200);
811      }
812
813      $(".fancybox-nav").css("opacity", 0);
814      setTimeout(function () {
815        $(".fancybox-nav").css("opacity", 1);
816      }, 150);
817      if ($(".fancybox-wrap iframe").length) {
818        $(".fancybox-inner").height("100%");
819      }
820    },
821    beforeClose: function () {
822      // closeModal();
823      $(".fancybox-overlay").fadeOut();
824      $("html").removeClass("overflow_html");
825    },
826  });
827};
828
829/*function CheckTopMenuDotted() {
830  var menu = $("nav.mega-menu.sliced");
831  if (window.matchMedia("(max-width:991px)").matches) return;
832
833  if (menu.length) {
834    menu.each(function () {
835      var menuMoreItem = $(this).find(".header-menu__item--more-items");
836      if ($(this).parents(".collapse").css("display") == "none") {
837        return false;
838      }
839
840      var headerFixedBlock = $(this).parents("#headerfixed");
841      if (headerFixedBlock.length && !headerFixedBlock.hasClass("fixed")) {
842        return false;
843      }
844
845      var block = $(this).closest(".header-menu");
846      var block_w = block.outerWidth();
847      var items = $(this).find(".header-menu__wrapper > .header-menu__item");
848      var menu_w = 0;
849      items.each(function (i, el) {
850        var _el = $(el);
851        menu_w += _el.outerWidth(true);
852      });
853
854      var afterHide = false;
855      var newItemsArr = [];
856      menuItemNewSave = "";
857
858      while (menu_w > block_w - 1) {
859        menuItemOldSave = $(this)
860          .find(".header-menu__wrapper > .header-menu__item")
861          .not(".header-menu__item--more-items")
862          .last();
863
864        if (menuItemOldSave.length) {
865          var classes = menuItemOldSave.attr("class");
866          var newMenuItem = $("<li />").addClass(classes).attr("data-hidewidth", menu_w).html(menuItemOldSave.html());
867          newItemsArr.push(newMenuItem);
868
869          menuItemOldSave.remove();
870
871          menuMoreItem.css({
872            display: "flex",
873            opacity: 1,
874          });
875
876          menu_w = 0;
877          items.each(function (i, el) {
878            var _el = $(el);
879            menu_w += _el.outerWidth(true);
880          });
881          block_w = block.outerWidth();
882          afterHide = true;
883        } else {
884          break;
885        }
886      }
887
888      newItemsArr = newItemsArr.reverse();
889      menuMoreItem.find("> .header-menu__dropdown-menu").prepend(newItemsArr);
890
891      if (!afterHide) {
892        var moreItemsArr = [];
893        do {
894          menuItemOldSave = menuMoreItem.find("> .header-menu__dropdown-menu > li").first();
895          if (!menuItemOldSave.length) {
896            menuMoreItem.hide();
897            break;
898          } else {
899            var hideWidth = menuItemOldSave.attr("data-hidewidth");
900            if (hideWidth > block_w) {
901              break;
902            } else {
903              menuItemOldSave.removeClass("scroll-inited");
904              var classes = menuItemOldSave.attr("class");
905              var moreMenuItem = $("<div />
905").addClass(classes).html(menuItemOldSave.html());
906
907              menuItemOldSave.remove();
908              $(moreMenuItem).insertBefore(menuMoreItem);
909              if (!menuItemOldSave.length) {
910                menuMoreItem.hide();
911                break;
912              }
913            }
914          }
915
916          menu_w = 0;
917          items.each(function (i, el) {
918            var _el = $(el);
919            menu_w += _el.outerWidth();
920          });
921        } while (menu_w <= block_w);
922      }
923
924      menu.closest(".header-menu").addClass("dotted-complete");
925      var wrapper = $(this).closest(".hide-dotted");
926      if (wrapper.length) {
927        wrapper.addClass("dotted-complete");
928      }
929    });
930  }
931  return false;
932};
933*/
934
935CheckTopVisibleMenu = function (that) {
936  var dropdownMenu = $(that).find(">.header-menu__dropdown-menu");
937
938  if (!dropdownMenu.length) {
939    dropdownMenu = $(that).find(">.header-menu__wide-item-wrapper>.header-menu__wide-submenu");
940  }
941  if (!dropdownMenu.length) {
942    dropdownMenu = $(that).find(">.header-menu__wide-submenu-item-inner>.submenu-wrapper>.header-menu__wide-submenu");
943  }
944
945  if (!dropdownMenu.length) {
946    return;
947  }
948
949  // if( that !== undefined ) {
950  // 	dropdownMenu.push($(that));
951  // }
952
953  if (dropdownMenu.length) {
954    dropdownMenu.each(function (i, el) {
955      var dropdownMenuCurrent = $(el);
956      dropdownMenuCurrent.find("a").css("white-space", "");
957      dropdownMenuCurrent.css("left", "");
958      dropdownMenuCurrent.css("right", "");
959      dropdownMenuCurrent.removeClass("toright");
960
961      var dropdownMenuCurrent_left = dropdownMenuCurrent.offset().left;
962
963      if (typeof dropdownMenuCurrent_left != "undefined") {
964        var menu = dropdownMenuCurrent.parents(".header__main-part");
965        if (!menu.length) menu = dropdownMenuCurrent.closest(".header__top-inner");
966        var menu_width = menu.outerWidth();
967        var menu_left = menu.offset().left;
968        var menu_right = menu_left + menu_width;
969        var isToRight = dropdownMenuCurrent.parents(".toright").length > 0;
970        var parentsdropdownMenuCurrents = dropdownMenuCurrent.parents(".header-menu__dropdown-menu");
971        var isHasParentdropdownMenuCurrent = parentsdropdownMenuCurrents.length > 0;
972        if (isHasParentdropdownMenuCurrent) {
973          var parentdropdownMenuCurrent_width = parentsdropdownMenuCurrents.first().outerWidth()
974            ? parentdropdownMenuCurrent_width
975            : 240;
976          var parentdropdownMenuCurrent_left = parentsdropdownMenuCurrents.first().offset().left;
977          var parentdropdownMenuCurrent_right = parentdropdownMenuCurrent_width + parentdropdownMenuCurrent_left;
978        }
979
980        var emptyCurrentWidth = dropdownMenuCurrent.outerWidth() == 0;
981
982        var dropdownMenuCurrent_width = !emptyCurrentWidth ? dropdownMenuCurrent.outerWidth() : 240;
983
984        if (parentdropdownMenuCurrent_right + dropdownMenuCurrent_width > menu_right) {
985          dropdownMenuCurrent.find("a").css("white-space", "normal");
986        }
987
988        var dropdownMenuCurrent_right = dropdownMenuCurrent_left + dropdownMenuCurrent_width;
989
990        if (dropdownMenuCurrent_right > menu_right || isToRight) {
991          var addleft = 0;
992          addleft = menu_right - dropdownMenuCurrent_right;
993          if (isHasParentdropdownMenuCurrent || isToRight) {
994            dropdownMenuCurrent.css("left", "auto");
995            dropdownMenuCurrent.css("right", "100%");
996            dropdownMenuCurrent.addClass("toright");
997          } else {
998            var dropdownMenuCurrent_curLeft = parseInt(dropdownMenuCurrent.css("left"));
999            dropdownMenuCurrent.css("left", dropdownMenuCurrent_curLeft + addleft + "px");
1000          }
1001        }
1002        var firstMenuItem = dropdownMenuCurrent.parent().hasClass("header-menu__item--first");
1003        if (!firstMenuItem) {
1004          if (dropdownMenuCurrent_right < 240 + menu_left) {
1005            dropdownMenuCurrent.css("left", "100%");
1006            dropdownMenuCurrent.css("right", "0");
1007            dropdownMenuCurrent.removeClass("toright");
1008          }
1009          var childDropDown = dropdownMenuCurrent.find(">.dropdown");
1010          if (childDropDown.length) {
1011            childDropDown.css("left", "");
1012            childDropDown.css("right", "");
1013          }
1014          /*if (emptyCurrentWidth && childDropDown.length && dropdownMenuCurrent_right < 0 + menu_left) {
1015            dropdownMenuCurrent.css("left", "100%");
1016            dropdownMenuCurrent.css("right", "0");
1017            dropdownMenuCurrent.removeClass("toright");
1018            // childDropDown.css("left", "100%");
1019            // childDropDown.css("right", "0");
1020          }*/
1021        }
1022      }
1023    });
1024  }
1025};
1026
1027MegaMenuFixed = function () {
1028  var animationTime = 150;
1029  $megaFixedNlo = $(".mega-fixed-menu").find("[data-nlo]");
1030
1031  $(document).on("click", ".header .burger", function () {
1032    if ($megaFixedNlo.length) {
1033      if (!$megaFixedNlo.hasClass("nlo-loadings")) {
1034        $megaFixedNlo.addClass("nlo-loadings");
1035        setTimeout(function () {
1036          $.ajax({
1037            data: { nlo: $megaFixedNlo.attr("data-nlo") },
1038            error: function () {
1039              $megaFixedNlo.removeClass("nlo-loadings");
1040            },
1041            complete: function (jqXHR, textStatus) {
1042              if (textStatus === "success" || jqXHR.status == 404) {
1043                var ob = BX.processHTML($.trim(jqXHR.responseText));
1044                BX.ajax.processScripts(ob.SCRIPT);
1045                $megaFixedNlo.replaceWith(ob.HTML);
1046              }
1047            },
1048          });
1049        }, 300);
1050      }
1051    }
1052
1053    $("body").css("overflow", "hidden");
1054    $(".mega-fixed-menu").fadeIn(animationTime);
1055    $(".mega-fixed-menu").css("display", "flex");
1056  });
1057
1058  $(".mega-fixed-menu__close").on("click", function () {
1059    $(this).closest(".mega-fixed-menu").fadeOut(animationTime);
1060    //$("body").css("overflow", "auto");
1061    $("body").css("overflow", "");
1062  });
1063
1064  $(".mega-fixed-menu .dropdown-menu .arrow").on("click", function (e) {
1065    e.preventDefault();
1066    e.stopPropagation();
1067    $(this).closest(".dropdown-submenu").find(".dropdown-menu").slideToggle(animationTime);
1068    $(this).closest(".dropdown-submenu").addClass("opened");
1069  });
1070};
1071
1072CheckMainBannerSliderVText = function (slider) {
1073  /*if(slider.parents('.banners-big').length){
1074		var sh = slider.height();
1075		slider.find('.item').each(function() {
1076			var curSlideTextInner = $(this).find('.text .inner');
1077			if(curSlideTextInner.length){
1078				var ith = curSlideTextInner.actual('height');
1079				var p = (ith >= sh ? 0 : Math.floor((sh - ith) / 2));
1080				curSlideTextInner.css('padding-top', p + 'px');
1081			}
1082		});
1083	}*/
1084};
1085
1086footerInit = function (block) {
1087  if (block.hasClass("check-visible")) {
1088    const blockJsPadding = $(".js-check-padding");
1089    const blockJsHide = $(".js-check-hide");
1090
1091    if (blockJsPadding.length && blockJsHide.length && block.data("ajax-check-visible")) {
1092      const arCheckBlock = block.data("ajax-check-visible").split(",");
1093      let bHiddenBlocks = arCheckBlock.every(function (i) {
1094        return $('[data-ajax-load-block="' + i + '"]').hasClass("hidden") === true;
1095      });
1096
1097      if (bHiddenBlocks) {
1098        blockJsHide.addClass("hidden");
1099        blockJsPadding.addClass("js-padding");
1100      } else {
1101        blockJsHide.removeClass("hidden");
1102        blockJsPadding.removeClass("js-padding");
1103      }
1104    }
1105  }
1106};
1107
1108verticalAlign = function (class_name) {
1109  if (typeof class_name == "undefined") class_name = "auto_align";
1110  if ($("." + class_name).length) {
1111    maxHeight = 0;
1112    $("." + class_name).each(function () {
1113      if ($(this).height() > maxHeight) {
1114        maxHeight = $(this).height();
1115      }
1116    });
1117    $("." + class_name).each(function () {
1118      delta = Math.round((maxHeight - $(this).height()) / 2);
1119      $(this).css({ "padding-top": delta + "px", "padding-bottom": delta + "px" });
1120    });
1121  }
1122};
1123
1124getGridSize = function (counts, custom_counts) {
1125  var z = parseInt($(".body_media").css("top"));
1126  if (typeof custom_counts != "undefined") {
1127    if (window.matchMedia("(max-width: 700px)").matches) return counts[3] ? counts[3] : counts[2];
1128    else if (window.matchMedia("(max-width: 850px)").matches) return counts[2];
1129    else if (window.matchMedia("(max-width: 1100px)").matches) return counts[1];
1130    else return counts[0];
1131  } else {
1132    if (window.matchMedia("(max-width: 600px)").matches) {
1133      return counts[3] ? counts[3] : counts[2];
1134    } else return z == 2 ? counts[0] : z == 1 ? counts[1] : counts[2];
1135  }
1136};
1137
1138CheckFlexSlider = function () {
1139  $(".flexslider:not(.thmb):visible").each(function () {
1140    var slider = $(this);
1141    slider.resize();
1142    var counts = slider.data("flexslider").vars.counts,
1143      slide_counts = slider.data("flexslider").vars.slide_counts;
1144    if (typeof counts != "undefined") {
1145      var cnt = getGridSize(counts, slider.data("flexslider").vars.customGrid);
1146      var to0 =
1147        cnt != slider.data("flexslider").vars.minItems ||
1148        cnt != slider.data("flexslider").vars.maxItems ||
1149        cnt != slider.data("flexslider").vars.move;
1150      if (to0) {
1151        slider.data("flexslider").vars.minItems = cnt;
1152        slider.data("flexslider").vars.maxItems = cnt;
1153        if (typeof slide_counts != "undefined") slider.data("flexslider").vars.move = slide_counts;
1154        else slider.data("flexslider").vars.move = cnt;
1155
1156        slider.flexslider(0);
1157        slider.resize();
1158        slider.resize(); // twise!
1159      }
1160    }
1161  });
1162};
1163
1164CheckHeaderFixed = function () {
1165  var header = $("header .header__inner").first(),
1166    header_fixed = $("#headerfixed");
1167
1168  if (header_fixed.length) {
1169    if (header.length) {
1170      var isHeaderFixed = false,
1171        headerCanFix = true,
1172        headerFixedHeight = header_fixed.actual("outerHeight"),
1173        headerNormalHeight = header.actual("outerHeight"),
1174        headerDiffHeight = headerNormalHeight - headerFixedHeight,
1175        mobileBtnMenu = $(".btn.btn-responsive-nav"),
1176        headerTop = $("#panel:visible").actual("outerHeight"),
1177        topBlock = $(".TOP_HEADER").first(),
1178        $headerFixedNlo = header_fixed.find("[data-nlo]"),
1179        $eyedPanel = $("#eyed-panel"),
1180        isNloLoaded = !$headerFixedNlo.length,
1181        OnHeaderFixedScrollHandler;
1182
1183      if (headerDiffHeight <= 0) headerDiffHeight = 0;
1184      if ($eyedPanel.length) headerTop += $eyedPanel.actual("outerHeight");
1185
1186      if (topBlock.length) headerTop += topBlock.actual("outerHeight");
1187
1188      $(window).scroll(
1189        (OnHeaderFixedScrollHandler = function () {
1190          var scrollTop = $(window).scrollTop();
1191          headerCanFix = !mobileBtnMenu.is(":visible");
1192
1193          if (!isHeaderFixed) {
1194            if (headerCanFix && scrollTop > headerNormalHeight + headerTop) {
1195              if (!isNloLoaded) {
1196                if (!$headerFixedNlo.hasClass("nlo-loadings")) {
1197                  $headerFixedNlo.addClass("nlo-loadings");
1198                  setTimeout(function () {
1199                    $.ajax({
1200                      data: { nlo: $headerFixedNlo.attr("data-nlo") },
1201                      error: function () {
1202                        $headerFixedNlo.removeClass("nlo-loadings");
1203                      },
1204                      complete: function (jqXHR, textStatus) {
1205                        if (textStatus === "success" || jqXHR.status == 404) {
1206                          // stop ya metrika webvisor DOM indexer
1207                          pauseYmObserver();
1208
1209                          isNloLoaded = true;
1210                          var ob = BX.processHTML($.trim(jqXHR.responseText));
1211                          BX.ajax.processScripts(ob.SCRIPT);
1212                          $headerFixedNlo.replaceWith(ob.HTML);
1213
1214                          OnHeaderFixedScrollHandler();
1215
1216                          // resume ya metrika webvisor
1217                          // (300ms transition) + (100ms scroll handler)
1218                          setTimeout(resumeYmObserver, 400);
1219                        }
1220                      },
1221                    });
1222                  }, 300);
1223                }
1224              } else {
1225                isHeaderFixed = true;
1226                header_fixed.css("top", "-" + headerNormalHeight + "px");
1227                header_fixed.addClass("fixed");
1228
1229                header_fixed.animate({ top: "0" }, { duration: 300, complete: function () {} });
1230                CheckTopMenuDotted();
1231              }
1232            }
1233          }
1234
1235          if (isHeaderFixed || !headerCanFix) {
1236            if (!headerCanFix || scrollTop <= headerDiffHeight + headerTop) {
1237              isHeaderFixed = false;
1238              header_fixed.removeClass("fixed");
1239            }
1240          }
1241        })
1242      );
1243    }
1244  }
1245
1246  // mobile fixed
1247  var mfixed = $("body.mfixed_y.mfixed_view_scroll_top #mobileheader");
1248  if (mfixed.length) {
1249    var mheaderFixed = false,
1250      mheaderFixedHeight = mfixed.actual("outerHeight"),
1251      mheaderTop = $("#panel:visible").actual("outerHeight"),
1252      mheaderStartScroll = 0;
1253
1254    $(window).scroll(function () {
1255      if (window.matchMedia("(max-width:991px)").matches) {
1256        var scrollTop = $(window).scrollTop();
1257        if (!mheaderFixed) {
1258          if (scrollTop > mheaderTop + mheaderFixedHeight && scrollTop < mheaderStartScroll) {
1259            mfixed.addClass("fixed");
1260            mheaderFixed = true;
1261          }
1262        } else {
1263          if (scrollTop <= mheaderTop || scrollTop > mheaderStartScroll) {
1264            mfixed.removeClass("fixed");
1265            mheaderFixed = false;
1266          }
1267        }
1268
1269        mheaderStartScroll = scrollTop;
1270      } else {
1271        mfixed.removeClass("fixed");
1272      }
1273    });
1274  }
1275};
1276
1277CheckObjectsSizes = function () {
1278  $(".container iframe,.container object,.container video").each(function () {
1279    var height_attr = $(this).attr("height");
1280    var width_attr = $(this).attr("width");
1281
1282    if (height_attr && width_attr) {
1283      $(this).css("height", ($(this).outerWidth() * height_attr) / width_attr);
1284    }
1285  });
1286};
1287
1288scrollToTop = function () {
1289  if (arAsproOptions["THEME"]["SCROLLTOTOP_TYPE"] !== "NONE") {
1290    scrollToTopAnimateClassIn =
1291      arAsproOptions.THEME.SCROLLTOTOP_TYPE.indexOf("ROUND") !== -1 ? "rotateIn" : "rubberBand";
1292    scrollToTopAnimateClassOut =
1293      arAsproOptions.THEME.SCROLLTOTOP_TYPE.indexOf("ROUND") !== -1 ? "rotateOut" : "flipOutX";
1294    if (BX.browser.IsMac()) {
1295      scrollToTopAnimateClassIn = scrollToTopAnimateClassOut = "";
1296    }
1297    var _isScrolling = false;
1298    // Append Button
1299    $("body").append(
1300      $("<a />")
1301        .addClass(
1302          "scroll-to-top " +
1303            arAsproOptions["THEME"]["SCROLLTOTOP_TYPE"] +
1304            " " +
1305            arAsproOptions["THEME"]["SCROLLTOTOP_POSITION"]
1306        )
1307        .attr({ href: "#", id: "scrollToTop" })
1308    );
1309    $scrolltotop = $("#scrollToTop");
1310
1311    if (arAsproOptions.THEME.SCROLLTOTOP_POSITION_RIGHT)
1312      $scrolltotop.css({ right: arAsproOptions.THEME.SCROLLTOTOP_POSITION_RIGHT + "px", left: "auto" });
1313
1314    $scrolltotop.click(function (e) {
1315      e.preventDefault();
1316      $("body, html").animate({ scrollTop: 0 }, 500);
1317      return false;
1318    });
1319    // Show/Hide Button on Window Scroll event.
1320    $(window).scroll(function () {
1321      if (!_isScrolling) {
1322        _isScrolling = true;
1323
1324        var bottom = 23,
1325          scrollVal = $(window).scrollTop(),
1326          windowHeight = $(window).height();
1327
1328        if (arAsproOptions.THEME.SCROLLTOTOP_POSITION_BOTTOM) {
1329          bottom = arAsproOptions.THEME.SCROLLTOTOP_POSITION_BOTTOM;
1330          $scrolltotop.css("bottom", bottom + "px");
1331        }
1332
1333        var footerOffset = 0;
1334        if ($("footer").get(0)) {
1335          footerOffset = $("footer").offset().top;
1336        }
1337        if (scrollVal > 150) {
1338          $("#scrollToTop").stop(true, true).addClass("visible");
1339          _isScrolling = false;
1340        } else {
1341          $("#scrollToTop").stop(true, true).removeClass("visible");
1342          _isScrolling = false;
1343        }
1344        CheckScrollToTop();
1345      }
1346    });
1347  }
1348};
1349
1350CheckScrollToTop = function () {
1351  if (typeof arAsproOptions === "undefined") {
1352    return;
1353  }
1354
1355  if (arAsproOptions["THEME"]["SCROLLTOTOP_TYPE"] !== "NONE" && $scrolltotop.length != undefined) {
1356    if (documentScrollTop > 150) {
1357      $scrolltotop.stop(true, true).addClass("visible").addClass("animated");
1358      if (scrollToTopAnimateClassOut) {
1359        $scrolltotop.removeClass(scrollToTopAnimateClassOut);
1360      }
1361      if (scrollToTopAnimateClassIn) {
1362        $scrolltotop.addClass(scrollToTopAnimateClassIn);
1363      }
1364    } else {
1365      $scrolltotop.stop(true, true).removeClass("visible");
1366      if (scrollToTopAnimateClassIn) {
1367        $scrolltotop.removeClass(scrollToTopAnimateClassIn);
1368      }
1369      if (scrollToTopAnimateClassOut) {
1370        $scrolltotop.addClass(scrollToTopAnimateClassOut);
1371      }
1372    }
1373  }
1374  var bottom = 23,
1375    scrollVal = $(window).scrollTop(),
1376    windowHeight = $(window).height();
1377
1378  if (arAsproOptions.THEME.SCROLLTOTOP_POSITION_BOTTOM) {
1379    bottom = arAsproOptions.THEME.SCROLLTOTOP_POSITION_BOTTOM;
1380    $scrolltotop.css("bottom", bottom + "px");
1381  }
1382
1383  if ($("footer").length) var footerOffset = $("footer").offset().top;
1384
1385  if (scrollVal + windowHeight > footerOffset) {
1386    $("#scrollToTop").css("bottom", Math.round(bottom + scrollVal + windowHeight - footerOffset));
1387  } else if (parseInt($("#scrollToTop").css("bottom")) > bottom) {
1388    $("#scrollToTop").css("bottom", Math.round(bottom));
1389  }
1390};
1391
1392var isMobile = jQuery.browser.mobile;
1393var players = {};
1394
1395if (isMobile) {
1396  document.documentElement.className += " mobile";
1397}
1398
1399var timerScroll = false,
1400  ignoreScroll = [],
1401  documentScrollTopLast = $(document).scrollTop(),
1402  startScroll = 0;
1403
1404$.fn.equalizeHeights = function (outer, classNull, minHeight, autoHeightBlock) {
1405  var maxHeight = this.map(function (i, e) {
1406    var minus_height = 0,
1407      calc_height = 0;
1408    if (classNull !== false && $(e).find(classNull).is(":visible"))
1409      minus_height = parseInt($(e).find(classNull).actual("outerHeight"));
1410    if (minus_height) minus_height += 15;
1411    $(e).css("height", "");
1412    if (autoHeightBlock !== false) {
1413      var height_tmp = $(e).find(autoHeightBlock).css("height");
1414      $(e).find(autoHeightBlock).css("height", "");
1415    }
1416    if (outer === true) {
1417      calc_height = $(e).actual("outerHeight") - minus_height;
1418    } else {
1419      calc_height = $(e).actual("height") - minus_height;
1420    }
1421
1422    if (autoHeightBlock !== false) {
1423      $(e).find(autoHeightBlock).css("height", height_tmp);
1424    }
1425    if (minHeight !== false) {
1426      if (calc_height < minHeight) {
1427        calc_height += minHeight - calc_height;
1428      }
1429      if (window.matchMedia("(max-width: 520px)").matches) {
1430        calc_height = 300;
1431      }
1432      if (window.matchMedia("(max-width: 400px)").matches) {
1433        calc_height = 200;
1434      }
1435    }
1436    return calc_height;
1437  }).get();
1438
1439  for (var i = 0, c = maxHeight.length; i < c; ++i) {
1440    if (maxHeight[i] % 2) {
1441      --maxHeight[i];
1442    }
1443  }
1444
1445  return this.height(Math.max.apply(this, maxHeight));
1446};
1447
1448$.fn.getFloatWidth = function () {
1449  var width = 0;
1450
1451  if ($(this).length) {
1452    var rect = $(this)[0].getBoundingClientRect();
1453    if (!(width = rect.width)) {
1454      width = rect.right - rect.left;
1455    }
1456  }
1457
1458  return width;
1459};
1460
1461$.fn.sliceHeight2 = function (options) {
1462  function _slice(el) {
1463    el.each(function () {
1464      $(this).css("line-height", "");
1465      $(this).css("height", "");
1466    });
1467    if (typeof options.autoslicecount == "undefined" || options.autoslicecount !== false) {
1468      var elsw =
1469          typeof options.row !== "undefined" && options.row.length
1470            ? el.first().parents(options.row).getFloatWidth()
1471            : el.first().parents(".grid-list").getFloatWidth(),
1472        elw =
1473          typeof options.item !== "undefined" && options.item.length
1474            ? $(options.item).first().getFloatWidth()
1475            : el.first().hasClass("grid-list__item")
1476            ? el.first().getFloatWidth()
1477            : el.first().parents(".grid-list__item").getFloatWidth();
1478
1479      if (!elsw) {
1480        elsw = el.first().parents(".grid-list").getFloatWidth();
1481      }
1482      if (elw && options.fixWidth) elw -= options.fixWidth;
1483
1484      if (elsw && elw) {
1485        options.slice = Math.floor(elsw / elw);
1486      }
1487    }
1488    if (typeof options.typeResize == "undefined" || options.typeResize === false) {
1489      if (options.sliceEqualLength && el.closest(".flexslider").length) options.slice = el.length;
1490      if (options.slice >= 1) {
1491        for (var i = 0; i < el.length; i += options.slice) {
1492          $(el.slice(i, i + options.slice)).equalizeHeights(
1493            options.outer,
1494            options.classNull,
1495            options.minHeight,
1496            options.autoHeightBlock
1497          );
1498        }
1499      }
1500      if (options.lineheight) {
1501        var lineheightAdd = parseInt(options.lineheight);
1502        if (isNaN(lineheightAdd)) {
1503          lineheightAdd = 0;
1504        }
1505        el.each(function () {
1506          $(this).css("line-height", $(this).actual("height") + lineheightAdd + "px");
1507        });
1508      }
1509    }
1510
1511    if (typeof options.callback == "function") options.callback(el);
1512  }
1513  var options = $.extend(
1514    {
1515      slice: null,
1516      outer: false,
1517      lineheight: false,
1518      autoslicecount: true,
1519      classNull: false,
1520      minHeight: false,
1521      row: false,
1522      item: false,
1523      typeResize: false,
1524      resize: true,
1525      typeValue: false,
1526      sliceEqualLength: false,
1527      fixWidth: 0,
1528      callback: false,
1529      autoHeightBlock: false,
1530    },
1531    options
1532  );
1533
1534  var el = $(this);
1535  ignoreResize.push(true);
1536  _slice(el);
1537  ignoreResize.pop();
1538
1539  if (options.resize !== false) {
1540    BX.addCustomEvent("onWindowResize", function (eventdata) {
1541      ignoreResize.push(true);
1542      _slice(el);
1543      ignoreResize.pop();
1544    });
1545  }
1546};
1547
1548function extendDepthObject(target, FromObj) {
1549  var to = Object.assign({}, target);
1550  for (var key in FromObj) {
1551    if (typeof FromObj[key] == "object") {
1552      to[key] = extendDepthObject(to[key], FromObj[key]);
1553    } else {
1554      to[key] = FromObj[key];
1555    }
1556  }
1557
1558  return to;
1559}
1560
1561$.fn.sliceHeight = function (options) {
1562  function _slice(el) {
1563    var arBreakpoints = Object.keys(options.breakpoint);
1564    var resizeOptionsTmp = {};
1565    if (arBreakpoints.length) {
1566      for (var key in arBreakpoints) {
1567        if (window.matchMedia(arBreakpoints[key].toString()).matches) {
1568          resizeOptionsTmp = options.breakpoint[arBreakpoints[key]];
1569        }
1570      }
1571    }
1572
1573    var resizeOptions = extendDepthObject(options, resizeOptionsTmp);
1574
1575    var blockNullClass =
1576      resizeOptions.blockNull !== undefined && resizeOptions.blockNull.class !== undefined
1577        ? resizeOptions.blockNull.class
1578        : false;
1579    var parent =
1580      typeof resizeOptions.row !== "undefined" && resizeOptions.row.length
1581        ? el.first().parents(resizeOptions.row)
1582        : el.first().parents(".items");
1583    var item = "";
1584
1585    if (typeof resizeOptions.item !== "undefined" && resizeOptions.item.length) {
1586      if (blockNullClass) {
1587        $(resizeOptions.item).each(function (i, element) {
1588          _element = $(element);
1589          if (!_element.hasClass(blockNullClass)) {
1590            item = _element;
1591          }
1592        });
1593        if (!item)
1594          // if only ignored blocks
1595          return false;
1596      } else {
1597        item = $(resizeOptions.item).first();
1598      }
1599    } else {
1600      if (el.first().hasClass("item")) {
1601        item = el.first();
1602      } else {
1603        item = el.first().parents(".item");
1604      }
1605    }
1606
1607    if (typeof resizeOptions.autoslicecount == "undefined" || resizeOptions.autoslicecount !== false) {
1608      var elsw = parent.getFloatWidth(),
1609        elw = item.getFloatWidth();
1610      if (!elsw) {
1611        elsw = el.first().parents(".row").getFloatWidth();
1612      }
1613      if (!elw) {
1614        if (typeof resizeOptions.item !== "undefined" && resizeOptions.item.length)
1615          elw = $(resizeOptions.item + ":eq(1)").getFloatWidth()
1616            ? $(resizeOptions.item + ":eq(1)").getFloatWidth()
1617            : $(resizeOptions.item + ":eq(2)").getFloatWidth();
1618        else elw = $(el[1]).getFloatWidth() ? $(el[1]).getFloatWidth() : $(el[2]).getFloatWidth();
1619      }
1620      if (elw && resizeOptions.fixWidth) elw -= resizeOptions.fixWidth;
1621
1622      elw = parseInt(elw * 100) / 100;
1623
1624      if (elsw && elw) {
1625        resizeOptions.slice = Math.floor(elsw / elw);
1626      }
1627    }
1628
1629    if (resizeOptions.customSlice) {
1630      //manual slice count
1631      var bSliceNext = false;
1632      if (resizeOptions.length) {
1633        elw =
1634          typeof resizeOptions.item !== "undefined" && resizeOptions.item.length
1635            ? $(resizeOptions.item).last().getFloatWidth()
1636            : el.last().hasClass("item")
1637            ? el.last().getFloatWidth()
1638            : el.last().parents(".item").getFloatWidth();
1639        if (elw) resizeOptions.sliceNext = Math.floor(elsw / elw);
1640
1641        bSliceNext = true;
1642      }
1643    }
1644
1645    elements = [];
1646    if (resizeOptions.classes !== undefined && resizeOptions.classes.length) {
1647      for (var i = 0; i < resizeOptions.classes.length; i++) {
1648        var items = $(resizeOptions.item).find(resizeOptions.classes[i]);
1649        elements.push(items);
1650      }
1651    }
1652    var elIndex = elements.push(el) - 1;
1653
1654    if (resizeOptions.mobile === true) {
1655      if (window.matchMedia("(max-width: 550px)").matches) {
1656        for (var block = 0; block < elements.length; block++) {
1657          var items = $(elements[block]);
1658          items.css({
1659            "line-height": "",
1660            height: "",
1661          });
1662        }
1663        return;
1664      }
1665    }
1666
1667    if (typeof resizeOptions.typeResize == "undefined" || resizeOptions.typeResize === false) {
1668      if (resizeOptions.slice) {
1669        for (var block = 0; block < elements.length; block++) {
1670          if (resizeOptions.currentRow) {
1671            var itemNumber = el.index(resizeOptions.currentItem);
1672            var rowCount = resizeOptions.slice;
1673            var rowNumber = Math.floor(itemNumber / rowCount);
1674
1675            var items = $(elements[block].slice(rowNumber * rowCount, rowNumber * rowCount + rowCount));
1676            var classNull = block == elIndex ? resizeOptions.classNull : false;
1677            items.css({
1678              "line-height": "",
1679              height: "",
1680            });
1681            items.equalizeHeights(resizeOptions.outer, classNull, resizeOptions);
1682          } else {
1683            for (var i = 0; i < elements[block].length; ) {
1684              if (resizeOptions.customSlice && resizeOptions.sliceNext && bSliceNext && i)
1685                //manual slice count
1686                resizeOptions.slice = resizeOptions.sliceNext;
1687
1688              var slice = resizeOptions.slice;
1689              var items = $(elements[block].slice(i, i + slice));
1690              if (resizeOptions.blockNull !== undefined) {
1691                if (resizeOptions.blockNull.class !== undefined) {
1692                  var counts = 0;
1693                  items.each(function (i, item) {
1694                    var _item = $(item);
1695                    if (
1696                      _item.hasClass(resizeOptions.blockNull.class) ||
1697                      _item.closest("." + resizeOptions.blockNull.class).length
1698                    ) {
1699                      counts++;
1700                    }
1701                  });
1702                }
1703              }
1704              if (counts) {
1705                slice -= (resizeOptions.blockNull.width - 1) * counts;
1706              }
1707
1708              items = $(elements[block].slice(i, i + slice));
1709              if (items) {
1710                var classNull = block == elIndex ? resizeOptions.classNull : false;
1711
1712                items.css({
1713                  "line-height": "",
1714                  height: "",
1715                });
1716                items.equalizeHeights(resizeOptions.outer, classNull, resizeOptions);
1717              }
1718              i += slice || 1;
1719            }
1720          }
1721        }
1722      }
1723      if (resizeOptions.lineheight) {
1724        var lineheightAdd = parseInt(resizeOptions.lineheight);
1725        if (isNaN(lineheightAdd)) {
1726          lineheightAdd = 0;
1727        }
1728        el.each(function () {
1729          $(this).css("line-height", $(this).actual("height") + lineheightAdd + "px");
1730        });
1731      }
1732    }
1733  }
1734  var options = $.extend(
1735    {
1736      slice: null,
1737      sliceNext: null,
1738      outer: false,
1739      lineheight: false,
1740      autoslicecount: true,
1741      classNull: false,
1742      minHeight: false,
1743      row: false,
1744      item: false,
1745      typeResize: false,
1746      typeValue: false,
1747      fixWidth: 0,
1748      resize: true,
1749      mobile: false,
1750      customSlice: false,
1751      breakpoint: {},
1752      classes: [],
1753    },
1754    options
1755  );
1756
1757  var el = $(this);
1758
1759  ignoreResize.push(true);
1760  _slice(el);
1761  ignoreResize.pop();
1762
1763  if (options.resize) {
1764    BX.addCustomEvent("onWindowResize", function (eventdata) {
1765      try {
1766        ignoreResize.push(true);
1767        _slice(el);
1768      } catch (e) {
1769      } finally {
1770        ignoreResize.pop();
1771      }
1772    });
1773  } else {
1774    if (!ignoreResize.length) {
1775      // ignoreResize.push(true);
1776      _slice(el);
1777      // ignoreResize.pop();
1778    }
1779  }
1780};
1781
1782waitingExists = function (selector, delay, callback) {
1783  if (typeof callback !== "undefined" && selector.length && delay > 0) {
1784    delay = parseInt(delay);
1785    delay = delay < 0 ? 0 : delay;
1786
1787    if (!$(selector).length) {
1788      setTimeout(function () {
1789        waitingExists(selector, delay, callback);
1790      }, delay);
1791    } else {
1792      callback();
1793    }
1794  }
1795};
1796
1797waitingNotExists = function (selectorExists, selectorNotExists, delay, callback) {
1798  if (
1799    typeof callback !== "undefined" &&
1800    selectorExists.length &&
1801    $(selectorExists).length &&
1802    selectorNotExists.length &&
1803    !$(selectorNotExists).length &&
1804    delay > 0
1805  ) {
1806    delay = parseInt(delay);
1807    delay = delay < 0 ? 0 : delay;
1808
1809    setTimeout(function () {
1810      if (selectorExists.length && !$(selectorNotExists).length) {
1811        callback();
1812      }
1813    }, delay);
1814  }
1815};
1816
1817function onLoadjqm(name, hash, _this) {
1818  if (hash.c.noOverlay === undefined || (hash.c.noOverlay !== undefined && !hash.c.noOverlay)) {
1819    $("body").addClass("jqm-initied");
1820  }
1821
1822  $("body").addClass("swipeignore");
1823
1824  if (typeof $(hash.t).data("ls") !== " undefined" && $(hash.t).data("ls")) {
1825    var ls = $(hash.t).data("ls"),
1826      ls_timeout = 0,
1827      v = "";
1828
1829    if ($(hash.t).data("ls_timeout")) ls_timeout = $(hash.t).data("ls_timeout");
1830
1831    ls_timeout = ls_timeout ? Date.now() + ls_timeout * 1000 : "";
1832
1833    if (typeof localStorage !== "undefined") {
1834      var val = localStorage.getItem(ls);
1835      try {
1836        v = JSON.parse(val);
1837      } catch (e) {
1838        v = val;
1839      }
1840      if (v != null) {
1841        localStorage.removeItem(ls);
1842      }
1843      v = {};
1844      v["VALUE"] = "Y";
1845      v["TIMESTAMP"] = ls_timeout; // default: seconds for 1 day
1846
1847      localStorage.setItem(ls, JSON.stringify(v));
1848    } else {
1849      var val = $.cookie(ls);
1850      if (!val) $.cookie(ls, "Y", { expires: ls_timeout }); // default: seconds for 1 day
1851    }
1852
1853    var dopClasses = hash.w.find(".marketing-popup").data("classes");
1854    if (dopClasses) {
1855      hash.w.addClass(dopClasses);
1856    }
1857  }
1858
1859  //update show password
1860  //show password eye
1861  if (hash.w.hasClass("auth_frame")) {
1862    hash.w.find(".form-group:not(.eye-password-ignore) [type=password]").each(function (item) {
1863      $(this).closest(".form-group").addClass("eye-password");
1864    });
1865  }
1866
1867  $.each($(hash.t).get(0).attributes, function (index, attr) {
1868    if (/^data\-autoload\-(.+)$/.test(attr.nodeName)) {
1869      var key = attr.nodeName.match(/^data\-autoload\-(.+)$/)[1];
1870      var el = $('input[name="' + key.toUpperCase() + '"]');
1871      if (!el.length) {
1872        //is form block
1873        el = $('input[data-sid="' + key.toUpperCase() + '"]');
1874      }
1875
1876      var value = $(hash.t).data("autoload-" + key);
1877      value = String(value).replace(/%99/g, "\\"); // replace symbol \
1878
1879      el.val(BX.util.htmlspecialcharsback(value)).attr("readonly", "readonly");
1880      el.closest(".form-group").addClass("input-filed");
1881      el.attr("title", el.val());
1882    }
1883  });
1884
1885  if (hash.c.noOverlay === undefined || (hash.c.noOverlay !== undefined && !hash.c.noOverlay)) {
1886    $("body").addClass('overflow-block');
1887    hash.w.closest("#popup_iframe_wrapper").css({ "z-index": 3000, display: "flex" });
1888  }
1889
1890  var eventdata = { action: "loadForm" };
1891  BX.onCustomEvent("onCompleteAction", [eventdata, $(hash.t)[0]]);
1892
1893  if ($(hash.t).data("autohide")) {
1894    $(hash.w).data("autohide", $(hash.t).data("autohide"));
1895  }
1896  if (name == "order_product") {
1897    if ($(hash.t).data("product")) {
1898      $('input[name="PRODUCT"]').closest(".form-group").addClass("input-filed");
1899      $('input[name="PRODUCT"]')
1900        .val($(hash.t).data("product"))
1901        .attr("readonly", "readonly")
1902        .attr("title", $('input[name="PRODUCT"]').val());
1903    }
1904  }
1905  if (name == "question") {
1906    if ($(hash.t).data("product")) {
1907      $('input[name="NEED_PRODUCT"]').closest(".form-group").addClass("input-filed");
1908      $('input[name="NEED_PRODUCT"]')
1909        .val($(hash.t).data("product"))
1910        .attr("readonly", "readonly")
1911        .attr("title", $('input[name="NEED_PRODUCT"]').val());
1912    }
1913  }
1914
1915  //show one_click_buy block
1916  if (name === "ocb") {
1917    const parent = hash.w.find(".flexbox:not(.form-body__fields)");
1918    const item = _this.closest(".js-popup-block");
1919
1920    var data = item.find("[data-item]").data("item");
1921    if (typeof data === "undefined" || !data) {
1922      data = {};
1923    }
1924
1925    parent.addClass("flexbox--direction-row-reverse");
1926
1927    parent.find(".form.popup").addClass("flex-grow-1");
1928
1929    let goodsNode = '<div class="goods-popup">';
1930
1931    //image block
1932    let imageNode = '<div class="goods-popup__image image-list-wrapper">';
1933    //stiker
1934    if (item.find(".sticker").length) {
1935      imageNode += '<div class="sticker sticker--upper">';
1936      imageNode += item.find(".sticker").html();
1937      imageNode += "</div>";
1938    }
1939    //image
1940    imageNode += '<div class="image">';
1941    imageNode +=
1942      '<img class="img-responsive" src="' +
1943      (item.find(".image-list__link link[itemprop=image]").length
1944        ? item.find(".image-list__link link[itemprop=image]:first").attr("href")
1945        : item.find(".image-list-wrapper img:first").length
1946        ? item.find(".image-list-wrapper img:first").attr("src")
1947        : arAsproOptions.SITE_TEMPLATE_PATH + "/images/svg/noimage_product.svg") +
1948      '" />';
1949    imageNode += "</div>";
1950    imageNode += "</div>";
1951    goodsNode += imageNode;
1952
1953    //info block
1954    let infoNode = '<div class="goods-popup__info">';
1955    //link
1956    if (item.find(".js-popup-title").attr("href")) {
1957      infoNode +=
1958        '<a class="dark_link switcher-title goods-popup__info-link font_15" href="' +
1959        item.find(".js-popup-title").attr("href") +
1960        '">';
1961      infoNode += data ? data.NAME : item.find(".js-popup-title").html();
1962      infoNode += "</a>";
1963    } else {
1964      infoNode += '<div class="color_333 switcher-title goods-popup__info-link font_15">';
1965      infoNode += data ? data.NAME : item.find(".js-popup-title").html();
1966      infoNode += "</div>";
1967    }
1968    //article
1969    if (item.find(".js-popup-info").length) {
1970      infoNode += '<div class="line-block line-block--20 flexbox--wrap goods-popup__info-more">';
1971      infoNode += item.find(".js-popup-info").html();
1972      infoNode += "</div>";
1973    }
1974    infoNode += "</div>";
1975    goodsNode += infoNode;
1976
1977    //price block
1978    if (item.find(".js-popup-price .price").length) {
1979      let priceNode = '<div class="goods-popup__price">';
1980      priceNode += item.find(".js-popup-price").html();
1981      priceNode += "</div>";
1982      goodsNode += priceNode;
1983    }
1984
1985    goodsNode += "</div>";
1986
1987    $(goodsNode).appendTo(parent);
1988  }
1989
1990  if (name == "fast_view" && $(".smart-filter-filter").length) {
1991    var navButtons =
1992      '<div class="navigation-wrapper-fast-view">' +
1993      '<div class="fast-view-nav prev bg-theme-hover" data-fast-nav="prev">' +
1994      '<i class="svg left">' +
1995      '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="6.969" viewBox="0 0 12 6.969"><path id="Rounded_Rectangle_702_copy_24" data-name="Rounded Rectangle 702 copy 24" class="cls-1" d="M361.691,401.707a1,1,0,0,1-1.414,0L356,397.416l-4.306,4.291a1,1,0,0,1-1.414,0,0.991,0.991,0,0,1,0-1.406l5.016-5a1.006,1.006,0,0,1,1.415,0l4.984,5A0.989,0.989,0,0,1,361.691,401.707Z" transform="translate(-350 -395.031)"/></svg>' +
1996      "</i>" +
1997      "</div>" +
1998      '<div class="fast-view-nav next bg-theme-hover" data-fast-nav="next">' +
1999      '<i class="svg right">' +
2000      '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="6.969" viewBox="0 0 12 6.969"><path id="Rounded_Rectangle_702_copy_24" data-name="Rounded Rectangle 702 copy 24" class="cls-1" d="M361.691,401.707a1,1,0,0,1-1.414,0L356,397.416l-4.306,4.291a1,1,0,0,1-1.414,0,0.991,0.991,0,0,1,0-1.406l5.016-5a1.006,1.006,0,0,1,1.415,0l4.984,5A0.989,0.989,0,0,1,361.691,401.707Z" transform="translate(-350 -395.031)"/></svg>' +
2001      "</i>" +
2002      "</div>" +
2003      "</div>";
2004
2005    // hash.w.addClass("no_custom_scroll");
2006    hash.w.closest("#popup_iframe_wrapper").append(navButtons);
2007  }
2008   var needScrollbar = true;
2009
2010  if (
2011    arAsproOptions["THEME"]["REGIONALITY_SEARCH_ROW"] == "Y" &&
2012    (hash.w.hasClass("city_chooser_frame") || hash.w.hasClass("city_chooser_small_frame"))
2013  ) {
2014    hash.w.addClass("small_popup_regions");
2015    //hash.w.addClass("no_custom_scroll");
2016    hash.w.addClass("jqmWindow--overflow-visible");
2017    needScrollbar = false;
2018  }
2019    hash.w.addClass("show").css({ opacity: 1 });
2020    if(needScrollbar)
2021      hash.w.find(">div").addClass("scrollbar");
2022
2023    if (hash.w.hasClass("right_slide")) {
2024
2025      hash.w.addClass("opened");
2026      if ($(".right-sidebar-wrapper").length) {
2027        if ($(".widget_frame iframe").length) {
2028          $(".widget_frame.right_slide").addClass("loading-state");
2029          $('.widget_frame iframe').on("load", function() {
2030            $(".widget_frame.right_slide").removeClass("loading-state");
2031          });
2032        }
2033
2034        if (hash.w.hasClass("narrow")) {
2035          if ($(".ajax_basket").length) {
2036            $(".ajax_basket").addClass("narrow");
2037          }
2038          if ($(".ajax_basket .fixed_wrapper").length) {
2039              $(".ajax_basket .fixed_wrapper").addClass("narrow");
2040          }
2041        }
2042        if (hash.w.hasClass("wide")) {
2043          if ($(".ajax_basket").length) {
2044            $(".ajax_basket").addClass("wide");
2045          }
2046        }
2047      }
2048      if ($(".ajax_basket").length) {
2049        $(".ajax_basket").css("z-index", "3000").addClass('widget_open');
2050      }
2051      if ($(hash.t).parent()) {
2052        $(hash.t).parent().addClass("active");
2053      }
2054      $(hash.t).addClass("jqm_disable");
2055
2056      if ($(hash.t).attr("data-show_slide") === "Y") {
2057        $(hash.t).parent().addClass("once_loaded");
2058      }
2059
2060      $(".ajax_basket").removeClass("opened");
2061
2062    }
2063
2064}
2065
2066function onHidejqm(name, hash) {
2067  if ($(hash.w).data("autohide")) {
2068    eval($(hash.w).data("autohide"));
2069  }
2070
2071  // hash.w.css('opacity', 0).hide();
2072  hash.w.animate({ opacity: 0 }, 200, function () {
2073    hash.w.removeClass("scroll-init srollbar-custom").mCustomScrollbar("destroy");
2074    hash.w.hide();
2075    if (!$(".once_loaded").length) {
2076      hash.w.empty();
2077    }
2078    hash.o.remove();
2079    hash.w.removeClass("show");
2080    hash.w.removeClass("success");
2081
2082
2083
2084    if (!hash.w.closest("#popup_iframe_wrapper").find(".jqmOverlay").length) {
2085      $('body').removeClass('overflow-block');
2086      hash.w.closest("#popup_iframe_wrapper").css({ "z-index": "", display: "" });
2087    }
2088
2089    if (window.matchMedia("(max-width: 991px)").matches) {
2090      $("body").removeClass("all_viewed");
2091    }
2092    if (!$(".jqmOverlay:not(.mobp)").length || $(".jqmOverlay.waiting").length) {
2093      $("body").removeClass("jqm-initied");
2094    }
2095
2096    $("body").removeClass("swipeignore");
2097    $("body").removeClass("overflow-block");
2098
2099    if (name == "fast_view") {
2100      $(".fast_view_popup").remove();
2101
2102      var navButtons = hash.w.closest("#popup_iframe_wrapper").find(".navigation-wrapper-fast-view");
2103      navButtons.remove();
2104    }
2105  });
2106
2107  if (hash.w.hasClass("right_slide")) {
2108    hash.w.removeClass("opened");
2109    if ($(".right-sidebar-wrapper").length) {
2110      $(".right-sidebar-wrapper").removeClass("opened");
2111      $(".right-sidebar-wrapper .link").removeClass("active");
2112      $(".widget_frame.right_slide").removeClass("loading-state");
2113      $(".right-sidebar-wrapper .link span").removeClass("jqm_disable");
2114    }
2115    if ($(".ajax_basket").length) {
2116      $(".ajax_basket").css("z-index", "").removeClass("widget_open").removeClass("wide").removeClass("narrow");
2117    }
2118  }
2119
2120  window.b24form = false;
2121}
2122
2123function parseUrlQuery() {
2124  var data = {};
2125  if (location.search) {
2126    var pair = location.search.substr(1).split("&");
2127    for (var i = 0; i < pair.length; i++) {
2128      var param = pair[i].split("=");
2129      data[param[0]] = param[1];
2130    }
2131  }
2132  return data;
2133}
2134
2135function scroll_block(block) {
2136  if (block.length) {
2137    var topPos = block.offset().top,
2138      headerH = $("header").outerHeight(true, true);
2139    if ($(".stores_tab").length) {
2140      $(".stores_tab").addClass("active").siblings().removeClass("active");
2141    } else {
2142      $(".prices_tab").addClass("active").siblings().removeClass("active");
2143      if ($(".prices_tab .opener").length && !$(".prices_tab .opener .opened").length) {
2144        var item = $(".prices_tab .opener").first();
2145        item.find(".opener_icon").addClass("opened");
2146        item.parents("tr").addClass("nb");
2147        item.parents("tr").next(".offer_stores").find(".stores_block_wrap").slideDown(200);
2148      }
2149    }
2150    $("html,body").animate({ scrollTop: topPos - 80 }, 150);
2151  }
2152}
2153
2154$.fn.jqmEx = function () {
2155  $(this).each(function () {
2156    var _this = $(this);
2157    var name = _this.data("name");
2158    name = typeof name === "undefined" || !name.length ? "noname" : name;
2159
2160    if (_this.attr("disabled") != "disabled" || !_this.hasClass("clicked")) {
2161      var extClass = "",
2162        paramsStr = "",
2163        trigger = "",
2164        arTriggerAttrs = {};
2165
2166      // call counter
2167      if (typeof $.fn.jqmEx.counter === "undefined") {
2168        $.fn.jqmEx.counter = 0;
2169      } else {
2170        ++$.fn.jqmEx.counter;
2171      }
2172
2173      // trigger attrs and params
2174      $.each(_this.get(0).attributes, function (index, attr) {
2175        var attrName = attr.nodeName;
2176        var attrValue = _this.attr(attrName);
2177        if (attrName !== "onclick") {
2178          trigger += "[" + attrName + '="' + attrValue + '"]';
2179          arTriggerAttrs[attrName] = attrValue;
2180        }
2181        if (/^data\-param\-(.+)$/.test(attrName)) {
2182          var key = attrName.match(/^data\-param\-(.+)$/)[1];
2183          paramsStr += key + "=" + attrValue + "&";
2184        }
2185      });
2186      var triggerAttrs = JSON.stringify(arTriggerAttrs);
2187      var encTriggerAttrs = "";
2188      // var encTriggerAttrs = encodeURIComponent(triggerAttrs);
2189      // console.log(trigger);
2190
2191      // popup url
2192      var script = arAsproOptions["SITE_DIR"] + "ajax/form.php";
2193      if (name == "auth") {
2194        script += "?" + paramsStr + "auth=Y";
2195      } else {
2196        script += "?" + paramsStr + 'data-trigger=""';
2197      }
2198
2199      // ext frame class
2200      if (_this.closest("#fast_view_item").length) {
2201        extClass = "fast_view_popup";
2202      }
2203
2204      if (_this.data("show_slide") == "Y") {
2205        extClass += " right_slide";
2206      }
2207
2208      if (_this.data("width")) {
2209        extClass += " " + _this.data("width");
2210      }
2211
2212      // use overlay?
2213      const modalParams = _this[0].dataset,
2214        bNoOverlay = modalParams && modalParams.nooverlay && modalParams.nooverlay === 'Y',
2215        bShowSlide = modalParams && modalParams.show_slide && modalParams.show_slide === 'Y',
2216        bShowOnce = modalParams && modalParams.once && modalParams.once === 'Y';
2217
2218      const nodeFrame = `<div class="${name}_frame ${extClass} jqmWindow popup" data-popup="${$.fn.jqmEx.counter}" data-trigger="${encTriggerAttrs}"></div>`;
2219
2220      // unique frame to each trigger
2221      let frame = '';
2222      if (bShowSlide) {
2223        frame = $(nodeFrame).insertAfter(".right-sidebar-wrapper");
2224      } else if (bNoOverlay) {
2225        frame = $(nodeFrame).appendTo("body");
2226      } else {
2227        frame = $(nodeFrame).appendTo("#popup_iframe_wrapper");
2228      }
2229
2230      frame.jqm({
2231        ajax: script,
2232        trigger: trigger,
2233        noOverlay: bNoOverlay,
2234        once: bShowOnce,
2235        onLoad: function (hash) {
2236          onLoadjqm(name, hash, _this);
2237        },
2238        onHide: function (hash) {
2239          onHidejqm(name, hash, _this);
2240        },
2241      });
2242    }
2243    return;
2244  });
2245};
2246
2247InitOwlSlider = function (callback) {
2248  const $owlCarousel = $(".owl-carousel:not(.owl-loaded):not(.appear-block)");
2249  if ($owlCarousel.length) {
2250    BX.Aspro.Loader.addExt('owl_gallery').then(() => {
2251      $owlCarousel.each(function () {
2252        var slider = $(this);
2253        var options;
2254        var svg =
2255          '<svg width="7" height="12" viewBox="0 0 7 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6 1L1 6L6 11" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';
2256        var defaults = {
2257          navText: [
2258            '<i class="owl-carousel__button owl-carousel__button--left colored_theme_bg_hover">' + svg + "</i>",
2259            '<i class="owl-carousel__button owl-carousel__button--right colored_theme_bg_hover">' + svg + "</i>",
2260          ],
2261          dotsContainer: slider.siblings(".owl-carousel__dots"),
2262        };
2263        var config = $.extend({}, defaults, options, slider.data("plugin-options"));
2264
2265        slider.siblings(".owl-carousel__dots").on("click", ".owl-carousel__dot", function () {
2266          var _this = $(this);
2267          var sliderData = slider.data("owl.carousel");
2268
2269          slider.trigger("to.owl.carousel", [_this.index(), 300]);
2270          if (sliderData.settings.autoplayHoverPause) {
2271            slider.trigger("mouseover.owl.autoplay");
2272          }
2273        });
2274
2275        if (slider.hasClass("destroyed")) {
2276          slider.owlCarousel(config);
2277          slider.removeClass("destroyed");
2278          return;
2279        }
2280
2281        slider.on("initialized.owl.carousel", function (event) {
2282          var eventdata = { slider: $(event.target), data: event };
2283
2284          BX.onCustomEvent("onSliderInitialized", [eventdata]);
2285          BX.onCustomEvent("onSlide", [eventdata]);
2286
2287          $(event.target).removeClass("loading-state");
2288          $(event.target).find(".owl-item:first").addClass("current");
2289
2290          if (typeof sliceItemBlockSlide === "function") {
2291            sliceItemBlockSlide();
2292          }
2293        });
2294
2295        // if slider was inited on animated scrolling to block, than need rescroll
2296        if ($("body.scrolling-state").length) {
2297          slider.on("initialized.owl.carousel", function (event) {
2298            setTimeout(function () {
2299              scrollToBlock.rescroll();
2300            }, 100);
2301          });
2302        }
2303
2304        slider.on("change.owl.carousel", function (event) {
2305          // var eventdata = {slider: $(event.target)};
2306          // BX.onCustomEvent('onSlide', [eventdata]);
2307        });
2308
2309        slider.owlCarousel(config);
2310
2311        slider.on("resized.owl.carousel", function (event) {
2312          if (typeof sliceItemBlockSlide === "function") {
2313            sliceItemBlockSlide({ resize: false });
2314          }
2315        });
2316
2317        slider.on("mouseover.owl.autoplay", function (event) {
2318          var slider = $(event.target).closest(".owl-carousel");
2319          var sliderData = slider.data("owl.carousel");
2320          var dots = slider.siblings(".owl-carousel__dots--autoplay");
2321          if (typeof sliderData !== "undefined") {
2322            var bNeedStopDotsAnimation =
2323              sliderData.settings.autoplay && sliderData.settings.autoplayHoverPause && dots.length;
2324            if (bNeedStopDotsAnimation) {
2325              var animationBlock = dots.find(".owl-carousel__dot .owl-carousel__dot-pie");
2326              if (animationBlock.length) {
2327                animationBlock.css("animation-play-state", "paused");
2328              }
2329            }
2330          }
2331        });
2332
2333        slider.on("mouseleave.owl.autoplay", function (event) {
2334          var slider = $(event.target).closest(".owl-carousel");
2335          var sliderData = slider.data("owl.carousel");
2336          var dots = slider.siblings(".owl-carousel__dots--autoplay");
2337          if (typeof sliderData !== "undefined") {
2338            var bNeedStopDotsAnimation =
2339              sliderData.settings.autoplay && sliderData.settings.autoplayHoverPause && dots.length;
2340            var rotating = sliderData._states.current.rotating;
2341            if (bNeedStopDotsAnimation && rotating) {
2342              var animationBlock = dots.find(".owl-carousel__dot .owl-carousel__dot-pie");
2343              if (animationBlock.length) {
2344                animationBlock.css("animation-play-state", "");
2345              }
2346            }
2347          }
2348        });
2349
2350        slider.on("stop.owl.autoplay", function (event) {
2351          var slider = $(event.target);
2352          var sliderData = slider.data("owl.carousel");
2353          var dots = slider.siblings(".owl-carousel__dots--autoplay");
2354          if (typeof sliderData !== "undefined") {
2355            var bNeedStopDotsAnimation =
2356              sliderData.settings.autoplay && sliderData.settings.autoplayHoverPause && dots.length;
2357            if (bNeedStopDotsAnimation) {
2358              var animationBlock = dots.find(".owl-carousel__dot .owl-carousel__dot-pie");
2359              if (animationBlock.length) {
2360                dots.find(".owl-carousel__dot.active").addClass("reset-animation");
2361                animationBlock.css("animation-play-state", "paused");
2362              }
2363            }
2364          }
2365        });
2366
2367        slider.on("play.owl.autoplay", function (event) {
2368          var slider = $(event.target);
2369          var sliderData = slider.data("owl.carousel");
2370          var dots = slider.siblings(".owl-carousel__dots--autoplay");
2371          if (typeof sliderData !== "undefined") {
2372            var bNeedStopDotsAnimation =
2373              sliderData.settings.autoplay && sliderData.settings.autoplayHoverPause && dots.length;
2374            dots.find(".owl-carousel__dot.reset-animation").removeClass("reset-animation");
2375            if (bNeedStopDotsAnimation && !slider.is(":hover") && !dots.is(":hover")) {
2376              var animationBlock = dots.find(".owl-carousel__dot .owl-carousel__dot-pie");
2377              if (animationBlock.length) {
2378                animationBlock.css("animation-play-state", "");
2379              }
2380            }
2381          }
2382        });
2383
2384        slider.on("touchstart.owl.core", function (event) {
2385          slider.trigger("stop.owl.autoplay");
2386        });
2387
2388        slider.siblings(".owl-carousel__dots--autoplay").on("mouseover", function (event) {
2389          var sliderData = slider.data("owl.carousel");
2390          if (sliderData.settings.autoplayHoverPause) {
2391            slider.trigger("mouseover.owl.autoplay");
2392          }
2393        });
2394
2395        slider.on("changed.owl.carousel", function (event) {
2396          var $slider = $(event.target);
2397          var sliderData = $slider.data("owl.carousel");
2398          var pluginOptions = $slider.data("pluginOptions");
2399
2400          var eventdata = { slider: $slider, data: event };
2401          BX.onCustomEvent("onSlide", [eventdata]);
2402
2403          if (pluginOptions) {
2404            // click .ajax_load_btn
2405            if ($slider.parent().find(".ajax_load_btn").length) {
2406              if (sliderData._current + 1 + sliderData.settings.items >= sliderData._items.length) {
2407                $slider.parent().find(".ajax_load_btn").trigger("click");
2408              }
2409            }
2410            if (typeofExt(pluginOptions) === "object") {
2411              if ("index" in pluginOptions) {
2412                if ($(".gallery-view_switch").length) {
2413                  $(".gallery-view_switch__count-wrapper--big .gallery-view_switch__count-value").text(
2414                    event.item.index + 1 + "/" + event.item.count
2415                  );
2416                }
2417              }
2418
2419              if ("relatedTo" in pluginOptions) {
2420                var relatedClass = pluginOptions.relatedTo,
2421                  relatedBlock = $(relatedClass);
2422
2423                if (relatedBlock.length && sliderData) {
2424                  if (!sliderData.loop) {
2425                    var current = event.item.index;
2426                  } else {
2427                    var count = event.item.count - 1;
2428                    var current = Math.round(event.item.index - event.item.count / 2 - 0.5);
2429
2430                    if (current < 0) current = count;
2431
2432                    if (current > count) current = 0;
2433                  }
2434
2435                  relatedBlock.find(".owl-item").removeClass("current").eq(current).addClass("current");
2436
2437                  var onscreen = relatedBlock.find(".owl-item.active").length - 1;
2438                  var start = relatedBlock.find(".owl-item.active").first().index();
2439                  var end = relatedBlock.find(".owl-item.active").last().index();
2440
2441                  if (current > end) relatedBlock.data("owl.carousel").to(current, 100, true);
2442
2443                  if (current < start) relatedBlock.data("owl.carousel").to(current - onscreen, 100, true);
2444                  // $(".owl-slider-"+id).trigger('to.owl.carousel', [itemCarousel])
2445                }
2446              }
2447            }
2448          }
2449        });
2450
2451        slider.on("translated.owl.carousel", function (event) {});
2452
2453        if ("clickTo" in config) {
2454          var relatedClass = config.clickTo,
2455            magnifier = "magnifier" in config;
2456
2457          slider.on("click", ".owl-item", function (e) {
2458            e.preventDefault();
2459            var _this = $(this),
2460              number = _this.index();
2461
2462            if (magnifier) {
2463              if ($(relatedClass).closest(".product-container").find(".zoom_picture").length) {
2464                $(relatedClass)
2465                  .closest(".product-container")
2466                  .find(".zoom_picture")
2467                  .attr("data-large", _this.find(".product-detail-gallery__item").data("big"));
2468                $(relatedClass)
2469                  .closest(".product-container")
2470                  .find(".zoom_picture")
2471                  .attr("xoriginal", _this.find(".product-detail-gallery__item").data("big"));
2472                $(relatedClass)
2473                  .closest(".product-container")
2474                  .find(".zoom_picture")
2475                  .attr("src", _this.find(".product-detail-gallery__item img").attr("src"));
2476              }
2477              _this.siblings("").removeClass("current");
2478              _this.addClass("current");
2479            } else {
2480              $(relatedClass).data("owl.carousel").to(number, 300, true);
2481            }
2482          });
2483        }
2484      });
2485
2486      if (typeof callback === 'function') {
2487        callback();
2488      }
2489    })
2490  } else {
2491    if (typeof callback === 'function') {
2492      callback();
2493    }
2494  }
2495};
2496
2497InitFlexSlider = function () {
2498  $(".flexslider:not(.thmb):not(.flexslider-init):not(.appear-block):v
2498isible").each(function () {
2499    var slider = $(this);
2500    var options;
2501    var defaults = {
2502      animationLoop: false,
2503      controlNav: false,
2504      directionNav: true,
2505      animation: "slide",
2506    };
2507    var config = $.extend({}, defaults, options, slider.data("plugin-options"));
2508    if (typeof config.counts != "undefined" && config.direction !== "vertical") {
2509      var slide_counts = "";
2510      if (typeof slider.data("plugin-options") != "undefined") {
2511        if ("slide_counts" in slider.data("plugin-options")) slide_counts = slider.data("plugin-options").slide_counts;
2512      }
2513      config.maxItems = getGridSize(config.counts);
2514      config.minItems = getGridSize(config.counts);
2515
2516      if (slide_counts) config.move = slide_counts;
2517      else config.move = getGridSize(config.counts);
2518
2519      config.itemWidth = 200;
2520    }
2521
2522    // custom direction nav
2523    if (typeof config.customDirection != "undefined") config.customDirectionNav = $(config.customDirection);
2524
2525    (config.prevText = BX.message("FANCY_PREV")), //String: Set the text for the "previous" directionNav item
2526      (config.nextText = BX.message("FANCY_NEXT")),
2527      (config.after = config.start =
2528        function (slider) {
2529          var eventdata = { slider: slider };
2530          BX.onCustomEvent("onSlide", [eventdata]);
2531        });
2532
2533    config.before = function (slider) {
2534      var eventdata = { slider: slider };
2535      BX.onCustomEvent("onSlideBefore", [eventdata]);
2536    };
2537
2538    config.end = function (slider) {
2539      var eventdata = { slider: slider };
2540      BX.onCustomEvent("onSlideEnd", [eventdata]);
2541    };
2542
2543    /*if(typeof(config.nav) == 'undefined')
2544			slider.addClass('dark-nav');*/
2545    slider.flexslider(config).addClass("flexslider-init");
2546    if (config.controlNav) slider.addClass("flexslider-control-nav");
2547    if (config.directionNav) slider.addClass("flexslider-direction-nav");
2548  });
2549};
2550
2551InitFlexSliderClass = function (class_name) {
2552  //$('.flexslider:not(.thmb):not(.flexslider-init)').each(function(){
2553
2554  var slider = $(class_name);
2555  var options;
2556  var defaults = {
2557    animationLoop: false,
2558    controlNav: false,
2559    directionNav: true,
2560    animation: "slide",
2561  };
2562  var config = $.extend({}, defaults, options, slider.data("plugin-options"));
2563
2564  var slide_counts = "";
2565  if (typeof slider.data("plugin-options") != "undefined") {
2566    if ("slide_counts" in slider.data("plugin-options")) slide_counts = slider.data("plugin-options").slide_counts;
2567  }
2568
2569  if (typeof config.counts != "undefined" && config.direction !== "vertical") {
2570    config.maxItems = getGridSize(config.counts);
2571    config.minItems = getGridSize(config.counts);
2572    config.move = getGridSize(config.counts);
2573
2574    config.itemWidth = 200;
2575  }
2576  if (slide_counts) config.move = slide_counts;
2577
2578  // custom direction nav
2579  if (typeof config.customDirection != "undefined") config.customDirectionNav = $(config.customDirection);
2580
2581  (config.prevText = BX.message("FANCY_PREV")), //String: Set the text for the "previous" directionNav item
2582    (config.nextText = BX.message("FANCY_NEXT")),
2583    (config.after = config.start =
2584      function (slider) {
2585        var eventdata = { slider: slider };
2586        BX.onCustomEvent("onSlide", [eventdata]);
2587      });
2588
2589  config.before = function (slider) {
2590    var eventdata = { slider: slider };
2591    BX.onCustomEvent("onSlideBefore", [eventdata]);
2592  };
2593
2594  config.end = function (slider) {
2595    var eventdata = { slider: slider };
2596    BX.onCustomEvent("onSlideEnd", [eventdata]);
2597  };
2598
2599  slider.flexslider(config).addClass("flexslider-init");
2600  if (config.controlNav) slider.addClass("flexslider-control-nav");
2601  if (config.directionNav) slider.addClass("flexslider-direction-nav");
2602  //});
2603};
2604
2605InitFlexSliderMin = function () {
2606  $(".bxSlider.top-small").on("mousedown", ".slides li", function () {
2607    var index = $(this).data("slide_key");
2608    $(this).siblings().removeClass("flex-active-slide");
2609    $(this).addClass("flex-active-slide");
2610    $(this)
2611      .siblings('[data-slide_key="' + index + '"]')
2612      .addClass("flex-active-slide");
2613    $(".top-bigs").data("flexslider").flexAnimate(index);
2614  });
2615};
2616
2617SliceHeightBlocks = function () {
2618  $('*[data-slice="Y"]').each(function () {
2619    var slice_els = $(this).find('*[data-slice-block="Y"]');
2620    if (slice_els.length) {
2621      var slice_params = {};
2622      if (slice_els.data("slice-params")) slice_params = slice_els.data("slice-params");
2623      slice_els.sliceHeight(slice_params);
2624    }
2625  });
2626};
2627
2628createTableCompare = function (originalTable, appendDiv, cloneTable) {
2629  try {
2630    if ($(".tarifs .head-block:visible").length) {
2631      var clone = originalTable.clone().addClass("clone");
2632      if (cloneTable.length) {
2633        cloneTable.remove();
2634        appendDiv.html("");
2635        appendDiv.html(clone);
2636      } else {
2637        appendDiv.append(clone);
2638      }
2639    }
2640  } catch (e) {
2641  } finally {
2642  }
2643};
2644
2645InitTopestMenuGummi = function () {
2646  if (!isOnceInited) {
2647    function _init() {
2648      var arItems = $menuTopest.find(".menu-topest__item");
2649      var cntItems = arItems.length;
2650      if (cntItems) {
2651        var itemsWidth = 0;
2652        for (var i = 0; i < cntItems; ++i) {
2653          var item = arItems.eq(i);
2654          var itemWidth = item.actual("outerWidth", { includeMargin: true });
2655
2656          arItemsHideWidth[i] = (itemsWidth += itemWidth) + (i == cntItems - 1 ? 0 : moreWidth);
2657        }
2658      }
2659    }
2660
2661    function _gummi() {
2662      var rowWidth = $menuTopest.actual("innerWidth");
2663      var arItems = $menuTopest.find(".menu-topest__item");
2664      var cntItems = arItems.length;
2665      var arItemsToRemove = [];
2666
2667      if (cntItems) {
2668        var bMore = false;
2669        var moreItems = [];
2670        for (var i = cntItems - 1; i >= 0; --i) {
2671          var item = arItems.eq(i);
2672          var bInMore = item.parents(".menu-topest__more").length > 0;
2673          if (!bInMore) {
2674            if (arItemsHideWidth[i] > rowWidth + 1) {
2675              if (!bMore) {
2676                bMore = true;
2677                more.removeClass("hidden");
2678              }
2679              var clone = item.clone();
2680              clone.find(">a").addClass("dark_font");
2681              moreItems.push(clone[0]);
2682              arItemsToRemove.push(i);
2683            } else {
2684              break;
2685            }
2686          }
2687        }
2688        $(moreItems).prependTo(moreDropdown);
2689
2690        if (!bMore) {
2691          for (var i = 0; i < cntItems; ++i) {
2692            var item = arItems.eq(i);
2693            var bInMore = item.parents(".menu-topest__more li").length > 0;
2694            if (bInMore) {
2695              if (arItemsHideWidth[i] <= rowWidth) {
2696                if (i === cntItems - 1) {
2697                  bMore = false;
2698                  more.addClass("hidden");
2699                }
2700                var clone = item.clone();
2701                clone.find(">a").removeClass("dark_font");
2702                clone.insertBefore(more);
2703                item.addClass("cloned");
2704              }
2705            }
2706          }
2707        }
2708
2709        if (arItemsToRemove.length) {
2710          arItemsToRemove.map(function (elIndex) {
2711            $(arItems[elIndex]).remove();
2712          });
2713        }
2714
2715        $menuTopest.find(".menu-topest__item.cloned").remove();
2716        $menuTopest.closest(".menu-topest__wrapper").addClass("dotted-complete");
2717        var wrapper = $menuTopest.closest(".hide-dotted");
2718        if (wrapper.length) {
2719          wrapper.addClass("dotted-complete");
2720        }
2721      }
2722    }
2723
2724    var $menuTopest = $(".menu-topest");
2725    if ($menuTopest.length) {
2726      var more = $menuTopest.find(".menu-topest__more");
2727      var moreDropdown = more.find(">.dropdown");
2728      var moreWidth = more.actual("outerWidth", { includeMargin: true });
2729      var arItemsHideWidth = [];
2730
2731      ignoreResize.push(true);
2732      _init();
2733      _gummi();
2734      ignoreResize.pop();
2735
2736      BX.addCustomEvent("onWindowResize", function (eventdata) {
2737        try {
2738          ignoreResize.push(true);
2739          _gummi();
2740        } catch (e) {
2741        } finally {
2742          ignoreResize.pop();
2743        }
2744      });
2745    }
2746  }
2747};
2748
2749CheckHeaderFixedMenu = function () {
2750  if (
2751    arAsproOptions["THEME"]["HEADER_FIXED"] == 2 &&
2752    $("#headerfixed .js-nav").length &&
2753    window.matchMedia("(min-width: 992px)").matches
2754  ) {
2755    $("#headerfixed .js-nav").css("width", "0");
2756    var all_width = 0,
2757      cont_width = $("#headerfixed .maxwidth-theme").actual("width"),
2758      padding_menu =
2759        $("#headerfixed .logo-row.v2 .menu-block").actual("outerWidth") -
2760        $("#headerfixed .logo-row.v2 .menu-block").actual("width");
2761    $("#headerfixed .logo-row.v2 > .inner-table-block").each(function () {
2762      if (!$(this).hasClass("menu-block")) all_width += $(this).actual("outerWidth");
2763    });
2764    $("#headerfixed .js-nav").width(cont_width - all_width - padding_menu);
2765  }
2766};
2767
2768/*function CheckTopMenuPadding() {
2769  if ($(".logo_and_menu-row .right-icons .wrap_icon").length && $(".logo_and_menu-row .menu-row").length) {
2770    var menuPosition = $(".menu-row .menu-only").position().left,
2771      maxWidth = $(".logo_and_menu-row .maxwidth-theme").width() - 32,
2772      leftPadding = 0,
2773      rightPadding = 0;
2774
2775    $(".logo_and_menu-row .menu-row>div")
2776      .each(function (indx) {
2777        if (!$(this).hasClass("menu-only")) {
2778          var elementPosition = $(this).position().left,
2779            elementWidth = $(this).outerWidth();
2780
2781          if (elementPosition > menuPosition) {
2782            rightPadding += elementWidth;
2783          } else {
2784            leftPadding += elementWidth;
2785          }
2786        }
2787      })
2788      .promise()
2789      .done(function () {
2790        $(".logo_and_menu-row .menu-only").css({ "padding-left": leftPadding, "padding-right": rightPadding + 1 });
2791      });
2792  }
2793};*/
2794
2795/*function CheckTopMenuOncePadding() {
2796  if ($(".menu-row.sliced .right-icons .wrap_icon").length) {
2797    var menuPosition = $(".menu-row .menu-only").position().left,
2798      maxWidth = $(".logo_and_menu-row .maxwidth-theme").width() - 32,
2799      leftPadding = 0,
2800      rightPadding = 0;
2801
2802    $(".menu-row.sliced .maxwidth-theme>div>div")
2803      .each(function (indx) {
2804        if (!$(this).hasClass("menu-only")) {
2805          var elementPosition = $(this).position().left,
2806            elementWidth = $(this).outerWidth();
2807
2808          if (elementPosition > menuPosition) {
2809            rightPadding += elementWidth;
2810          } else {
2811            leftPadding += elementWidth;
2812          }
2813        }
2814      })
2815      .promise()
2816      .done(function () {
2817        $(".menu-row.sliced .menu-only").css({ "padding-left": leftPadding, "padding-right": rightPadding + 1 });
2818      });
2819  }
2820};
2821*/
2822
2823CheckSearchWidth = function () {
2824  if ($(".logo_and_menu-row .search_wrap").length) {
2825    var searchPosition = $(".logo_and_menu-row .search_wrap").position().left,
2826      maxWidth = $(".logo_and_menu-row .maxwidth-theme").width() - 32;
2827    width = 0;
2828
2829    $(".logo_and_menu-row .maxwidth-theme>div")
2830      .each(function () {
2831        if (!$(this).hasClass("search_wrap")) {
2832          var elementWidth = $(this).outerWidth();
2833
2834          width = width ? width - elementWidth : maxWidth - elementWidth;
2835        }
2836      })
2837      .promise()
2838      .done(function () {
2839        $(".logo_and_menu-row .search_wrap").outerWidth(width).css({ opacity: 1, visibility: "visible" });
2840      });
2841  }
2842};
2843
2844waitCounter = function (idCounter, delay, callback) {
2845  var obCounter = window["yaCounter" + idCounter];
2846  if (typeof obCounter == "object") {
2847    if (typeof callback == "function") callback();
2848  } else {
2849    setTimeout(function () {
2850      waitCounter(idCounter, delay, callback);
2851    }, delay);
2852  }
2853};
2854
2855waitYTPlayer = function (delay, callback) {
2856  if (typeof YT !== "undefined" && YT && YT.Player) {
2857    if (typeof callback == "function") callback();
2858  } else {
2859    setTimeout(function () {
2860      waitYTPlayer(delay, callback);
2861    }, delay);
2862  }
2863};
2864
2865var scrollToTopAnimateClassIn = false;
2866var scrollToTopAnimateClassOut = false;
2867
2868var $body = {};
2869var $scrolltotop = {};
2870var isOnceInited = false;
2871
2872if (navigator.userAgent.indexOf("Edge") != -1) document.documentElement.className += " edge";
2873
2874initFull = function () {
2875  checkMobileRegion();
2876};
2877
2878var isFrameDataReceived = false;
2879if (typeof window.frameCacheVars !== "undefined") {
2880  BX.addCustomEvent(window, "onFrameDataRequestFail", function (response) {
2881    // console.log(response);
2882  });
2883
2884  BX.addCustomEvent("onFrameDataReceivedBefore", function () {
2885    // stop ya metrika webvisor DOM indexer
2886    pauseYmObserver();
2887  });
2888
2889  BX.addCustomEvent("onFrameDataReceived", function (json) {
2890    initFull();
2891    CheckTopMenuDotted();
2892    // resume ya metrika webvisor
2893    // (100ms sliceHeight) + (200ms mCustomScroll) + (100ms lazyload)
2894    setTimeout(resumeYmObserver, 400);
2895
2896    isFrameDataReceived = true;
2897  });
2898} else {
2899  $(document).ready(initFull);
2900}
2901
2902scrollPreviewBlock = function () {
2903  scrollToBlock($.cookie("scroll_block"));
2904  $.cookie("scroll_block", null);
2905};
2906
2907checkMobileRegion = function () {
2908  if ($(".confirm_region").length) {
2909    if (!$(".top_mobile_region").length)
2910      $('<div class="top_mobile_region"><div class="confirm_region"></div></div>').insertBefore($(".body"));
2911    $(".top_mobile_region .confirm_region").html($(".regions .confirm_region").html());
2912  }
2913};
2914
2915$(document).on("click", ".map-items__item", function () {
2916  var _this = $(this),
2917    itemID = _this.data("id"),
2918    animationTime = 200;
2919
2920  _this.closest(".map-wrapper").find(".index-block__subtitle").addClass("hidden");
2921  _this.closest(".map-wrapper").find(".index-block__title-wrapper").addClass("hidden");
2922  _this.closest(".map-wrapper").find(".index-block__preview").addClass("hidden");
2923
2924  _this.closest(".map-container").find(" > .map-detail-items__item-svg").fadeIn(animationTime);
2925
2926  _this.closest(".map-items").fadeOut(animationTime, function () {
2927    _this.closest(".map-container").find(".map-detail-items").fadeIn(animationTime);
2928    _this
2929      .closest(".map-container")
2930      .find(".map-detail-items .map-detail-items__item[data-id=" + itemID + "]")
2931      .fadeIn(animationTime);
2932
2933    var arCoordinates = _this.data("coordinates").split(",");
2934
2935    if (typeof map === "object" && map !== null && "setCenter" in map) {
2936      if ($(".bx-google-map").length) {
2937        map.setCenter({ lat: +arCoordinates[0], lng: +arCoordinates[1] });
2938        map.setZoom(17);
2939      } else {
2940        map.setCenter([arCoordinates[0], arCoordinates[1]], 15);
2941      }
2942    }
2943  });
2944});
2945
2946$(document).on("click", ".map-detail-items__item-svg", function () {
2947  var _this = $(this).closest(".map-container").find(".map-detail-items__item:visible"),
2948    animationTime = 200;
2949
2950  _this.fadeOut(animationTime);
2951
2952  _this.closest(".map-container").find(" > .map-detail-items__item-svg").fadeOut(10);
2953
2954  _this
2955    .closest(".map-container")
2956    .find(".map-detail-items")
2957    .fadeOut(animationTime, function () {
2958      _this.closest(".map-container").find(".map-items").fadeIn(animationTime);
2959
2960      _this.closest(".map-wrapper").find(".index-block__subtitle").removeClass("hidden");
2961      _this.closest(".map-wrapper").find(".index-block__title-wrapper").removeClass("hidden");
2962      _this.closest(".map-wrapper").find(".index-block__preview").removeClass("hidden");
2963
2964      if (typeof map === "object" && map !== null) {
2965        if (typeof clusterer === "object" && clusterer !== null && "setBounds" in map && "getBounds" in clusterer) {
2966          map.setBounds(clusterer.getBounds(), {
2967            zoomMargin: 40,
2968            checkZoomRange: true
2969          });
2970        } else if (typeof bounds === "object" && bounds !== null && "fitBounds" in map && "getCenter" in bounds) {
2971          map.fitBounds(bounds);
2972        }
2973      }
2974    });
2975});
2976
2977$(document).ready(function () {
2978  scrollToTop();
2979  InitScrollBar();
2980  initCountdown();
2981
2982  // ripple effect for buttons
2983  $.ripple(".btn:not(.btn--no-rippple)", {
2984    debug: false, // Turn Ripple.js logging on/off
2985    on: "mouseenter", // The event to trigger a ripple effect
2986    opacity: 0.4, // The opacity of the ripple
2987    color: "auto", // Set the background color. If set to "auto", it will use the text color
2988    multi: true, // Allow multiple ripples per element
2989    duration: 0.6, // The duration of the ripple
2990    easing: "linear", // The CSS3 easing function of the ripple
2991  });
2992
2993  if (!jQuery.browser.safari) {
2994    CheckTopMenuPadding();
2995    CheckTopMenuOncePadding();
2996    CheckHeaderFixed();
2997    CheckTopMenuDotted();
2998    MegaMenuFixed();
2999    CheckSearchWidth();
3000    InitTopestMenuGummi();
3001    isOnceInited = true;
3002    /*
3003    setTimeout(function () {
3004      $(window).resize(); // need to check resize flexslider & menu
3005    }, 350);
3006    */
3007
3008    setTimeout(function () {
3009      $(window).scroll();
3010    }, 250); // need to check position fixed ask block
3011  } else {
3012    setTimeout(function () {
3013      $(window).resize(); // need to check resize flexslider & menu
3014
3015      setTimeout(function () {
3016        CheckTopMenuPadding();
3017        CheckTopMenuOncePadding();
3018        CheckHeaderFixed();
3019        CheckTopMenuDotted();
3020        MegaMenuFixed();
3021        CheckSearchWidth();
3022        InitTopestMenuGummi();
3023        isOnceInited = true;
3024
3025        setTimeout(function () {
3026          $(window).scroll();
3027        }, 50);
3028      }, 50);
3029    }, 350);
3030  }
3031
3032  if (arAsproOptions["THEME"]["USE_DEBUG_GOALS"] === "Y") {
3033    $.cookie("_ym_debug", "1");
3034  } else {
3035    $.cookie("_ym_debug", null);
3036  }
3037
3038  //  --- Bind mobile menu  ---
3039  var $mobileMenu = $("#mobilemenu");
3040  if ($mobileMenu.length) {
3041    $mobileMenu.isOpen = $mobileMenu.hasClass("show");
3042    $mobileMenu.isLeftSide = $("body").hasClass("mmenu_leftside");
3043    $mobileMenuNlo = $mobileMenu.find("[data-nlo]");
3044
3045    $(document).on("click", "#mobileheader .burger", function () {
3046      SwipeMobileMenu();
3047      CloseMobilePhone();
3048    });
3049
3050    $(document).on("click", ".mobilemenu__close", function () {
3051      CloseMobileMenu();
3052      $(".mobilemenu__menu-item").removeClass("mobilemenu__menu-item--expanded");
3053    });
3054
3055    $(document).on("click", ".mobilemenu__menu .toggle_block", function (e) {
3056      var $this = $(this);
3057      var $item = $this.closest(".mobilemenu__menu-item");
3058
3059      if ($item.hasClass("mobilemenu__menu-item--parent")) {
3060        e.preventDefault();
3061
3062        $item.addClass("mobilemenu__menu-item--expanded");
3063        MoveMobileMenuWrapNext();
3064      }
3065    });
3066
3067    $(document).on("click", ".mobilemenu__menu a", function (e) {
3068      var $this = $(this);
3069      var $item = $this.closest(".mobilemenu__menu-item");
3070
3071      if ($item.hasClass("mobilemenu__menu-item--back")) {
3072        e.preventDefault();
3073
3074        MoveMobileMenuWrapPrev();
3075        setTimeout(function () {
3076          $item.closest(".mobilemenu__menu-item--expanded").removeClass("mobilemenu__menu-item--expanded");
3077        }, 400);
3078      } else {
3079        var href = $this.attr("href");
3080        if (typeof href !== "undefined") {
3081          if (href.length) {
3082            window.location.href = href;
3083            //window.location.reload();
3084          } else {
3085            if ($item.hasClass("mobilemenu__menu-item--parent")) {
3086              e.preventDefault();
3087
3088              $item.addClass("mobilemenu__menu-item--expanded");
3089              MoveMobileMenuWrapNext();
3090
3091              return;
3092            } else if ($item.hasClass("mobilemenu__menu-item--title")) {
3093              e.preventDefault();
3094
3095              return;
3096            }
3097          }
3098        }
3099
3100        CloseMobileMenu();
3101      }
3102    });
3103
3104    if ($mobileMenu.isLeftSide) {
3105      $mobileMenu.parent().append('<div class="mobilemenu__overlay"></div>');
3106      var $mobileMenuOverlay = $(".mobilemenu__overlay");
3107
3108      $mobileMenuOverlay.click(function () {
3109        if ($mobileMenu.isOpen) {
3110          CloseMobileMenu();
3111        }
3112      });
3113
3114      $(document).swiperight(function (e) {
3115        if (
3116          !$(e.target).closest(".owl-carousel").length &&
3117          !$(e.target).closest(".swipeignore").length &&
3118          !$(e.target).closest(".mobile-scrolled").length &&
3119          !$(e.target).closest(".swiper").length
3120        ) {
3121          var partWindowWidth = document.documentElement.clientWidth / 3;
3122          var swipeStart = e.swipestart.coords[0];
3123          if (swipeStart <= partWindowWidth) {
3124            OpenMobileMenu();
3125          }
3126        }
3127      });
3128
3129      $(document).swipeleft(function (e) {
3130        if (
3131          !$(e.target).closest(".owl-carousel").length &&
3132          !$(e.target).closest(".swipeignore").length &&
3133          !$(e.target).closest(".mobile-scrolled").length &&
3134          !$(e.target).closest(".swiper").length
3135        ) {
3136          CloseMobileMenu();
3137        }
3138      });
3139    } else {
3140      $(document).on("click", "#mobileheader", function (e) {
3141        if (
3142          !$(e.target).closest("#mobilemenu").length &&
3143          !$(e.target).closest(".burger").length &&
3144          $mobileMenu.isOpen
3145        ) {
3146          CloseMobileMenu();
3147        }
3148      });
3149    }
3150
3151    OpenMobileMenu = function () {
3152      if (!$mobileMenu.isOpen && window.matchMedia("(max-width: 991px)").matches) {
3153        // hide styleswitcher
3154        if ($(".style-switcher").hasClass("active")) {
3155          $(".style-switcher .switch").trigger("click");
3156        }
3157        $(".style-switcher .switch").hide();
3158        $(".style-switcher .switch_presets").hide();
3159
3160        if ($mobileMenu.isLeftSide) {
3161          setTimeout(function () {
3162            // hide body scroll
3163            $("body").addClass("overflow-block");
3164
3165            // blur body
3166            $("#mobileheader").addClass("filter-none");
3167            $("#mobilemenu").addClass("filter-none");
3168            $("body").addClass("jqm-initied");
3169
3170            // show overlay
3171            $mobileMenuOverlay.fadeIn("fast");
3172          }, 100);
3173        } else {
3174          // hide body scroll
3175          $("body").addClass("overflow-block");
3176
3177          // set menu top = bottom of header
3178          $mobileMenu.css({
3179            top: +($("#mobileheader")[0].getBoundingClientRect().top + $("#mobileheader").height()) + "px",
3180          });
3181
3182          // change burger icon
3183          // $('#mobileheader .burger').addClass('c');
3184        }
3185
3186        // show menu
3187        $mobileMenu.addClass("show");
3188        $mobileMenu.isOpen = true;
3189
3190        var $inner = $mobileMenu.find(".mobilemenu__inner");
3191        var params = $inner.data("params");
3192        if (typeof params === "undefined") {
3193          params = {
3194            depth: 0,
3195            scroll: {},
3196            height: {},
3197          };
3198        }
3199        $inner.data("params", params);
3200
3201        if ($mobileMenuNlo.length) {
3202          if (!$mobileMenuNlo.hasClass("nlo-loadings")) {
3203            $mobileMenuNlo.addClass("nlo-loadings");
3204            setTimeout(function () {
3205              $.ajax({
3206                data: { nlo: $mobileMenuNlo.attr("data-nlo") },
3207                error: function () {
3208                  $mobileMenuNlo.removeClass("nlo-loadings");
3209                },
3210                complete: function (jqXHR, textStatus) {
3211                  if (textStatus === "success" || jqXHR.status == 404) {
3212                    var ob = BX.processHTML($.trim(jqXHR.responseText));
3213                    BX.ajax.processScripts(ob.SCRIPT);
3214                    $mobileMenuNlo.replaceWith(ob.HTML);
3215                  }
3216                },
3217              });
3218            }, 300);
3219          }
3220        }
3221      }
3222    };
3223
3224    CloseMobileMenu = function () {
3225      if ($mobileMenu.isOpen) {
3226        // hide menu
3227        $mobileMenu.removeClass("show");
3228        $mobileMenu.isOpen = false;
3229
3230        // show styleswitcher
3231        $(".style-switcher .switch").show();
3232        $(".style-switcher .switch_presets").show();
3233
3234        if ($mobileMenu.isLeftSide) {
3235          setTimeout(function () {
3236            // hide overlay
3237            $mobileMenuOverlay.fadeOut("fast");
3238
3239            // show body scroll
3240            $("body").removeClass("overflow-block");
3241
3242            // unblur body
3243            $("body").removeClass("jqm-initied");
3244            $("#mobilemenu").removeClass("filter-none");
3245            $("#mobileheader").removeClass("filter-none");
3246          }, 100);
3247        } else {
3248          // change burger icon
3249          // $('#mobileheader .burger').removeClass('c');
3250
3251          // show body scroll
3252          $("body").removeClass("overflow-block");
3253        }
3254
3255        setTimeout(function () {
3256          var $scroller = $mobileMenu.find(".mobilemenu");
3257          var $inner = $mobileMenu.find(".mobilemenu__inner");
3258          var params = $inner.data("params");
3259          params.depth = 0;
3260          $inner.data("params", params).attr("style", "");
3261          $mobileMenu.scrollTop(0);
3262          $scroller.css("height", "");
3263        }, 400);
3264      }
3265    };
3266
3267    SwipeMobileMenu = function () {
3268      if ($mobileMenu.isOpen) {
3269        CloseMobileMenu();
3270      } else {
3271        OpenMobileMenu();
3272      }
3273    };
3274
3275    CheckMobileMenu = function () {
3276      if (!window.matchMedia("(max-width: 991px)").matches) {
3277        CloseMobileMenu();
3278      }
3279    };
3280
3281    function MoveMobileMenuWrapNext() {
3282      var $scroller = $mobileMenu.find(".mobilemenu");
3283      var $inner = $mobileMenu.find(".mobilemenu__inner");
3284      if ($inner.length) {
3285        var params = $inner.data("params");
3286        var $dropdownNext = $mobileMenu
3287          .find(".mobilemenu__menu-item--expanded>.mobilemenu__menu-dropdown")
3288          .eq(params.depth);
3289        if ($dropdownNext.length) {
3290          // save scroll position
3291          params.scroll[params.depth] = parseInt($mobileMenu.scrollTop());
3292
3293          // height while move animating
3294          params.height[params.depth + 1] = Math.max(
3295            $dropdownNext.height(),
3296            !params.depth
3297              ? $inner.height()
3298              : $mobileMenu
3299                  .find(".mobilemenu__menu-item--expanded>.mobilemenu__menu-dropdown")
3300                  .eq(params.depth - 1)
3301                  .outerHeight()
3302          );
3303          $scroller.css("height", params.height[params.depth + 1] + "px");
3304
3305          // inc depth
3306          ++params.depth;
3307
3308          // translateX for move
3309          $inner.css("transform", "translateX(" + -100 * params.depth + "%)");
3310
3311          // scroll to top
3312          setTimeout(function () {
3313            $mobileMenu.animate({ scrollTop: 0 }, 200);
3314          }, 100);
3315
3316          // height on enimating end
3317          var h =
3318            $dropdownNext.height() +
3319            parseInt($dropdownNext.css("padding-top")) +
3320            parseInt($dropdownNext.css("padding-bottom"));
3321          setTimeout(function () {
3322            if (h) {
3323              $scroller.css("height", h + "px");
3324            } else {
3325              $scroller.css("height", "");
3326            }
3327          }, 200);
3328        }
3329
3330        $inner.data("params", params);
3331      }
3332    }
3333
3334    function MoveMobileMenuWrapPrev() {
3335      var $scroller = $mobileMenu.find(".mobilemenu");
3336      var $inner = $mobileMenu.find(".mobilemenu__inner");
3337      if ($inner.length) {
3338        var params = $inner.data("params");
3339        if (params.depth > 0) {
3340          var $dropdown = $mobileMenu
3341            .find(".mobilemenu__menu-item--expanded>.mobilemenu__menu-dropdown")
3342            .eq(params.depth - 1);
3343          if ($dropdown.length) {
3344            // height while move animating
3345            $scroller.css("height", params.height[params.depth] + "px");
3346
3347            // dec depth
3348            --params.depth;
3349
3350            // translateX for move
3351            $inner.css("transform", "translateX(" + -100 * params.depth + "%)");
3352
3353            // restore scroll position
3354            setTimeout(function () {
3355              $mobileMenu.animate({ scrollTop: params.scroll[params.depth] }, 200);
3356            }, 100);
3357
3358            // height on enimating end
3359            var h = !params.depth
3360              ? false
3361              : $mobileMenu
3362                  .find(".mobilemenu__menu-item--expanded>.mobilemenu__menu-dropdown")
3363                  .eq(params.depth - 1)
3364                  .outerHeight();
3365            setTimeout(function () {
3366              if (h) {
3367                $scroller.css("height", h + "px");
3368              } else {
3369                $scroller.css("height", "");
3370              }
3371            }, 200);
3372          }
3373        }
3374
3375        $inner.data("params", params);
3376      }
3377    }
3378  }
3379  //  --- END Bind mobile menu  ---
3380
3381  //  --- Bind mobile phone ---
3382  if ($("#mobilephones").length) {
3383    $(document).on("click", ".mobileheader .phones__inner .icon-block__only-icon", function (e) {
3384      e.stopPropagation();
3385      SwipeMobilePhone();
3386    });
3387
3388    $(document).on("click", ".mobilephones__menu-item a,.mobilephones__close", function (e) {
3389      e.stopPropagation();
3390      CloseMobilePhone();
3391    });
3392  }
3393
3394  SwipeMobilePhone = function () {
3395    if ($("#mobilephones.show").length) {
3396      CloseMobilePhone();
3397    } else {
3398      OpenMobilePhone();
3399    }
3400  };
3401
3402  OpenMobilePhone = function () {
3403    if (!$("#mobilephones.show").length) {
3404      CloseMobileMenu();
3405
3406      // show overlay
3407      $('<div class="jqmOverlay mobp"></div>').appendTo("body");
3408
3409      // blur body
3410      $("#mobileheader").addClass("filter-none");
3411      $("body").addClass("jqm-initied");
3412      $("body").addClass('overflow-block');
3413
3414      // toggle phones
3415      setTimeout(function () {
3416        $("#mobilephones").slideDown("fast", function () {
3417          $("#mobilephones").addClass("show");
3418        });
3419      }, 100);
3420    }
3421  };
3422
3423  CloseMobilePhone = function () {
3424    if ($("#mobilephones.show").length) {
3425      // toggle phones
3426      setTimeout(function () {
3427        $("#mobilephones").slideUp("fast", function () {
3428          $("#mobilephones").removeClass("show");
3429
3430          // unblur body
3431          $("body").removeClass("jqm-initied");
3432          $("#mobileheader").removeClass("filter-none");
3433          $("body").removeClass('overflow-block');
3434
3435          // hide overlay
3436          $(".jqmOverlay.mobp").remove();
3437        });
3438      }, 100);
3439    }
3440  };
3441
3442  checkMobilePhone = function () {
3443    if (!window.matchMedia("(max-width: 991px)").matches) {
3444      CloseMobilePhone();
3445    }
3446  };
3447  //  --- END Bind mobile phone ---
3448
3449  // change type2 menu for fixed
3450  if ($("#headerfixed .js-nav").length) {
3451    if (arAsproOptions["THEME"]["HEADER_FIXED"] == 2) CheckHeaderFixedMenu();
3452
3453    setTimeout(function () {
3454      $("#headerfixed .js-nav").addClass("opacity1");
3455    }, 350);
3456  }
3457
3458  // close search block
3459  $("html, body").on("mousedown", function (e) {
3460    if (typeof e.target.className == "string" && e.target.className.indexOf("adm") < 0) {
3461      e.stopPropagation();
3462      var search_target = $(e.target).closest(".searche-result");
3463      if (
3464        !$(e.target).closest("#mobileheader").length &&
3465        !$(e.target).closest("#mobilefilter").length &&
3466        !$(e.target).closest(".popup").length &&
3467        !$(e.target).hasClass("inline-search-block") &&
3468        !$(e.target).hasClass("svg") &&
3469        !search_target.length
3470      ) {
3471        $(".inline-search-block").removeClass("show");
3472        $(".title-search-result").hide();
3473
3474        if (arAsproOptions["THEME"]["TYPE_SEARCH"] == "fixed") {
3475          $(".jqmOverlay.search").detach();
3476          $("body").removeClass("jqm-initied");
3477        }
3478
3479        $("body").removeClass("overflow-block");
3480      }
3481
3482      if (isMobile) {
3483        if (search_target.length) location.href = search_target.attr("href");
3484      }
3485
3486      if (!$(e.target).closest(".hint.active").length) {
3487        $(".hint.active .hint__icon").trigger("click");
3488      }
3489
3490      var class_name = $(e.target).attr("class");
3491      if (typeof class_name == "undefined" || class_name.indexOf("tooltip") < 0)
3492        //tooltip link
3493        $(".tooltip-link").tooltip("hide");
3494    }
3495  });
3496
3497  $(document).on("click", ".jqmOverlay", function () {
3498    HideOverlay();
3499  });
3500
3501  $(".inline-search-block")
3502    .find("*")
3503    .on("mousedown", function (e) {
3504      e.stopPropagation();
3505    });
3506
3507  $(".filter-action").on("click", function () {
3508    $(this).toggleClass("active");
3509    $(this).find(".svg").toggleClass("white");
3510    if ($(".introtext").length) {
3511      var top_pos = $(".filters-wrap").position();
3512      $(".bx_filter").css({ top: top_pos.top + 40 });
3513    }
3514    $(".bx_filter").slideToggle();
3515  });
3516
3517  // -- scroll after apply option
3518  scrollPreviewBlock();
3519
3520  $.extend($.validator.messages, {
3521    required: BX.message("JS_REQUIRED"),
3522    email: BX.message("JS_FORMAT"),
3523    equalTo: BX.message("JS_PASSWORD_COPY"),
3524    minlength: BX.message("JS_PASSWORD_LENGTH"),
3525    remote: BX.message("JS_ERROR"),
3526  });
3527
3528  $.validator.addMethod(
3529    "regexp",
3530    function (value, element, regexp) {
3531      var re = new RegExp(regexp);
3532      return this.optional(element) || re.test(value);
3533    },
3534    BX.message("JS_FORMAT")
3535  );
3536
3537  $.validator.addMethod(
3538    "filesize",
3539    function (value, element, param) {
3540      return this.optional(element) || element.files[0].size <= param;
3541    },
3542    BX.message("JS_FILE_SIZE")
3543  );
3544
3545  $.validator.addMethod(
3546    "date",
3547    function (value, element, param) {
3548      var status = false;
3549      if (!value || value.length <= 0) {
3550        status = true;
3551      } else {
3552        var re = new RegExp("^([0-9]{2})(.)([0-9]{2})(.)([0-9]{4})$");
3553        var matches = re.exec(value);
3554        if (matches) {
3555          var composedDate = new Date(matches[5], matches[3] - 1, matches[1]);
3556          status =
3557            composedDate.getMonth() == matches[3] - 1 &&
3558            composedDate.getDate() == matches[1] &&
3559            composedDate.getFullYear() == matches[5];
3560        }
3561      }
3562      return status;
3563    },
3564    BX.message("JS_DATE")
3565  );
3566
3567  $.validator.addMethod(
3568    "datetime",
3569    function (value, element, param) {
3570      var status = false;
3571      if (!value || value.length <= 0) {
3572        status = true;
3573      } else {
3574        var re = new RegExp("^([0-9]{2})(.)([0-9]{2})(.)([0-9]{4}) ([0-9]{1,2}):([0-9]{1,2})$");
3575        var matches = re.exec(value);
3576        if (matches) {
3577          var composedDate = new Date(matches[5], matches[3] - 1, matches[1], matches[6], matches[7]);
3578          status =
3579            composedDate.getMonth() == matches[3] - 1 &&
3580            composedDate.getDate() == matches[1] &&
3581            composedDate.getFullYear() == matches[5] &&
3582            composedDate.getHours() == matches[6] &&
3583            composedDate.getMinutes() == matches[7];
3584        }
3585      }
3586      return status;
3587    },
3588    BX.message("JS_DATETIME")
3589  );
3590
3591  $.validator.addMethod(
3592    "extension",
3593    function (value, element, param) {
3594      param = typeof param === "string" ? param.replace(/,/g, "|") : "png|jpe?g|gif";
3595      return this.optional(element) || value.match(new RegExp(".(" + param + ")$", "i"));
3596    },
3597    BX.message("JS_FILE_EXT")
3598  );
3599
3600  $.validator.addMethod(
3601    "captcha",
3602    function (value, element, params) {
3603      let $sid = $(element).closest("form").find('input[name="captcha_sid"]');
3604      if (!$sid.length) {
3605        $sid = $(element).closest("form").find('input[name="captcha_code"]');
3606      }
3607
3608      let sid = $sid.val();
3609
3610      return $.validator.methods.remote.call(this, value, element, {
3611        url: arAsproOptions["SITE_DIR"] + "ajax/check-captcha.php",
3612        type: "post",
3613        data: {
3614          captcha_word: value,
3615          captcha_sid: sid,
3616        },
3617      });
3618    },
3619    BX.message("JS_ERROR")
3620  );
3621
3622  $.validator.addMethod(
3623    "recaptcha",
3624    function (value, element, param) {
3625      if (BX.Aspro?.Captcha) {
3626        return BX.Aspro.Captcha.validate(element);
3627      }
3628
3629      return true;
3630    },
3631    BX.message("JS_RECAPTCHA_ERROR")
3632  );
3633
3634  $.validator.addClassRules({
3635    phone: {
3636      regexp: arAsproOptions["THEME"]["VALIDATE_PHONE_MASK"],
3637    },
3638    confirm_password: {
3639      equalTo: "input.password",
3640      minlength: 6,
3641    },
3642    password: {
3643      minlength: 6,
3644    },
3645    inputfile: {
3646      extension: arAsproOptions["THEME"]["VALIDATE_FILE_EXT"],
3647      filesize: 5000000,
3648    },
3649    datetime: {
3650      datetime: "",
3651    },
3652    captcha: {
3653      captcha: "",
3654    },
3655    recaptcha: {
3656      recaptcha: "",
3657    },
3658  });
3659
3660  $.validator.setDefaults({
3661    highlight: function (element) {
3662      $(element).parent().addClass("error");
3663    },
3664    unhighlight: function (element) {
3665      $(element).parent().removeClass("error");
3666    },
3667    errorPlacement: function(error, element) {
3668        error.insertBefore(element);
3669    },
3670    messages: {
3671      licenses_popup: {
3672      required: BX.message('JS_REQUIRED_LICENSES'),
3673    },
3674      licenses_subscribe: {
3675        required: BX.message('JS_REQUIRED_LICENSES')
3676    }
3677  }
3678  });
3679
3680  // expand/hide filter values
3681  $(document).on("click", ".expand_block", function () {
3682    togglePropBlock($(this));
3683  });
3684
3685  // popup img list
3686  $(document).on("click", ".fancy-js", function () {
3687    const parent = $(this).closest(".image-list");
3688    let arItems = [];
3689    let index = 0;
3690    parent.find("[data-big]").each(function () {
3691      let _this = $(this);
3692      let obItem = {
3693        src: _this.data("big"),
3694        opts: {
3695          caption: _this.attr("alt"),
3696        },
3697      };
3698      arItems.push(obItem);
3699    });
3700    index = parent.find(".active").index();
3701    if (arItems.length) {
3702      if (typeof $.fn.fancybox === "function") {
3703        $.fancybox.open(arItems, { loop: false }, index);
3704      }
3705    }
3706  });
3707
3708  $(".mobilemenu__menu-item--city a").on("click", function (e) {
3709    e.preventDefault();
3710    var _this = $(this);
3711    $.removeCookie("current_region");
3712
3713    if (arAsproOptions["SITE_ADDRESS"].indexOf(",") != "-1") {
3714      var arDomains = arAsproOptions["SITE_ADDRESS"].split(",");
3715      if (arDomains) {
3716        for (var i in arDomains) {
3717          var domain_name = arDomains[i].replace("\n", "");
3718          domain_name = arDomains[i].replace("'", "");
3719          $.cookie("current_region", _this.data("id"), { path: "/", domain: domain_name });
3720        }
3721      }
3722    }
3722 else $.cookie("current_region", _this.data("id"), { path: "/", domain: arAsproOptions["SITE_ADDRESS"] });
3723
3724    location.href = _this.attr("href");
3725  });
3726
3727  InitOwlSlider();
3728  InitFlexSlider();
3729  InitFlexSliderMin();
3730
3731  InitFancyBox();
3732  InitFancyBoxVideo();
3733
3734  // for check flexslider bug in composite mode
3735  waitingNotExists(".detail .galery #slider", ".detail .galery #slider .flex-viewport", 1000, function () {
3736    InitOwlSlider();
3737    InitFlexSlider();
3738    setTimeout(function () {
3739      $(window).resize();
3740    }, 350);
3741  });
3742
3743  // change view type catalog
3744  $(".view-button").on("click", function () {
3745    $(this).siblings().removeClass("cur");
3746    $(this).addClass("cur");
3747  });
3748
3749  // -- escape close popup form
3750  $(document).on("keydown", function (e) {
3751    if (e.keyCode == 27) {
3752      if ($('.main-user-consent-request-popup:visible').length) {
3753        BX.onCustomEvent('onUserConsentHide', []);
3754        return;
3755      }
3756      if ($(".jqmWindow.show").length) $(".jqmWindow.show:last").jqmHide();
3757      if ($(".inline-search-block.fixed.show").length) {
3758        $(".inline-search-block.fixed .inline-search-hide").click();
3759        setTimeout(function () {
3760          $(".title-search-result").hide();
3761        }, 0);
3762      }
3763      if ($(".mega-fixed-menu").is(":visible")) {
3764        $(".mega-fixed-menu .mega-fixed-menu__close").click();
3765      }
3766    }
3767  });
3768
3769  $(".right_dok .link>span").on("click", function (e) {
3770    if ($(this).hasClass("jqm_disable")) {
3771      $(".jqmWindow.right_slide.opened").jqmHide();
3772      e.stopImmediatePropagation(); // need for stop jqm open standart script
3773    }
3774  });
3775
3776  $(document).on("click", '*[data-event="jqm"]', function (e) {
3777    e.preventDefault();
3778    e.stopPropagation();
3779    if (!$(this).hasClass("clicked")) {
3780      $(this).addClass("clicked");
3781      $(this).jqmEx();
3782      $(this).trigger("click");
3783    }
3784  });
3785
3786  $(".animate-load").on("click", function () {
3787    $(this).parent().addClass("loadings");
3788  });
3789
3790  BX.addCustomEvent("onCompleteAction", function (eventdata, _this) {
3791    try {
3792      if (eventdata.action === "loadForm") {
3793        $(_this).parent().removeClass("loadings");
3794        $(_this).removeClass("clicked");
3795      } else if (eventdata.action === "loadBasket") {
3796        var basket_js_block = $(".js-basket-block");
3797        if (basket_js_block.length) {
3798          var count = basket_js_block.find(".header-cart__count").length
3799            ? parseInt($(_this).find(".count").text())
3800            : parseInt($(_this).find(".header-cart__count").text());
3801          if (count) {
3802            basket_js_block.removeClass("header-cart__inner--empty");
3803          } else {
3804            basket_js_block.addClass("header-cart__inner--empty");
3805          }
3806        }
3807
3808        setBasketItemsClasses();
3809      } else if (eventdata.action === "loadRSS") {
3810      } else if (eventdata.action === "jsLoadBlock") {
3811        InitScrollBar();
3812      } else if (eventdata.action === "ajaxContentLoaded") {
3813        if ("type" in eventdata) {
3814          if (eventdata.type == "table_block") {
3815            $(".catalog.item-views.table .item .title").sliceHeight();
3816            $(".catalog.item-views.table .item .cont").sliceHeight();
3817            // $('.catalog.item-views.table .item .slice_price').sliceHeight();
3818            $(".catalog.item-views.table .item").sliceHeight({ classNull: ".footer-button" });
3819          } else if (eventdata.type == "table_block2") {
3820            $(".catalog.item-views.table .item .title").sliceHeight();
3821            $(".catalog.item-views.table .item .cont").sliceHeight({
3822              autoHeightBlock: ".cont_inner",
3823              classNull: ".props_wrapper",
3824            });
3825            // $('.catalog.item-views.table .item .slice_price').sliceHeight();
3826            $(".catalog.item-views.table .item").sliceHeight({
3827              classNull: ".footer-button",
3828              autoHeightBlock: ".cont_inner",
3829              callback: setHoverHeight,
3830            });
3831          }
3832        }
3833      }
3834    } catch (e) {
3835      console.error(e);
3836    }
3837  });
3838
3839  BX.addCustomEvent("onCounterGoals", function (eventdata) {
3840    if (arAsproOptions["THEME"]["YA_GOALS"] == "Y" && arAsproOptions["THEME"]["YA_COUNTER_ID"]) {
3841      var idCounter = arAsproOptions["THEME"]["YA_COUNTER_ID"];
3842      idCounter = parseInt(idCounter);
3843
3844      if (typeof eventdata != "object") eventdata = { goal: "undefined" };
3845
3846      if (typeof eventdata.goal != "string") eventdata.goal = "undefined";
3847
3848      if (idCounter) {
3849        try {
3850          waitCounter(idCounter, 50, function () {
3851            var obCounter = window["yaCounter" + idCounter];
3852            if (typeof obCounter == "object") {
3853              obCounter.reachGoal(eventdata.goal);
3854            }
3855          });
3856        } catch (e) {
3857          console.error(e);
3858        }
3859      } else {
3860        console.info("Bad counter id!", idCounter);
3861      }
3862    }
3863  });
3864
3865  BX.addCustomEvent(window, "onAjaxSuccess", function (e) {
3866    if (e != "OK") {
3867      InitOwlSlider();
3868      InitFlexSlider();
3869      InitFlexSliderMin();
3870    }
3871  });
3872
3873  // show print
3874  if (arAsproOptions["THEME"]["PRINT_BUTTON"] == "Y") {
3875    setTimeout(function () {
3876      if ($(".page-top .rss-block.top").length) {
3877        $('<div class="print-link"><i class="svg svg-print"></i></div>').insertBefore(
3878          $(".page-top .rss-block.top .shares-block")
3879        );
3880      } else if ($(".page-top .rss").length) {
3881        $('<div class="print-link"><i class="svg svg-print"></i></div>').insertAfter($(".page-top .rss"));
3882      } else if ($(".page-top h1").length)
3883        $('<div class="print-link"><i class="svg svg-print"></i></div>').insertBefore($(".page-top h1"));
3884      // else
3885      // $('footer .print-block').html('<div class="print-link"><i class="svg svg-print"><svg id="Print.svg" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewB
3885ox="0 0 16 16"><path class="cls-1" d="M1553,287h-2v3h-8v-3h-2a2,2,0,0,1-2-2v-5a2,2,0,0,1,2-2h2v-4h8v4h2a2,2,0,0,1,2,2v5A2,2,0,0,1,1553,287Zm-8,1h4v-4h-4v4Zm4-12h-4v2h4v-2Zm4,4h-12v5h2v-3h8v3h2v-5Z" transform="translate(-1539 -274)"/></svg></i></div>');
3886    }, 150);
3887  }
3888
3889  $(document).on("click", ".print-link", function () {
3890    window.print();
3891  });
3892
3893  $(".head-block .item-link").on("click", function () {
3894    var _this = $(this);
3895    _this.siblings().removeClass("active");
3896    _this.addClass("active");
3897  });
3898
3899  //alert(navigator.userAgent);
3900  $("table.table").each(function () {
3901    var _this = $(this),
3902      first_td = _this.find("thead tr th");
3903    if (!first_td.length) first_td = _this.find("thead tr td");
3904    if (first_td.length) {
3905      _this.find("tbody tr:not(.nomobile)").each(function (i) {
3906        $(this)
3907          .find("td")
3908          .each(function (i) {
3909            if (typeof first_td[i] !== "undefined")
3910              $('<div class="th-mobile">' + first_td[i].textContent + "</div>").appendTo($(this));
3911          });
3912      });
3913    }
3914  });
3915
3916  if ($("a.fancybox").length) {
3917    if (typeof $.fn.fancybox == "function") {
3918      $("a.fancybox").fancybox();
3919    }
3920  }
3921
3922  // flex pagination
3923  $(document).on("mouseenter", ".flex-viewport .item", function () {
3924    $(this).closest(".flexslider").find(".flex-control-nav").toggleClass("noz");
3925    $(this).closest(".flexslider").find(".flex-control-nav").css("z-index", "0");
3926  });
3927  $(document).on("mouseleave", ".flex-viewport .item", function () {
3928    $(this).closest(".flexslider").find(".flex-control-nav").toggleClass("noz");
3929    $(this).closest(".flexslider").find(".flex-control-nav").css("z-index", "2");
3930  });
3931
3932  // ajax more items
3933  $(document).on("click", ".ajax_load_btn", function () {
3934    var url = $(this).closest(".bottom_nav").find(".arrows-pagination__next").attr("href"),
3935      th = $(this).find(".more_text_ajax"),
3936      _this = $(this),
3937      bottom_nav = $(this).closest(".bottom_nav");
3938    if (!th.hasClass("loading")) {
3939      th.addClass("loading");
3940      var objUrl = parseUrlQuery(),
3941        add_url = "",
3942        obData = { AJAX_REQUEST: "Y", ajax_get: "Y", bitrix_include_areas: "N" };
3943
3944      //index page
3945      if ($(".body.index").length) {
3946        var class_block = th.closest(".drag-block").data("class").replace("_drag", "");
3947        class_block = class_block.replace(/\s/g, "");
3948        obData.BLOCK = class_block;
3949      }
3950      if (_this.closest(".ajax-pagination-wrapper").length) {
3951        obData.BLOCK = _this.closest(".ajax-pagination-wrapper").data("class");
3952      }
3953      if ("clear_cache" in objUrl && objUrl.clear_cache == "Y") {
3954        add_url = "&clear_cache=Y";
3955      }
3956      if ($(".banners-small.front").length) {
3957        obData.MD = $(".banners-small.front").find(".items").data("colmd");
3958        obData.SM = $(".banners-small.front").find(".items").data("colsm");
3959      }
3960
3961      //tabs block
3962      if (_this.closest(".tab-content-block").length) {
3963        var filter = th.closest(".tab-content-block").data("filter");
3964        obData.GLOBAL_FILTER = filter;
3965      }
3966      $.ajax({
3967        url: url + "" + add_url,
3968        data: BX.ajax.prepareData(obData),
3969        success: function (html) {
3970          var html = html.trim();
3971          var mobileBottomClicked = bottom_nav.hasClass("mobile_slider");
3972          var hasMobileBottomNav = $(html).find(".bottom_nav.mobile_slider");
3973          var bottomNav = hasMobileBottomNav.length ? hasMobileBottomNav : $(html).find(".bottom_nav");
3974          var bottomNavHtml = bottomNav.html();
3975          var bottomNavScrollClass = bottomNav.data("scroll-class");
3976          var hasBottomNav = $(html).find(".ajax_load_btn").length;
3977
3978          var eventdata = { action: "ajaxContentLoaded", content: html };
3979
3980          if ($(".banners-small.front").length) {
3981            $(".banners-small .items.row").append(html);
3982            $(".bottom_nav").html($(".banners-small .items.row .bottom_nav").html());
3983            $(".banners-small .items.row .bottom_nav").remove();
3984          } else if (bottom_nav.data("append") !== undefined && bottom_nav.data("parent") !== undefined) {
3985            var $slider = th.closest(bottom_nav.data("parent")).find(".owl-carousel");
3986            if ($slider.length) {
3987              var obData = BX.processHTML(html);
3988              html = obData.HTML;
3989
3990              var $slides = $("<div>" + html + "</div>").find(">*");
3991              $slides.each(function () {
3992                if (!$(this).hasClass("wrap_nav")) {
3993                  $slider.trigger("add.owl.carousel", [$(this).wrap("<div></div>").parent().html()]);
3994                }
3995              });
3996              $slider.trigger("refresh.owl.carousel");
3997
3998              setTimeout(function () {
3999                BX.ajax.processScripts(obData.SCRIPT);
4000              }, 100);
4001            } else {
4002              var target = html;
4003              if (bottom_nav.data("target") !== undefined) {
4004                target = $(html).find(bottom_nav.data("target"));
4005              }
4006              if (mobileBottomClicked || hasMobileBottomNav.length) {
4007                var mobileSliderNav = th.closest(bottom_nav.data("parent")).find(".bottom_nav.mobile_slider");
4008                if (mobileSliderNav.length) {
4009                  mobileSliderNav.before(target);
4010                } else {
4011                  bottom_nav.before(target);
4012                }
4013              } else {
4014                th.closest(bottom_nav.data("parent")).find(bottom_nav.data("append")).append(target);
4015              }
4016              th.closest(bottom_nav.data("parent"))
4017                .find(bottom_nav.data("append"))
4018                .find(".bottom_nav_wrapper")
4019                .remove();
4020
4021              if (hasBottomNav) {
4022                if (bottomNavScrollClass !== undefined) {
4023                  th.closest(bottom_nav.data("parent")).find(bottomNavScrollClass).addClass("has-bottom-nav");
4024                }
4025                th.closest(bottom_nav.data("parent")).find(bottom_nav.data("append")).addClass("has-bottom-nav");
4026              } else {
4027                if (bottomNavScrollClass !== undefined) {
4028                  th.closest(bottom_nav.data("parent")).find(bottomNavScrollClass).removeClass("has-bottom-nav");
4029                }
4030                th.closest(bottom_nav.data("parent")).find(bottom_nav.data("append")).removeClass("has-bottom-nav");
4031              }
4032            }
4033
4034            bottom_nav = th.closest(bottom_nav.data("parent")).find(".bottom_nav");
4035            bottom_nav.html(bottomNavHtml);
4036            var icon = bottom_nav.find(".svg-inline-bottom_nav-icon");
4037            icon.css("display", "");
4038
4039            eventdata.container = th.closest(bottom_nav.data("parent"));
4040          } else {
4041            $(html).insertBefore($(".blog .bottom_nav"));
4042            $(".bottom_nav").html($(".blog .bottom_nav:hidden").html());
4043            $(".blog .bottom_nav:hidden").remove();
4044          }
4045
4046          setTimeout(function () {
4047            BX.onCustomEvent("onCompleteAction", [eventdata, th[0]]);
4048            $(".banners-small .item.normal-block").sliceHeight();
4049            th.removeClass("loading");
4050          }, 100);
4051        },
4052      });
4053    }
4054  });
4055
4056  // bug fix in ff
4057  $("img").removeAttr("draggable");
4058
4059  // Responsive Menu Events
4060  var addActiveClass = false;
4061  $("#mainMenu li.dropdown > a > i, #mainMenu li.dropdown-submenu > a > i").on("click", function (e) {
4062    e.preventDefault();
4063    if ($(window).width() > 979) return;
4064    addActiveClass = $(this).closest("li").hasClass("resp-active");
4065    // $('#mainMenu').find('.resp-active').removeClass('resp-active');
4066    if (!addActiveClass) {
4067      $(this).closest("li").addClass("resp-active");
4068    } else {
4069      $(this).closest("li").removeClass("resp-active");
4070    }
4071  });
4072
4073  // animate increment
4074  if ($(".spincrement").length) {
4075    $(".spincrement").counterUp({
4076      delay: 80,
4077      time: 1000,
4078    });
4079  }
4080
4081  // form rating
4082  $(document).on("mouseenter", ".form .votes_block.with-text .item-rating", function () {
4083    var $this = $(this),
4084      index = $this.index(),
4085      ratingMessage = $this.data("message");
4086
4087    $(this).addClass("filed");
4088    $this.siblings().each(function () {
4089      if ($(this).index() <= index) $(this).addClass("filed");
4090      else $(this).removeClass("filed");
4091    });
4092    $this.closest(".votes_block").find(".rating_message").text(ratingMessage);
4093  });
4094
4095  $(document).on("mouseleave", ".form .votes_block.with-text", function () {
4096    var $this = $(this),
4097      index = $this.data("rating"),
4098      ratingMessage = $this.closest(".votes_block").find(".rating_message").data("message");
4099
4100    $this.find(".item-rating").each(function () {
4101      if ($(this).index() < index && index !== undefined) $(this).addClass("filed");
4102      else $(this).removeClass("filed");
4103    });
4104    $this.closest(".votes_block").find(".rating_message").text(ratingMessage);
4105  });
4106
4107  $(document).on("click", ".form .votes_block.with-text .item-rating", function () {
4108    var $this = $(this),
4109      rating = $this.closest(".votes_block").data("rating"),
4110      index = $this.index() + 1,
4111      ratingMessage = $this.data("message");
4112
4113    $this.closest(".votes_block").data("rating", index);
4114    if ($this.closest(".form-group").find("input[name=RATING]").length) {
4115      $this.closest(".form-group").find("input[name=RATING]").val(index);
4116    } else {
4117      $this.closest(".form-group").find("input[data-sid=RATING]").val(index);
4118    }
4119    $this.closest(".votes_block").find(".rating_message").data("message", ratingMessage);
4120  });
4121
4122  $(".bx_filter_input_container input[type=text]").numeric({ allow: "." });
4123
4124  $(".toggle .more_items").on("click", function () {
4125    $(this).closest(".toggle").find(".collapsed").fadeToggle();
4126    $(this).remove();
4127    if (typeof $(this).data("resize") !== "undefined" && $(this).data("resize")) $(window).resize();
4128  });
4129  $(".toggle_menu .more_items").on("click", function () {
4130    $(this).closest(".toggle_menu").find(".collapsed").addClass("clicked_exp");
4131    $(this).remove();
4132  });
4133
4134  // search sync
4135  $(document).on("keyup", ".search-input-div input", function (e) {
4136    var inputValue = $(this).val();
4137    $(".search-input-div input").val(inputValue);
4138
4139    if ($(this).closest("#headerfixed").length) {
4140      if (e.keyCode == 13) $(".search form").submit();
4141    }
4142  });
4143  $(document).on("click", ".search-button-div button", function (e) {
4144    if ($(this).closest("#headerfixed").length) $(".search form").submit();
4145  });
4146
4147  $(document).on(
4148    "click",
4149    ".header-search, .inline-search-hide, .bottom-icons-panel__content-link--search",
4150    function (e) {
4151      //if (window.matchMedia("(min-width: 600px)").matches) {
4152      CloseMobilePhone();
4153
4154      if (typeof $(this).data("type_search") != "undefined" && $(this).data("type_search") == "fixed") {
4155        $(".inline-search-block").addClass("fixed");
4156      }
4157
4158      $(".inline-search-block").toggleClass("show");
4159
4160      if (arAsproOptions["THEME"]["TYPE_SEARCH"] == "fixed") {
4161        if ($(".inline-search-block").hasClass("show")) {
4162          $('<div class="jqmOverlay search"></div>').appendTo("body");
4163          $("body").addClass("overflow-block");
4164          $("body").addClass("jqm-initied");
4165        } else {
4166          $("body").removeClass("jqm-initied");
4167          $("body").removeClass("overflow-block");
4168          $(".jqmOverlay").remove();
4169        }
4170      }
4171
4172      if ($(".inline-search-block").hasClass("show")) {
4173        setTimeout(function () {
4174          $(".inline-search-block.fixed .search-input").focus();
4175        }, 400);
4176      }
4177      // } else {
4178      //   location.href = arAsproOptions["SITE_DIR"] + "search/";
4179      // }
4180    }
4181  );
4182
4183  if ($(".styled-block .row > div.col-md-3").length) {
4184    BX.addCustomEvent("onWindowResize", function (eventdata) {
4185      try {
4186        ignoreResize.push(true);
4187        $(".styled-block .row > div.col-md-3").each(function () {
4188          $(this).css({ height: "", "line-height": "" });
4189          var z = parseInt($(".body_media").css("top"));
4190          if (z > 0) {
4191            var rowHeight = $(this).parents(".row").first().actual("outerHeight");
4192            $(this).css({ height: rowHeight + "px", "line-height": rowHeight + "px" });
4193          }
4194        });
4195      } catch (e) {
4196      } finally {
4197        ignoreResize.pop();
4198      }
4199    });
4200  }
4201
4202  if ($(".order-block").length) {
4203    BX.addCustomEvent("onWindowResize", function (eventdata) {
4204      try {
4205        ignoreResize.push(true);
4206        $(".order-block").each(function () {
4207          var cols = $(this).find(".row > div");
4208          if (cols.length) {
4209            var colFirst = cols.first();
4210            var colLast = cols.last();
4211            var colText = colFirst.find(".text");
4212            var bText = colText.length;
4213            var bOnlyText = cols.length === 1 && bText;
4214            var bPrice = colFirst.find(".price").length;
4215            var z = parseInt($(".body_media").css("top"));
4216
4217            cols.css({ height: "", "padding-top": "", "padding-bottom": "" });
4218            colText.css({ height: "", "padding-top": "", "padding-bottom": "" });
4219            if ((!bPrice && z > 0) || (bPrice && z > 1)) {
4220              var minHeight = 83;
4221
4222              if (!bOnlyText) {
4223                var colLast_height = colLast.outerHeight();
4224                colLast_height = colLast_height >= minHeight ? colLast_height : minHeight;
4225              }
4226
4227              if (bText) {
4228                var colFirst_height = colFirst.outerHeight();
4229                colFirst_height = colFirst_height >= minHeight ? colFirst_height : minHeight;
4230              }
4231
4232              var colMax_height = bText
4233                ? !bOnlyText
4234                  ? colLast_height >= colFirst_height
4235                    ? colLast_height
4236                    : colFirst_height
4237                  : colLast_height
4238                : colFirst_height;
4239
4240              if (!bOnlyText) {
4241                var textPadding = 41 + (colMax_height - colFirst.outerHeight()) / 2;
4242                colLast.find(".btns").css({
4243                  "padding-top": textPadding + "px",
4244                  "padding-bottom": textPadding + "px",
4245                  height: colMax_height + "px",
4246                });
4247              }
4248              if (bText) {
4249                colLast.css({ height: colMax_height + "px" });
4250                var textPadding = 41 + (colMax_height - colText.outerHeight()) / 2;
4251                colText.css({
4252                  "padding-top": textPadding + "px",
4253                  "padding-bottom": textPadding + "px",
4254                  height: colMax_height + "px",
4255                });
4256              }
4257            }
4258          }
4259        });
4260      } catch (e) {
4261      } finally {
4262        ignoreResize.pop();
4263      }
4264    });
4265  }
4266
4267  if ($(".equal-padding").length) {
4268    BX.addCustomEvent("onWindowResize", function (eventdata) {
4269      try {
4270        ignoreResize.push(true);
4271        $(".equal-padding").each(function () {
4272          $(this).find(".text").css({ "padding-top": "0px", "padding-bottom": "0px" });
4273          var equal_block = $(this).siblings(".equals"),
4274            height = $(this).actual("outerHeight");
4275
4276          delta = Math.round((equal_block.actual("outerHeight") - height) / 2);
4277          if (delta)
4278            $(this)
4279              .find(".text")
4280              .css({ "padding-top": delta + "px", "padding-bottom": delta + "px" });
4281        });
4282      } catch (e) {
4283      } finally {
4284        ignoreResize.pop();
4285      }
4286    });
4287  }
4288
4289  $(document).on("click", ".mega-menu .dropdown-menu", function (e) {
4290    e.stopPropagation();
4291  });
4292
4293  $(document).on("click", ".mega-menu .dropdown-toggle.more-items", function (e) {
4294    e.preventDefault();
4295  });
4296
4297  // $(".table-menu .dropdown,.table-menu .dropdown-submenu,.table-menu .dropdown-toggle").on("mouseenter", function () {
4298  //   CheckTopVisibleMenu();
4299  // });
4300
4301  $(document).on(
4302    "mouseenter",
4303    ".header-menu .header-menu__item--dropdown:not(.header-menu__item--wide), .header-menu .header-menu__item--dropdown:not(.header-menu__item--wide) .header-menu__dropdown-item.header-menu__dropdown-item--with-dropdown, .header-menu .header-menu__item--more-items, .header-menu .header-menu__item--more-items .header-menu__dropdown-item--with-dropdown, .header-menu .header-menu__item--more-items .header-menu__item--dropdown.header-menu__item--wide, .header-menu .header-menu__item--more-items .header-menu__item--dropdown.header-menu__item--wide .header-menu__dropdown-item--with-dropdown, .header-menu .header-menu__item--more-items .header-menu__item--dropdown.header-menu__item--wide .header-menu__dropdown-item--with-dropdown .header-menu__wide-submenu-item--with-dropdown",
4304    function (e) {
4305      CheckTopVisibleMenu($(e.currentTarget));
4306    }
4307  );
4308
4309  const menuBanner = {
4310    checkOwlSlider(ctx) {
4311      const bannerMenu = $(ctx).find(".owl-carousel-hover");
4312      if (bannerMenu.length) {
4313        bannerMenu.removeClass("owl-carousel-hover").addClass("owl-carousel");
4314        setTimeout(function () {
4315          InitOwlSlider();
4316          bannerMenu.removeClass("loading-state");
4317        }, 1);
4318      }
4319    },
4320    checkSwiperSlider(ctx) {
4321      const nodeBannerMenu = ctx.querySelector('.slider-solution--init-by-condition');
4322      if (nodeBannerMenu) {
4323        nodeBannerMenu.classList.remove('slider-solution--init-by-condition');
4324        nodeBannerMenu.classList.add('slider-solution');
4325        initSwiperSlider(nodeBannerMenu);
4326      }
4327    },
4328  }
4329
4330  $(document).on(
4331    "mouseenter",
4332    ".header-menu__item--wide:not(.slider-inited), .header-menu__item--wide:not(.slider-inited) .header-menu__dropdown-menu",
4333    function () {
4334      $(this).closest('.header-menu__item--wide').addClass('slider-inited');
4335
4336      menuBanner.checkOwlSlider(this);
4337      menuBanner.checkSwiperSlider(this);
4338    }
4339  );
4340
4341  $(document).on("mouseenter", ".menu-side-column__inner:not(.slider-inited) .menu-side-column__item--wide", function () {
4342    $(this).closest('.menu-side-column__inner').addClass('slider-inited');
4343
4344    const ctx = document.querySelector('.menu-side-column__bottom-banners');
4345    menuBanner.checkOwlSlider(ctx);
4346    menuBanner.checkSwiperSlider(ctx);
4347  });
4348  $(".mega-menu .search-item .search-icon, .menu-row #title-search .fa-close").on("click", function (e) {
4349    e.preventDefault();
4350    $(".menu-row #title-search").toggleClass("hide");
4351  });
4352
4353  $(".mega-menu ul.nav .search input").on("keyup", function (e) {
4354    var inputValue = $(this).val();
4355    $(".menu-row > .search input").val(inputValue);
4356    if (e.keyCode == 13) {
4357      $(".menu-row > .search form").submit();
4358    }
4359  });
4360
4361  $(".menu-row > .search input").on("keyup", function (e) {
4362    var inputValue = $(this).val();
4363    $(".mega-menu ul.nav .search input").val(inputValue);
4364    if (e.keyCode == 13) {
4365      $(".menu-row > .search form").submit();
4366    }
4367  });
4368
4369  $(".mega-menu ul.nav .search button").on("click", function (e) {
4370    e.preventDefault();
4371    var inputValue = $(this).parents(".search").find("input").val();
4372    $(".menu-and-search .search input").val(inputValue);
4373    $(".menu-row > .search form").submit();
4374  });
4375
4376  $(".filter .calendar").on("click", function () {
4377    var button = $(this).next();
4378    if (button.hasClass("calendar-icon")) {
4379      button.trigger("click");
4380    }
4381  });
4382
4383  // sliceheights
4384  if ($(".banners-small .item.normal-block").length) $(".banners-small .item.normal-block").sliceHeight();
4385  if ($(".teasers .item").length) $(".teasers .item").sliceHeight();
4386  if ($(".wrap-portfolio-front .row.items > div").length)
4387    $(".wrap-portfolio-front .row.items > div").sliceHeight({ row: ".row.items", item: ".item1" });
4388
4389  SliceHeightBlocks();
4390
4391  // toggle
4392  var $this = this,
4393    previewParClosedHeight = 25;
4394
4395  $("section.toggle > label").prepend($("<i />").addClass("fa fa-plus"));
4396  $("section.toggle > label").prepend($("<i />").addClass("fa fa-minus"));
4397  $("section.toggle.active > p").addClass("preview-active");
4398  $("section.toggle.active > div.toggle-content").slideDown(350, function () {});
4399
4400  $("section.toggle > label").click(function (e) {
4401    var parentSection = $(this).parent(),
4402      parentWrapper = $(this).parents("div.toogle"),
4403      previewPar = false,
4404      isAccordion = parentWrapper.hasClass("toogle-accordion");
4405
4406    if (isAccordion && typeof e.originalEvent != "undefined") {
4407      parentWrapper.find("section.toggle.active > label").trigger("click");
4408    }
4409
4410    parentSection.toggleClass("active");
4411
4412    // Preview Paragraph
4413    if (parentSection.find("> p").get(0)) {
4414      previewPar = parentSection.find("> p");
4415      var previewParCurrentHeight = previewPar.css("height");
4416      previewPar.css("height", "auto");
4417      var previewParAnimateHeight = previewPar.css("height");
4418      previewPar.css("height", previewParCurrentHeight);
4419    }
4420
4421    // Content
4422    var toggleContent = parentSection.find("> div.toggle-content");
4423
4424    if (parentSection.hasClass("active")) {
4425      $(previewPar).animate(
4426        {
4427          height: previewParAnimateHeight,
4428        },
4429        350,
4430        function () {
4431          $(this).addClass("preview-active");
4432        }
4433      );
4434      toggleContent.slideDown(350, function () {});
4435    } else {
4436      $(previewPar).animate(
4437        {
4438          height: previewParClosedHeight,
4439        },
4440        350,
4441        function () {
4442          $(this).removeClass("preview-active");
4443        }
4444      );
4445      toggleContent.slideUp(350, function () {});
4446    }
4447  });
4448
4449  // accordion
4450  $(".accordion-head").on("click", function (e) {
4451    e.preventDefault();
4452    if (!$(this).next().hasClass("collapsing")) {
4453      $(this).toggleClass("accordion-open");
4454      $(this).toggleClass("accordion-close");
4455    }
4456  });
4457
4458  // progress bar
4459  $("[data-appear-progress-animation]").iAppear(
4460    function () {
4461      var $this = $(this);
4462
4463      var delay = $this.attr("data-appear-animation-delay") ? $this.attr("data-appear-animation-delay") : 1;
4464      if (delay > 1) $this.css("animation-delay", delay + "ms");
4465      $this.addClass($this.attr("data-appear-animation"));
4466
4467      setTimeout(function () {
4468        $this.animate(
4469          {
4470            width: $this.attr("data-appear-progress-animation"),
4471          },
4472          1500,
4473          "easeOutQuad",
4474          function () {
4475            $this.find(".progress-bar-tooltip").animate(
4476              {
4477                opacity: 1,
4478              },
4479              500,
4480              "easeOutQuad"
4481            );
4482          }
4483        );
4484      }, delay);
4485    },
4486    {
4487      rootMargin: "-50px 0px -50px 0px",
4488      accX: 0,
4489      accY: -50,
4490    }
4491  );
4492
4493  // portfolio item
4494  $(".item.animated-block").iAppear(function () {
4495    $(this).addClass($(this).data("animation")).addClass("visible");
4496  });
4497
4498  // flexslider appear
4499  $(".appear-block").iAppear(function () {
4500    $(this).removeClass("appear-block");
4501    CheckFlexSlider();
4502    InitFlexSlider();
4503    InitOwlSlider();
4504
4505    typeof initSwiperSlider === "function" && initSwiperSlider();
4506  });
4507
4508  // js-load-block appear
4509  if ($(".js-load-block").length) {
4510    var objUrl = parseUrlQuery();
4511    var bClearCache = false;
4512    if ("clear_cache" in objUrl) {
4513      if (objUrl.clear_cache == "Y") {
4514        bClearCache = true;
4515      }
4516    }
4517
4518    var items = [];
4519    var bIdle = true;
4520    var insertNextBlockContent = function () {
4521      if (bIdle) {
4522        if (items.length) {
4523          bIdle = false;
4524          var item = items.pop();
4525
4526          item.content = $.trim(item.content);
4527
4528          // remove /bitrix/js/main/core/core_window.js if it was loaded already
4529          if (item.content.indexOf("/bitrix/js/main/core/core_window.") !== -1 && BX.WindowManager) {
4530            item.content = item.content.replace(
4531              /<script src="\/bitrix\/js\/main\/core\/core_window\.[^>]*><\/script>/gm,
4532              ""
4533            );
4534          }
4535
4536          // remove /bitrix/js/currency/core_currency.js if it was loaded already
4537          if (
4538            item.content.indexOf("/bitrix/js/currency/core_currency.") !== -1 &&
4539            typeof BX.Currency === "object" &&
4540            BX.Currency.defaultFormat
4541          ) {
4542            item.content = item.content.replace(
4543              /<script src="\/bitrix\/js\/currency\/core_currency\.[^>]*><\/script>/gm,
4544              ""
4545            );
4546          }
4547
4548          // remove /bitrix/js/main/pageobject/pageobject.js if it was loaded already
4549          if (item.content.indexOf("/bitrix/js/main/pageobject/pageobject.") !== -1 && BX.PageObject) {
4550            item.content = item.content.replace(
4551              /<script src="\/bitrix\/js\/main\/pageobject\/pageobject\.[^>]*><\/script>/gm,
4552              ""
4553            );
4554          }
4555
4556          // remove /bitrix/js/main/polyfill/promise/js/promise.js if it not need
4557          if (
4558            item.content.indexOf("/bitrix/js/main/polyfill/promise/js/promise.") !== -1 &&
4559            typeof window.Promise !== "undefined" &&
4560            window.Promise.toString().indexOf("[native code]") !== -1
4561          ) {
4562            item.content = item.content.replace(
4563              /<script src="\/bitrix\/js\/main\/polyfill\/promise\/js\/promise\.[^>]*><\/script>/gm,
4564              ""
4565            );
4566          }
4567
4568          var ob = BX.processHTML(item.content);
4569
4570          // stop ya metrika webvisor DOM indexer
4571          pauseYmObserver();
4572
4573          item.block.removeAttr("data-file").removeClass("loader_circle");
4574
4575          if (item.block.data("appendTo")) {
4576            item.block.find(item.block.data("appendTo"))[0].innerHTML = ob.HTML;
4577          } else {
4578            if (item.block.find('> div[id*="bx_incl_"]').length) {
4579              item.block.find('> div[id*="bx_incl_"]')[0].innerHTML = ob.HTML;
4580            } else {
4581              item.block[0].innerHTML = ob.HTML;
4582            }
4583          }
4584
4585          BX.ajax.processScripts(ob.SCRIPT);
4586
4587          var eventdata = { action: "jsLoadBlock" };
4588          BX.onCustomEvent("onCompleteAction", [eventdata, item.block]);
4589
4590          // resume ya metrika webvisor
4591          // 500ms
4592          setTimeout(resumeYmObserver, 500);
4593
4594          bIdle = true;
4595          insertNextBlockContent();
4596        }
4597      }
4598    };
4599
4600    $(".js-load-block").iAppear(
4601      function () {
4602        var $this = $(this);
4603
4604        if ($this.data("file")) {
4605          var add_url = bClearCache ? "?clear_cache=Y" : "";
4606          if ($this.data("block")) {
4607            add_url += (bClearCache ? "&" : "?") + "BLOCK=" + $this.data("block");
4608          }
4609
4610          // get content
4611          $.get($this.data("file") + add_url).done(function (html) {
4612            items.push({
4613              block: $this,
4614              content: html,
4615            });
4616
4617            if (items.length == 1) {
4618              setTimeout(insertNextBlockContent, 100);
4619            }
4620          });
4621        }
4622      },
4623      {
4624        rootMargin: isMobile ? "300px 0px 300px 0px" : "150px 0px 150px 0px",
4625        accX: 0,
4626        accY: isMobile ? 300 : 150,
4627      }
4628    );
4629  }
4630
4631  $("a[rel=tooltip]").tooltip();
4632  $("span[data-toggle=tooltip]").tooltip();
4633
4634  $("select.sort").on("change", function () {
4635    location.href = $(this).val();
4636  });
4637
4638  setTimeout(function (th) {
4639    $(".catalog.group.list .item").each(function () {
4640      var th = $(this);
4641      if ((tmp = th.find(".image").outerHeight() - th.find(".text_info").outerHeight()) > 0) {
4642        th.find(".text_info .titles").height(th.find(".text_info .titles").outerHeight() + tmp);
4643      }
4644    });
4645  }, 50);
4646
4647  // ajax tabs
4648
4649  // tabs on front in mobile
4650  $(".items-link-mobile").each(function () {
4651    var _this = $(this),
4652      selectOption = _this.find("option"),
4653      selectOptionLength = selectOption.length,
4654      selectedOption = selectOption.filter(":selected"),
4655      duration = 200; //
4656
4657    _this.hide();
4658    _this.wrap('<div class="select"></div>');
4659    $("<div>", {
4660      class: "new-select",
4661      text: _this.children("option:disabled").text(),
4662    }).insertAfter(_this);
4663
4664    var selectHead = _this.next(".new-select");
4665    $("<div>", {
4666      class: "new-select__list",
4667    }).insertAfter(selectHead);
4668
4669    var selectList = selectHead.next(".new-select__list");
4670    for (var i = 1; i < selectOptionLength; i++) {
4671      $("<div>", {
4672        class: "new-select__item",
4673        html: $("<span>", {
4674          text: selectOption.eq(i).text(),
4675        }),
4676      })
4677        .attr("data-value", selectOption.eq(i).val())
4678        .appendTo(selectList);
4679    }
4680
4681    var selectItem = selectList.find(".new-select__item");
4682    var selectItemFirst = selectList.find(".new-select__item:first-child");
4683    selectList.slideUp();
4684    selectHead.on("click", function () {
4685      if (!$(this).hasClass("on")) {
4686        $(this).addClass("on");
4687        selectList.slideDown(duration);
4688
4689        selectItemCur = selectList.find(".new-select__item.active");
4690
4691        if (!selectItem.hasClass("active")) {
4692          selectItemFirst.addClass("active");
4693          selectItemCur = selectItemFirst;
4694        }
4695
4696        selectItem.on("click", function () {
4697          selectItemCur.removeClass("active");
4698          var chooseItem = $(this).data("value");
4699
4700          $("select").val(chooseItem).attr("selected", "selected");
4701          selectHead.text($(this).find("span").text());
4702          selectHead.attr("data-value", $(this).attr("data-value"));
4703          $(this).addClass("active");
4704          var _this = $(this);
4705          selectList.slideUp(150, function () {
4706            selectHead.removeClass("on");
4707
4708            var index = _this.index();
4709            var curHeadBlock = _this.closest(".head-block");
4710            var indexTab = curHeadBlock.find(".items-link .item-link.active");
4711            var indexActiveTab = indexTab.index();
4712
4713            if (indexActiveTab != index) {
4714              curHeadBlock.find(".items-link .item-link").eq(index).trigger("click");
4715            }
4716          });
4717        });
4718      } else {
4719        $(this).removeClass("on");
4720        selectList.slideUp(duration);
4721      }
4722    });
4723  });
4724
4725  // gallery in list
4726  $(document).on("mouseenter", ".section-gallery-wrapper .section-gallery-wrapper__item", function () {
4727    const _this = $(this);
4728    const index = _this.index();
4729    const nav_items = _this.closest(".image-list-wrapper").find(".section-gallery-nav .section-gallery-nav__item");
4730
4731    _this.siblings().removeClass("active");
4732    _this.addClass("active");
4733
4734    nav_items.removeClass("active");
4735    nav_items.filter(":eq(" + index + ")").addClass("active");
4736  });
4737
4738  $(document).on("click", ".section-gallery-nav .section-gallery-nav__item", function () {
4739    const _this = $(this);
4740    const index = _this.index();
4741    const items = _this.closest(".image-list-wrapper").find(".section-gallery-wrapper .section-gallery-wrapper__item");
4742
4743    _this.siblings().removeClass("active");
4744    _this.addClass("active");
4745
4746    items.removeClass("active");
4747    items.filter(":eq(" + index + ")").addClass("active");
4748  });
4749
4750  // item galery
4751  $(".thumbs .item a").on("click", function (e) {
4752    e.preventDefault();
4753    $(".thumbs .item").removeClass("current");
4754    $(this).closest(".item").toggleClass("current");
4755    $(".slides li" + $(this).attr("href"))
4756      .addClass("current")
4757      .siblings()
4758      .removeClass("current");
4759  });
4760
4761  $("header.fixed .btn-responsive-nav").on("click", function () {
4762    $("html, body").animate({ scrollTop: 0 }, 400);
4763  });
4764
4765  $("body").on("click", ".form .refresh-page", function () {
4766    location.href = location.href;
4767  });
4768
4769  $(document).on("click", ".basket.fly .opener", function () {
4770    if (window.matchMedia("(max-width: 767px)").matches) location.href = arAsproOptions["THEME"]["URL_BASKET_SECTION"];
4771    else {
4772      $(".jqmWindow.right_slide.opened").jqmHide();
4773      $(this).closest(".ajax_basket").toggleClass("opened").removeClass('widget_open').removeClass;
4774    }
4775  });
4776
4777  $(document).on("click", ".basket.fly .close_block", function () {
4778    $(".basket.fly .opener").trigger("click");
4779  });
4780
4781  // show props
4782  $(document).on("click", ".show_props", function () {
4783    $(this).prev(".props_list").stop().slideToggle(333);
4784    $(this).find(".char_title").toggleClass("opened");
4785  });
4786
4787  // animated labels
4788  $(document)
4789    .on("focus", ".fill-animate input,.fill-animate textarea", function () {
4790      $(this).addClass("input-filed");
4791    })
4792    .on("focusout", ".fill-animate input,.fill-animate textarea", function () {
4793      if ("" != $(this).val()) {
4794        $(this).addClass("input-filed");
4795      } else {
4796        $(this).removeClass("input-filed");
4797      }
4798    });
4799
4800  // accordion action
4801  $(".panel-collapse").on("hidden.bs.collapse", function () {
4802    $(this).parent().toggleClass("opened");
4803  });
4804  $(".panel-collapse").on("show.bs.collapse", function () {
4805    $(this).parent().toggleClass("opened");
4806  });
4807
4808  $(document).on("click", ".reload-page", function () {
4809    location.reload(true);
4810  });
4811
4812  // DIGITAL BASKET
4813  // - basket fly close
4814  $(document).on("click", function () {
4815    if ($(".basket.fly").length && $(".ajax_basket").hasClass("opened")) {
4816      $(".ajax_basket").removeClass("opened");
4817    }
4818  });
4819
4820  $(document).on("click", ".basket.fly", function (e) {
4821    e.stopPropagation();
4822  });
4823
4824  // - slide_right close
4825  $(document).on("click", function () {
4826    if ($(".right_slide.opened").length) {
4827      $(".jqmWindow.right_slide.opened").jqmHide();
4828    }
4829  });
4830
4831  $(document).on("click", ".right_slide.opened", function (e) {
4832    e.stopPropagation();
4833  });
4834
4835  // - COUNTER
4836  var timerBasketCounter = false;
4837
4838  // -- keyup input
4839  $(document).on("keydown", ".counter__count", function (e) {
4840    // Allow: backspace, delete, tab, escape, enter and .
4841    if (
4842      $.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 ||
4843      // Allow: Ctrl+A, Command+A
4844      (e.keyCode === 65 && (e.ctrlKey === true || e.metaKey === true)) ||
4845      // Allow: home, end, left, right, down, up
4846      (e.keyCode >= 35 && e.keyCode <= 40)
4847    ) {
4848      // let it happen, don't do anything
4849      return;
4850    }
4851    // Ensure that it is a number and stop the keypress
4852    if ((e.shiftKey || e.keyCode < 48 || e.keyCode > 57) && (e.keyCode < 96 || e.keyCode > 105)) {
4853      e.preventDefault();
4854    }
4855  });
4856  $(document).on("keyup", ".counter__count", function (e) {
4857    var $this = $(this),
4858      counterInputValueNew = $this.val(),
4859      price = $this.closest(".buy_block").find("input[name=PRICE]").val();
4860
4861    Summ($this, counterInputValueNew, price);
4862  });
4863
4864  $("select.region").on("change", function () {
4865    var val = parseInt($(this).val());
4866    if ($("select.city").length) {
4867      if (val) {
4868        $("select.city").removeAttr("disabled");
4869        $("select.city option").hide();
4870        $("select.city option[data-parent_section=" + val + "]").show();
4871      } else $("select.city").attr("disabled", "disabled");
4872    }
4873  });
4874
4875  $("select.city, select.region").on("change", function () {
4876    var _this = $(this),
4877      val = parseInt(_this.val());
4878    if (_this.hasClass("region")) {
4879      $("select.city option:eq(0)").show();
4880      $("select.city").val(0);
4881    }
4882
4883    if ((_this.hasClass("region") && !val) || _this.hasClass("city")) {
4884      $.ajax({
4885        type: "POST",
4886        data: { ID: val },
4887      }).done(function (html) {
4888        var ob = BX.processHTML(html);
4889        $(".ajax_items")[0].innerHTML = ob.HTML;
4890        BX.ajax.processScripts(ob.SCRIPT);
4891      });
4892    }
4893  });
4894
4895  // -- blur input
4896  $(document).on("change", ".counter__count", function () {
4897    BasketCounter($(this));
4898  });
4899
4900  // -- click minus, plus button
4901  $(document).on("click", ".counter__action", function (e) {
4902    e.stopPropagation();
4903    BasketCounter($(this));
4904  });
4905
4906  // - Add2Basket
4907  $(document).on("click", ".to_cart:not(.opt_action)", function (e) {
4908    e.stopPropagation();
4909
4910    var item = $(this).closest("[data-item]");
4911    var _this = $(this);
4912    var itemData = item.data("item");
4913    var buyBlock = item.find(".buy_block");
4914    var buttonToCart = buyBlock.find(".to_cart");
4915    var itemQuantity = parseFloat(buttonToCart.data("quantity"));
4916    if (isNaN(itemQuantity) || itemQuantity <= 0) {
4917      itemQuantity = 1;
4918    }
4919    var countItem = $(".basket .count").length ? parseInt($(".basket .count").first().text()) : 0;
4920    $(".basket .count")
4921      .text(countItem + 1)
4922      .removeClass("empted");
4923
4924    var bBasketTop =
4925      typeof arAsproOptions["THEME"]["ORDER_BASKET_VIEW"] !== "undefined" &&
4926      $.trim(arAsproOptions["THEME"]["ORDER_BASKET_VIEW"]) === "HEADER" &&
4927      $(".basket.top").length;
4928    var bBasketFly =
4929      typeof arAsproOptions["THEME"]["ORDER_BASKET_VIEW"] !== "undefined" && !bBasketTop && $(".basket.fly").length;
4930
4931    if (itemData && !isNaN(itemData.ID) && parseInt(itemData.ID) > 0) {
4932      if (typeof arBasketItems === "object" && typeof arBasketItems[itemData.ID] !== "object") {
4933        arBasketItems[itemData.ID] = { ID: itemData.ID, QUANTITY: itemQuantity };
4934      }
4935
4936      $.ajax({
4937        url: arAsproOptions["SITE_DIR"] + "include/footer/basket.php",
4938        type: "POST",
4939        data: { itemData: itemData, quantity: itemQuantity },
4940      }).done(function (html) {
4941        buyBlock.addClass("in");
4942
4943        var eventdata = { action: "loadForm" };
4944        BX.onCustomEvent("onCompleteAction", [eventdata, _this[0]]);
4945
4946        if (bBasketTop) {
4947          $(".ajax_basket").replaceWith(html);
4948        } else if (bBasketFly) {
4949          $(".ajax_basket").html($($.trim(html)).html());
4950        }
4951
4952        // show cart or notice
4953        if (typeof JNoticeSurface === "undefined") {
4954          if (bBasketTop) {
4955            $(".header-cart").addClass("opened");
4956
4957            if (typeof headerCartHideTimer !== "undefined") {
4958              clearTimeout(headerCartHideTimer);
4959            }
4960
4961            headerCartHideTimer = setTimeout(function () {
4962              $(".header-cart").removeClass("opened");
4963            }, 2000);
4964          } else if (bBasketFly) {
4965            setTimeout(function () {
4966              if (!$(".ajax_basket").hasClass("opened")) {
4967                $(".ajax_basket").addClass("opened");
4968              }
4969            }, 50);
4970          }
4971        } else {
4972          JNoticeSurface.get().onAdd2cart([item[0]]);
4973        }
4974
4975        var eventdata = { action: "loadBasket" };
4976        BX.onCustomEvent("onCompleteAction", [eventdata, $(html)]);
4977
4978        if (arAsproOptions["THEME"]["USE_SALE_GOALS"] != "N") {
4979          var eventdata = { goal: "goal_basket_add", params: { itemData: itemData, quantity: itemQuantity } };
4980          BX.onCustomEvent("onCounterGoals", [eventdata]);
4981        }
4982      });
4983    } else {
4984      $(this).parent().removeClass("loadings");
4985      return;
4986    }
4987  });
4988
4989  // - Remove9Basket
4990  $(document).on("click", ".remove", function (e) {
4991    e.stopPropagation();
4992
4993    var item = $(this).closest("[data-item]");
4994    var itemData = item.data("item");
4995    var bRemove = "Y";
4996    var bRemoveAll = $.trim($(this).closest("[data-remove_all]").data("remove_all")) === "Y" ? "Y" : false;
4997    var getCurUri = $.trim($("input[name=getPageUri]").val());
4998    var countItem = $(".basket .count").length
4999      ? parseInt($(".basket .count").first().text())
5000      : $(".basket.default").length
5001      ? $(".basket.default .cart__item").length
5002      : 0;
5003    var bOneItem = countItem - 1 <= 0;
5004    var scrollTop = $(".basket.fly").length
5005      ? $(".basket.fly .items_wrap").scrollTop()
5006      : $(".header-cart .basket.top").length
5007      ? $(".header-cart .basket.top .items").scrollTop()
5008      : "";
5009
5010    var bBasketTop =
5011      typeof arAsproOptions["THEME"]["ORDER_BASKET_VIEW"] !== "undefined" &&
5012      $.trim(arAsproOptions["THEME"]["ORDER_BASKET_VIEW"]) === "HEADER" &&
5013      $(".basket.top").length;
5014    var bBasketFly =
5015      typeof arAsproOptions["THEME"]["ORDER_BASKET_VIEW"] !== "undefined" && !bBasketTop && $(".basket.fly").length;
5016
5017    if (bRemoveAll) {
5018      arBasketItems = [];
5019    } else if (typeof arBasketItems === "object" && itemData && typeof arBasketItems[itemData.ID] === "object") {
5020      delete arBasketItems[itemData.ID];
5021    }
5022
5023    var _ajax = function () {
5024      $.ajax({
5025        url: arAsproOptions["SITE_DIR"] + "include/footer/basket.php",
5026        type: "POST",
5027        data: { itemData: itemData, remove: bRemove, removeAll: bRemoveAll },
5028      }).done(function (html) {
5029        if (bBasketTop) {
5030          $(".ajax_basket").replaceWith(html);
5031        } else if (bBasketFly) {
5032          $(".ajax_basket").html($($.trim(html)).html());
5033          $(".basket.fly .items_wrap").scrollTop(scrollTop);
5034        }
5035
5036        var eventdata = { action: "loadBasket" };
5037        BX.onCustomEvent("onCompleteAction", [eventdata, $(html)]);
5038
5039        if (getCurUri) {
5040          $.ajax({
5041            url: getCurUri,
5042            type: "POST",
5043          }).done(function (html) {
5044            if ($(".basket.default").length) {
5045              $(".basket.default").html(html);
5046            }
5047          });
5048        }
5049
5050        if (arAsproOptions["THEME"]["USE_SALE_GOALS"] != "N") {
5051          var eventdata = {
5052            goal: "goal_basket_remove",
5053            params: { itemData: itemData, remove: bRemove, removeAll: bRemoveAll },
5054          };
5055          BX.onCustomEvent("onCounterGoals", [eventdata]);
5056        }
5057      });
5058    };
5059
5060    if ((typeof itemData !== "undefined" && !isNaN(itemData.ID) && itemData.ID > 0) || bRemoveAll) {
5061      if (bRemoveAll) {
5062        $(".buy_block").removeClass("in");
5063        $(".basket .count").text(0).addClass("empted");
5064      } else {
5065        $(".basket .count")
5066          .text(countItem - 1)
5067          .removeClass("empted");
5068
5069        $("[data-item]").each(function () {
5070          if ($(this).data("item").ID == itemData.ID) {
5071            $(this).find(".buy_block").removeClass("in").find(".to_cart").data("quantity", 0);
5072            $(this).find(".buy_block").find(".counter__count").val(1);
5073          }
5074        });
5075      }
5076
5077      if (bOneItem || bRemoveAll) {
5078        $(".remove.all").remove();
5079
5080        $(".basket_wrap").fadeOut(200);
5081        setTimeout(function () {
5082          $(".basket .basket_empty").fadeIn(200);
5083          $(".basket.fly .wrap").addClass("empty-basket");
5084        }, 200);
5085        setTimeout(_ajax, 400);
5086      } else {
5087        item.animate({ opacity: 0 }, 200).slideUp(200, function () {
5088          _ajax();
5089        });
5090      }
5091    } else {
5092      return;
5093    }
5094  });
5095
5096  $(document).on("click", ".print", function () {
5097    window.print();
5098  });
5099
5100  $(".choise").on("click", function () {
5101    var $this = $(this);
5102    if (typeof $this.data("block") !== "undefined") {
5103      var block = $this.attr("data-block");
5104
5105      try {
5106        var $block = BX(block) ? $("#" + block) : $(".detail-block." + block);
5107      } catch (e) {
5108        var $block = $(block);
5109      }
5110
5111      if ($block.length) {
5112        if ($block.closest(".tab-pane").length) {
5113          var offset = -206;
5114          if (typeof arAsproOptions !== "undefined") {
5115            offset = window.matchMedia("(max-width:991px)").matches
5116              ? arAsproOptions.THEME.HEADER_MOBILE_FIXED !== "Y" || arAsproOptions.THEME.HEADER_MOBILE_SHOW !== "ALWAYS"
5117                ? -187 + 62
5118                : -187
5119              : arAsproOptions.THEME.TOP_MENU_FIXED !== "Y"
5120              ? -206 + 81
5121              : -206;
5122          }
5123
5124          $block.data("offset", offset);
5125          $('.ordered-block a[href="#' + $block.closest(".tab-pane").attr("id") + '"]').click();
5126        }
5127
5128        scrollToBlock($block);
5129      }
5130    }
5131  });
5132
5133  // touch event
5134  document.addEventListener(
5135    "touchend",
5136    function (event) {
5137      if (!$(event.target).closest(".menu-item").length && !$(event.target).hasClass("menu-item")) {
5138        $(".mega-menu .dropdown-menu").css({ display: "none", opacity: 0 });
5139        $(".menu-item").removeClass("hover");
5140      }
5141      if (!$(event.target).closest(".menu.topest").length) {
5142        $(".menu.topest").css({ overflow: "hidden" });
5143        $(".menu.topest > li").removeClass("hover");
5144      }
5145      if (!$(event.target).closest(".full.has-child").length) {
5146        $(".menu_top_block.catalog_block li").removeClass("hover");
5147      }
5148      // if(!$(event.target).closest('.basket_block').length){
5149      //   $('.basket_block .link').removeClass('hover');
5150      //   $('.basket_block .basket_popup_wrapp').slideUp();
5151      // }
5152      // if(!$(event.target).closest('.catalog_item').length){
5153      //   var tabsContentUnhoverHover = $('.tab:visible').attr('data-unhover') * 1;
5154      //   $('.tab:visible').stop().animate({'height': tabsContentUnhoverHover}, 100);
5155      //   $('.tab:visible').find('.catalog_item').removeClass('hover');
5156      //   $('.tab:visible').find('.catalog_item .buttons_block').stop().fadeOut(233);
5157      //   if($('.catalog_block').length){
5158      //     $('.catalog_block').find('.catalog_item_wrapp').removeClass('hover');
5159      //     $('.catalog_block').find('.catalog_item').removeClass('hover');
5160      //   }
5161      // }
5162    },
5163    false
5164  );
5165
5166  touchMenu(".mega-menu .menu-item");
5167  touchTopMenu(".menu.topest li");
5168});
5169
5170function touchMenu(selector) {
5171  if (isMobile) {
5172    if ($(selector).length) {
5173      $(selector).each(function () {
5174        var th = $(this);
5175        th.on("touchend", function (e) {
5176          var _th = $(e.target).closest(".menu-item");
5177
5178          $(".menu.topest > li").removeClass("hover");
5179          $(".menu_top_block.catalog_block li").removeClass("hover");
5180
5181          if (_th.find(".dropdown-menu").length && !_th.hasClass("hover")) {
5182            e.preventDefault();
5183            e.stopPropagation();
5184            _th.siblings().removeClass("hover");
5185            _th.addClass("hover");
5186            $(".menu-row .dropdown-menu").css({ display: "none", opacity: 0 });
5187            if (_th.hasClass("menu-item")) {
5188              _th.closest(".dropdown-menu").css({ display: "block", opacity: 1 });
5189            }
5190            if (_th.find("> .wrap > .dropdown-menu")) {
5191              _th.find("> .wrap > .dropdown-menu").css({ display: "block", opacity: 1 });
5192            } else if (_th.find("> .dropdown-menu")) {
5193              _th.find("> .dropdown-menu").css({ display: "block", opacity: 1 });
5194            }
5195            CheckTopVisibleMenu();
5196          } else {
5197            var href = $(e.target).attr("href") ? $(e.target).attr("href") : $(e.target).closest("a").attr("href");
5198            if (href && href !== "undefined") location.href = href;
5199          }
5200        });
5201      });
5202    }
5203  } else {
5204    $(selector).off();
5205  }
5206}
5207
5208function touchTopMenu(selector) {
5209  if (isMobile) {
5210    if ($(selector).length) {
5211      $(selector).each(function () {
5212        var th = $(this);
5213        th.on("touchend", function (e) {
5214          var _th = $(e.target).closest("li");
5215
5216          $(".menu-item").removeClass("hover");
5217          $(".menu-item .dropdown-menu").css({ display: "none", opacity: 0 });
5218          $(".menu_top_block.catalog_block li").removeClass("hover");
5219
5220          if (_th.hasClass("more") && !_th.hasClass("hover")) {
5221            e.preventDefault();
5222            e.stopPropagation();
5223            _th.siblings().removeClass("hover");
5224            _th.addClass("hover");
5225            $(".menu.topest").css({ overflow: "visible" });
5226          } else {
5227            var href = $(e.target).attr("href") ? $(e.target).attr("href") : $(e.target).closest("a").attr("href");
5228            if (href && href !== "undefined") location.href = href;
5229          }
5230        });
5231      });
5232    }
5233  } else {
5234    $(selector).off();
5235  }
5236}
5237
5238scrollToBlock = function (block) {
5239  if ($(block).length) {
5240    scrollToBlock.last = block;
5241
5242    if (typeof $(block).data("toggle") !== "undefined") {
5243      $(block).click();
5244    }
5245
5246    var offset = -81 - 64;
5247    if (typeof $(block).data("offset") !== "undefined") {
5248      offset = $(block).data("offset");
5249    } else {
5250      if (typeof arAsproOptions !== "undefined") {
5251        offset = window.matchMedia("(max-width:991px)").matches
5252          ? arAsproOptions.THEME.HEADER_MOBILE_FIXED !== "Y" || arAsproOptions.THEME.HEADER_MOBILE_SHOW !== "ALWAYS"
5253            ? -43
5254            : -62 - 43
5255          : arAsproOptions.THEME.TOP_MENU_FIXED !== "Y"
5256          ? -43
5257          : -81 - 43;
5258
5259        if ($(block).hasClass("drag-block")) {
5260          offset += 43;
5261        }
5262      }
5263    }
5264
5265    offset = $(block).offset().top + offset;
5266
5267    $("body").addClass("scrolling-state");
5268    $("body, html").animate({ scrollTop: offset }, 500);
5269    setTimeout(function () {
5270      $("body").removeClass("scrolling-state");
5271    }, 500);
5272  }
5273};
5274
5275scrollToBlock.rescroll = function () {
5276  if (typeof scrollToBlock.last !== "undefined") {
5277    scrollToBlock(scrollToBlock.last);
5278  }
5279};
5280
5281// DIGITAL BASKET
5282function number_format(number, decimals, dec_point, thousands_sep) {
5283  number = (number + "").replace(/[^0-9+\-Ee.]/g, "");
5284  var n = !isFinite(+number) ? 0 : +number,
5285    prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
5286    sep = typeof thousands_sep === "undefined" ? "," : thousands_sep,
5287    dec = typeof dec_point === "undefined" ? "." : dec_point,
5288    s = "",
5289    toFixedFix = function (n, prec) {
5290      var k = Math.pow(10, prec);
5291      return "" + (Math.round(n * k) / k).toFixed(prec);
5292    };
5293
5294  // Fix for IE parseFloat(0.55).toFixed(0) = 0;
5295  s = (prec ? toFixedFix(n, prec) : "" + Math.round(n)).split(".");
5296
5297  if (s[0].length > 3) {
5298    s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
5299  }
5300
5301  if ((s[1] || "").length < prec) {
5302    s[1] = s[1] || "";
5303    s[1] += new Array(prec - s[1].length + 1).join("0");
5304  }
5305
5306  return s.join(dec);
5307}
5308
5309function setBasketItemsClasses() {
5310  if (typeof arBasketItems !== "undefined" && typeof arBasketItems !== "string" && arBasketItems) {
5311    if (Object.keys(arBasketItems).length) {
5312      for (var key in arBasketItems) {
5313        $("[data-item]").each(function () {
5314          if ($(this).data("id") == key) {
5315            $(this).find(".buy_block").addClass("in");
5316            $(this).find(".buy_block .counter__count").val(arBasketItems[key].QUANTITY);
5317          if ($(this).find("input[name=buy_services_"+key+"]")) {
5318            $(this).find("input[name=buy_services_"+key+"]").prop("checked", "checked");
5319          }
5320          }
5321        });
5322      }
5323    }
5324  }
5325}
5326function setFavoriteItemsClass() {
5327  if (typeof arAsproOptions === "object" && arAsproOptions && arAsproOptions["FAVORITE_ITEMS"]) {
5328    if (arAsproOptions["FAVORITE_ITEMS"].length > 0) {
5329      for (var key in arAsproOptions["FAVORITE_ITEMS"]) {
5330        $(".js-item-action[data-action='favorite'][data-id=" + arAsproOptions["FAVORITE_ITEMS"][key] + "]").each(function () {
5331          $(this).parent().addClass("active");
5332          $(this).addClass("active");
5333          $(this).attr("title", $(this).data("title_favorited"));
5334          if ($(this).find(".info-buttons__item-text").length) {
5335            $(this).find(".info-buttons__item-text").text($(this).data("title_favorited"));
5336          }
5337        });
5338      }
5339    }
5340  }
5341}
5342
5343function setCompareItemsClass() {
5344  if (typeof arAsproOptions === "object" && arAsproOptions && arAsproOptions["COMPARE_ITEMS"]) {
5345    if (arAsproOptions["COMPARE_ITEMS"].length > 0) {
5346      for (var key in arAsproOptions["COMPARE_ITEMS"]) {
5347        $(".js-item-action[data-action='compare']").each(function () {
5348          if ($(this).data("item_compare") && $(this).data("item_compare").ID == arAsproOptions["COMPARE_ITEMS"][key]) {
5349            $(this).parent().addClass("active");
5350            $(this).addClass("active");
5351            $(this).attr("title", $(this).data("title_compared"));
5352            if ($(this).find(".info-buttons__item-text").length) {
5353              $(this).find(".info-buttons__item-text").text($(this).data("title_compared"));
5354            }
5355          }
5356        });
5357      }
5358    }
5359  }
5360}
5361
5362function Summ(el, counterInputValueNew, price) {
5363  if (counterInputValueNew <= 0) {
5364    counterInputValueNew = 1;
5365  }
5366
5367  var summ = number_format(counterInputValueNew * price, 0, ".", " "),
5368    allSumm = 0;
5369
5370  el.closest(".cart")
5371    .find(".cart__item")
5372    .each(function () {
5373      var $this = $(this),
5374        price = parseFloat($this.find("input[name=PRICE]").val()),
5375        count = parseFloat($this.find(".counter__count").val());
5376
5377      if (count <= 0) {
5378        count = 1;
5379      }
5380
5381      if (!isNaN(price) && !isNaN(count)) {
5382        allSumm += count * price;
5383      }
5384    });
5385
5386  allSumm = number_format(parseFloat(allSumm), 0, ".", " ");
5387
5388  el.closest(".cart__item").find(".cart__item-summ .price_val").text(summ);
5389  el.closest(".basket").find(".foot .cart-total__value").text(allSumm);
5390}
5391
5392var timerBasketUpdate = false;
5393// - COUNTER
5394BasketCounter = function (el) {
5395  var elClass = $.trim(el.attr("class")),
5396    bClassMinus = elClass.indexOf("counter__action--minus") > -1,
5397    bClassPlus = elClass.indexOf("counter__action--plus") > -1,
5398    bClassCount = elClass.indexOf("counter__count") > -1,
5399    getCurUri = $.trim($("input[name=getPageUri]").val()),
5400    buyBlock = el.closest(".buy_block"),
5401    buttonToCart = buyBlock.find(".to_cart"),
5402    counterWrapper = el.closest(".counter"),
5403    counterInput = counterWrapper.find(".counter__count"),
5404    counterInputValue = parseFloat($.trim(counterInput.val())),
5405    price = parseFloat(buyBlock.find("input[name=PRICE]").val()),
5406    counterInputMaxCount = Math.pow(10, parseInt(counterInput.attr("maxlength"))) - 1,
5407    bAjax = el.closest(".basket").length || counterWrapper.hasClass("js-ajax") ? true : false;
5408  var bBasket = el.closest(".basket").length;
5409
5410  // class minus button
5411  if (bClassMinus) {
5412    var counterInputValueNew = counterInputValue - 1;
5413
5414    if (counterInputValueNew <= 0) {
5415      counterInputValueNew = 1;
5416    }
5417
5418    counterInput.val(counterInputValueNew);
5419
5420    if (bAjax) {
5421      Summ(el, counterInputValueNew, price);
5422
5423      if (timerBasketUpdate) {
5424        clearTimeout(timerBasketUpdate);
5425        timerBasketUpdate = false;
5426      }
5427
5428      timerBasketUpdate = setTimeout(function () {
5429        BasketUpdate(el, counterInputValueNew, bBasket);
5430        timerBasketUpdate = false;
5431      }, 700);
5432    }
5433  }
5434  // class plus button
5435  else if (bClassPlus) {
5436    var counterInputValueNew = counterInputValue + 1;
5437
5438    if (counterInputValueNew > counterInputMaxCount) {
5439      counterInputValueNew = counterInputMaxCount;
5440    }
5441
5442    counterInput.val(counterInputValueNew);
5443
5444    if (bAjax) {
5445      Summ(el, counterInputValueNew, price);
5446
5447      if (timerBasketUpdate) {
5448        clearTimeout(timerBasketUpdate);
5449        timerBasketUpdate = false;
5450      }
5451
5452      timerBasketUpdate = setTimeout(function () {
5453        BasketUpdate(el, counterInputValueNew, bBasket);
5454        timerBasketUpdate = false;
5455      }, 700);
5456    }
5457  }
5458  // class input
5459  else if (bClassCount) {
5460    var counterInputValueNew = counterInputValue;
5461
5462    if (counterInputValueNew <= 0 || isNaN(counterInputValueNew)) {
5463      counterInputValueNew = 1;
5464    }
5465    el.val(counterInputValueNew);
5466
5467    if (bAjax) {
5468      BasketUpdate(el, counterInputValueNew, bBasket);
5469    }
5470  }
5471
5472  if (!getCurUri && !el.closest(".basket.fly").length) {
5473    buttonToCart.data("quantity", counterInputValueNew);
5474  }
5475};
5476
5477BasketUpdate = function (el, counterInputValueNew, actualCounter) {
5478  var itemData = el.closest("[data-item]").data("item");
5479  var itemData =
5480    typeof arBasketItems === "object" && typeof arBasketItems[itemData.ID] === "object"
5481      ? arBasketItems[itemData.ID]
5482      : itemData;
5483  var getCurUri = $.trim($("input[name=getPageUri]").val());
5484  var scrollTop = $(".basket.fly").length
5485    ? $(".basket.fly .items_wrap").scrollTop()
5486    : $(".header-cart .basket.top").length
5487    ? $(".header-cart .basket.top .items").scrollTop()
5488    : "";
5489
5490  var bBasketTop =
5491    typeof arAsproOptions["THEME"]["ORDER_BASKET_VIEW"] !== "undefined" &&
5492    $.trim(arAsproOptions["THEME"]["ORDER_BASKET_VIEW"]) === "HEADER" &&
5493    $(".basket.top").length;
5494  var bBasketFly =
5495    typeof arAsproOptions["THEME"]["ORDER_BASKET_VIEW"] !== "undefined" && !bBasketTop && $(".basket.fly").length;
5496
5497  if (typeof itemData != "undefined" && !isNaN(itemData.ID) && itemData.ID > 0) {
5498    $.ajax({
5499      url: arAsproOptions["SITE_DIR"] + "include/footer/basket.php",
5500      type: "POST",
5501      data: { itemData: itemData, quantity: counterInputValueNew },
5502    }).done(function (html) {
5503      if (typeofExt(arBasketItems) === "object" || typeofExt(arBasketItems) === "array") {
5504        if (typeofExt(arBasketItems[itemData.ID]) === "object") {
5505          arBasketItems[itemData.ID]["QUANTITY"] = counterInputValueNew;
5506        }
5507      }
5508
5509      if (bBasketTop) {
5510        $(".ajax_basket").replaceWith(html);
5511      } else if (bBasketFly) {
5512        $(".ajax_basket").html($($.trim(html)).html());
5513        $(".basket.fly .items_wrap").scrollTop(scrollTop);
5514      }
5515
5516      var eventdata = { action: "loadBasket" };
5517      BX.onCustomEvent("onCompleteAction", [eventdata, $(html)]);
5518
5519      if (getCurUri) {
5520        $.ajax({
5521          url: getCurUri,
5522          type: "POST",
5523        }).done(function (html) {
5524          if ($(".basket.default").length) {
5525            $(".basket.default").html(html);
5526          }
5527        });
5528      }
5529    });
5530  } else {
5531    return;
5532  }
5533};
5534
5535CheckTabActive = function () {};
5536
5537/* parallax bg */
5538ParallaxBg = function () {
5539  if ($("*[data-type=parallax-bg]").length) {
5540    var x = $(window).scrollTop() / $(document).height();
5541    x = parseInt(-x * 280);
5542    $("*[data-type=parallax-bg]")
5543      .stop()
5544      .animate({ "background-position-y": x + "px" }, 400, "swing");
5545  }
5546};
5547
5548// Events
5549var timerScroll = false,
5550  ignoreScroll = [],
5551  documentScrollTopLast = $(document).scrollTop(),
5552  documentScrollTop = documentScrollTopLast;
5553$(window).scroll(function () {
5554  documentScrollTop = $(document).scrollTop();
5555
5556  if (!ignoreScroll.length) {
5557    if (timerScroll) {
5558      clearTimeout(timerScroll);
5559      timerScroll = false;
5560    }
5561    timerScroll = setTimeout(function () {
5562      BX.onCustomEvent("onWindowScroll", false);
5563    }, 100);
5564  }
5565
5566  documentScrollTopLast = $(document).scrollTop();
5567});
5568
5569var timerResize = false,
5570  ignoreResize = [];
5571
5572$(window).resize(function () {
5573  documentScrollTop = $(document).scrollTop();
5574
5575  CheckScrollToTop();
5576  CheckTopMenuPadding();
5577  CheckTopMenuOncePadding();
5578  CheckSearchWidth();
5579
5580  if (!ignoreResize.length) {
5581    if (timerResize) {
5582      clearTimeout(timerResize);
5583      timerResize = false;
5584    }
5585    timerResize = setTimeout(function () {
5586      BX.onCustomEvent("onWindowResize", false);
5587    }, 100);
5588  }
5589
5590  documentScrollTopLast = $(document).scrollTop();
5591});
5592
5593BX.addCustomEvent("onWindowScroll", function (eventdata) {
5594  try {
5595    ignoreScroll.push(true);
5596    ParallaxBg();
5597
5598    if (arAsproOptions["THEME"]["TYPE_SEARCH"] != "fixed") {
5599      if (!$("header > .top-block").length) {
5600        var height_block = 0,
5601          scrollVal = $(window).scrollTop();
5602        height_block = $(".logo_and_menu-row").actual("outerHeight");
5603        if (!scrollVal) {
5604          $(".inline-search-block").css({
5605            height: height_block,
5606            "line-height": height_block - 4 + "px",
5607            top: -height_block,
5608          });
5609        }
5610      }
5611    }
5612
5613    //CheckTopMenuDotted();
5614  } catch (e) {
5615  } finally {
5616    ignoreScroll.pop();
5617  }
5618});
5619
5620BX.addCustomEvent("onWindowResize", function (eventdata) {
5621  try {
5622    ignoreResize.push(true);
5623
5624    CheckHeaderFixedMenu();
5625    CheckTopMenuDotted();
5626    CheckTopVisibleMenu();
5627    CheckFlexSlider();
5628    CheckMainBannerSliderVText($(".banners-big .flexslider"));
5629    CheckObjectsSizes();
5630
5631    if (funcDefined("CoverPlayer")) {
5632      CoverPlayer();
5633    }
5634
5635    verticalAlign();
5636    CheckTabActive();
5637    setTimeout(function () {
5638      createTableCompare(
5639        $(".main-block .items .title-block:not(.clone) .item"),
5640        $(".prop_title_table"),
5641        $(".main-block .prop_title_table .item.clone")
5642      );
5643    }, 100);
5644    SliceHeightBlocks();
5645
5646    if (funcDefined("checkMobileFilter")) {
5647      checkMobileFilter();
5648    }
5649
5650    if (window.matchMedia("(min-width: 992px)").matches) {
5651      CloseMobileMenu();
5652      CloseMobilePhone();
5653    }
5654
5655  } catch (e) {
5656  } finally {
5657    ignoreResize.pop();
5658  }
5659});
5660
5661BX.addCustomEvent("onSlide", function (eventdata) {
5662  try {
5663    ignoreResize.push(true);
5664
5665    if (eventdata) {
5666      var slider = eventdata.slider;
5667      var slideClass = ".banners-big__item";
5668      var jsDots = $(slider).siblings(".owl-carousel__dots--line");
5669      if (jsDots.length) {
5670        if (eventdata.data) {
5671          if (eventdata.data.relatedTarget) {
5672            var dotScroll = jsDots.find(".owl-carousel__dot-scroll");
5673            var dotsWidth = jsDots.width();
5674            if (dotScroll.length) {
5675              var owlOptions = eventdata.data.relatedTarget;
5676
5677              if (owlOptions) {
5678                var itemsCount = owlOptions._items.length;
5679                var itemsInRow = owlOptions.settings.items;
5680                var currentItem = owlOptions._current; // + 1;
5681
5682                //orig old
5683                //currentItem = currentItem < itemsInRow  ? itemsCount + itemsInRow - 1 : currentItem;
5684                //var offset = ((currentItem - itemsInRow) / itemsCount) * dotsWidth;
5685
5686                //new by use count clones in slider
5687                var clonesInStart = Math.ceil(itemsCount / 2);
5688                currentItem = currentItem < clonesInStart ? itemsCount + clonesInStart - 1 : currentItem;
5689                currentItem = currentItem === itemsCount + clonesInStart ? clonesInStart : currentItem;
5690                var offset = ((currentItem - clonesInStart) / itemsCount) * dotsWidth;
5691
5692                var styles = {
5693                  width: dotsWidth / itemsCount + "px",
5694                  display: "block",
5695                  left: offset,
5696                };
5697
5698                dotScroll.css(styles);
5699              }
5700            }
5701          }
5702        }
5703      }
5704      if (slider) {
5705        // add classes .curent & .shown to slide
5706        slider.find(slideClass).removeClass("current");
5707        var curSlideIndex = eventdata.data.item.index;
5708        var curSlide = slider.find(".owl-item:eq(" + curSlideIndex + ")" + " " + slideClass);
5709
5710        curSlide.addClass("current");
5711        curSlide.addClass("shown");
5712        slider.resize();
5713
5714        if (slider.closest(".blocks").length)
5715          slider.closest(".blocks").find(".flex-direction-nav li").addClass("initied");
5716
5717        if (slider.closest(".wraps").length)
5718          slider.closest(".wraps").find(".flex-direction-nav li").addClass("initied");
5719
5720        if (!slider.find(".flex-control-nav li").length && slider.hasClass("normal")) {
5721          slider.find(".flex-direction-nav li a").addClass("flex-disabled");
5722        }
5723
5724        if (slider.closest(".banners-big").length) {
5725          //nav flex color
5726          slider.find(".flex-control-nav li").removeClass();
5727
5728          // header color
5729          $("header").removeClass("light dark");
5730          if (typeof curSlide.data("color") != "undefined") {
5731            $("header").addClass(curSlide.data("color"));
5732          }
5733
5734          // logo color
5735          if (typeof window.headerLogo !== 'undefined') {
5736            window.headerLogo.setColorOfBanner(curSlide[0]);
5737          }
5738        }
5739
5740        if (
5741          !slider.hasClass("flexslider-init-slice") &&
5742          slider.hasClass("nav-title") &&
5743          $(".gallery-block").closest(".tab-pane").hasClass("active")
5744        ) {
5745          slider.find(".item").sliceHeight({ lineheight: -3 });
5746          slider.addClass("flexslider-init-slice");
5747        }
5748
5749        if (slider.find(".flex-direction-nav").length) {
5750          if (slider.find(".flex-direction-nav").find("a.flex-disabled").length)
5751            slider.find(".flex-direction-nav").removeClass("opacity1").addClass("opacity0");
5752          else slider.find(".flex-direction-nav").removeClass("opacity0").addClass("opacity1");
5753        }
5754      }
5755    }
5756  } catch (e) {
5757  } finally {
5758    ignoreResize.pop();
5759  }
5760});
5761
5762BX.addCustomEvent("onSlideBefore", function (eventdata) {
5763  try {
5764    ignoreResize.push(true);
5765    if (eventdata) {
5766      var slider = eventdata.slider;
5767      if (slider) {
5768        if (slider.closest(".banners-big").length) {
5769          setTimeout(function () {
5770            var curSlide = slider.find(".banners-big__item.current");
5771
5772            //nav flex color
5773            slider.find(".flex-control-nav li").removeClass();
5774
5775            // header color
5776            $("header").removeClass("light dark");
5777            if (typeof curSlide.data("color") != "undefined") {
5778              slider.find(".flex-control-nav li").addClass(curSlide.data("color"));
5779              $("header").addClass(curSlide.data("color"));
5780            }
5781
5782            // logo color
5783            if (typeof window.headerLogo !== 'undefined') {
5784              window.headerLogo.setColorOfBanner(curSlide[0]);
5785            }
5786          }, 100);
5787        } else if (slider.hasClass("top-bigs")) {
5788          setTimeout(function () {
5789            var index = slider.find(".item.flex-active-slide").data("slide_key");
5790            $(".bxSlider.top-small .slides").data("bxSlider").goToSlide(index);
5791            $(".bxSlider.top-small .slides li").removeClass("flex-active-slide");
5792            $('.bxSlider.top-small .slides li[data-slide_key="' + index + '"]').addClass("flex-active-slide");
5793          }, 100);
5794        }
5795      }
5796    }
5797  } catch (e) {
5798  } finally {
5799    ignoreResize.pop();
5800  }
5801});
5802
5803BX.addCustomEvent("onSlideEnd", function (eventdata) {
5804  try {
5805    ignoreResize.push(true);
5806    if (eventdata) {
5807      var slider = eventdata.slider;
5808    }
5809  } catch (e) {
5810  } finally {
5811    ignoreResize.pop();
5812  }
5813});
5814
5815var onCaptchaVerifyinvisible = function (response) {
5816  $(".g-recaptcha:last").each(function () {
5817    var id = $(this).attr("data-widgetid");
5818    if (typeof id !== "undefined" && response) {
5819      if (!$(this).closest("form").find(".g-recaptcha-response").val())
5820        $(this).closest("form").find(".g-recaptcha-response").val(response);
5821      if ($("iframe[src*=recaptcha]").length) {
5822        $("iframe[src*=recaptcha]").each(function () {
5823          var block = $(this).parent().parent();
5824          if (!block.hasClass("grecaptcha-badge")) block.css("width", "100%");
5825        });
5826      }
5827      if ($(this).closest("form").attr("name") == "form_comment") BX.submit(BX("form_comment"));
5828      else $(this).closest("form").submit();
5829    }
5830  });
5831};
5832
5833var onCaptchaVerifynormal = function (response) {
5834  $(".g-recaptcha").each(function () {
5835    var id = $(this).attr("data-widgetid");
5836    if (typeof id !== "undefined") {
5837      if (grecaptcha.getResponse(id) != "") {
5838        $(this).closest("form").find(".recaptcha").valid();
5839      }
5840    }
5841  });
5842};
5843
5844// on submit form
5845BX.addCustomEvent('onSubmitForm', function (eventdata) {
5846	try {
5847		if (
5848      typeof eventdata === 'object' &&
5849      eventdata &&
5850      eventdata.form
5851    ) {
5852      if (!(eventdata.form instanceof Node)) {
5853        eventdata.form = eventdata.form[0];
5854      }
5855
5856      const validateInputName  = `aspro_${arAsproOptions.SOLUTION_NAME}_form_validate`;
5857      if (!eventdata.form.querySelector(`[name="${validateInputName}"]`)) {
5858        eventdata.form.appendChild(
5859          BX.create('input', {
5860            attrs: {
5861              type: 'hidden',
5862              name: validateInputName,
5863            }
5864          })
5865        );
5866      }
5867
5868      (new Promise((resolve, reject) => {
5869        if (BX.Aspro?.Captcha) {
5870          BX.Aspro.Captcha.onSubmit(eventdata).then((result) => {
5871            resolve(result);
5872          }).catch((e) => {
5873            reject(e);
5874          });
5875
5876          return;
5877        }
5878
5879        resolve(true);
5880      })).then((result) => {
5881        if (result) {
5882          eventdata.form.submit();
5883          if (eventdata.form.closest('.form')) {
5884            eventdata.form.closest('.form').classList.add('sending');
5885          }
5886        }
5887      });
5888		}
5889	}
5890	catch (e) {
5891		console.error(e);
5892	}
5893});

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