PageSourceSearch

https://td-etiketki.ru/bitrix/templates/aspro-allcorp3/js/general.js?1638351103188174

js td-etiketki.ru collected 2026-10-09 21:29:18 UTC 188,174 bytes, 5,675 lines download raw bytes

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

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.