PageSourceSearch

https://dek-art.ru/bitrix/templates/aspro-priority2/js/general.js?1774628324196614

js dek-art.ru collected 2026-10-04 23:54:56 UTC 196,614 bytes, 5,794 lines download raw bytes

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

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.