PageSourceSearch

https://aktiv-lingvo.ru/local/templates/aspro-allcorp3kids_34web/js/general.js

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

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.