PageSourceSearch

https://unisaw.ru/bitrix/templates/aspro-unisaw/js/general.js?1669103260188242

js unisaw.ru collected 2026-10-01 14:36:55 UTC 188,242 bytes, 5,681 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 =
2345        function (slider) {
2346          var eventdata = { slider: slider };
2347          BX.onCustomEvent("onSlide", [eventdata]);
2348        });
2349
2350    config.before = function (slider) {
2351      var eventdata = { slider: slider };
2352      BX.onCustomEvent("onSlideBefore", [eventdata]);
2353    };
2354
2355    config.end = function (slider) {
2356      var eventdata = { slider: slider };
2357      BX.onCustomEvent("onSlideEnd", [eventdata]);
2358    };
2359
2360    /*if(typeof(config.nav) == 'undefined')
2361			slider.addClass('dark-nav');*/
2362    slider.flexslider(config).addClass("flexslider-init");
2363    if (config.controlNav) slider.addClass("flexslider-control-nav");
2364    if (config.directionNav) slider.addClass("flexslider-direction-nav");
2365  });
2366};
2367
2368InitFlexSliderClass = function (class_name) {
2369  //$('.flexslider:not(.thmb):not(.flexslider-init)').each(function(){
2370
2371  var slider = $(class_name);
2372  var options;
2373  var defaults = {
2374    animationLoop: false,
2375    controlNav: false,
2376    directionNav: true,
2377    animation: "slide",
2378  };
2379  var config = $.extend({}, defaults, options, slider.data("plugin-options"));
2380
2381  var slide_counts = "";
2382  if (typeof slider.data("plugin-options") != "undefined") {
2383    if ("slide_counts" in slider.data("plugin-options")) slide_counts = slider.data("plugin-options").slide_counts;
2384  }
2385
2386  if (typeof config.counts != "undefined" && config.direction !== "vertical") {
2387    config.maxItems = getGridSize(config.counts);
2388    config.minItems = getGridSize(config.counts);
2389    config.move = getGridSize(config.counts);
2390
2391    config.itemWidth = 200;
2392  }
2393  if (slide_counts) config.move = slide_counts;
2394
2395  // custom direction nav
2396  if (typeof config.customDirection != "undefined") config.customDirectionNav = $(config.customDirection);
2397
2398  (config.prevText = BX.message("FANCY_PREV")), //String: Set the text for the "previous" directionNav item
2399    (config.nextText = BX.message("FANCY_NEXT")),
2400    (config.after = config.start =
2401      function (slider) {
2402        var eventdata = { slider: slider };
2403        BX.onCustomEvent("onSlide", [eventdata]);
2404      });
2405
2406  config.before = function (slider) {
2407    var eventdata = { slider: slider };
2408    BX.onCustomEvent("onSlideBefore", [eventdata]);
2409  };
2410
2411  config.end = function (slider) {
2412    var eventdata = { slider: slider };
2413    BX.onCustomEvent("onSlideEnd", [eventdata]);
2414  };
2415
2416  slider.flexslider(config).addClass("flexslider-init");
2417  if (config.controlNav) slider.addClass("flexslider-control-nav");
2418  if (config.directionNav) slider.addClass("flexslider-direction-nav");
2419  //});
2420};
2421
2422InitFlexSliderMin = function () {
2423  $(".bxSlider.top-small").on("mousedown", ".slides li", function () {
2424    var index = $(this).data("slide_key");
2425    $(this).siblings().removeClass("flex-active-slide");
2426    $(this).addClass("flex-active-slide");
2427    $(this)
2428      .siblings('[data-slide_key="' + index + '"]')
2429      .addClass("flex-active-slide");
2430    $(".top-bigs").data("flexslider").flexAnimate(index);
2431  });
2432};
2433
2434SliceHeightBlocks = function () {
2435  $('*[data-slice="Y"]').each(function () {
2436    var slice_els = $(this).find('*[data-slice-block="Y"]');
2437    if (slice_els.length) {
2438      var slice_params = {};
2439      if (slice_els.data("slice-params")) slice_params = slice_els.data("slice-params");
2440      slice_els.sliceHeight(slice_params);
2441    }
2442  });
2443};
2444
2445createTableCompare = function (originalTable, appendDiv, cloneTable) {
2446  try {
2447    if ($(".tarifs .head-block:visible").length) {
2448      var clone = originalTable.clone().addClass("clone");
2449      if (cloneTable.length) {
2450        cloneTable.remove();
2451        appendDiv.html("");
2452        appendDiv.html(clone);
2453      } else {
2454        appendDiv.append(clone);
2455      }
2456    }
2457  } catch (e) {
2458  } finally {
2459  }
2460};
2461
2462InitTopestMenuGummi = function () {
2463  if (!isOnceInited) {
2464    function _init() {
2465      var arItems = $menuTopest.find(".menu-topest__item");
2466      var cntItems = arItems.length;
2467      if (cntItems) {
2468        var itemsWidth = 0;
2469        for (var i = 0; i < cntItems; ++i) {
2470          var item = arItems.eq(i);
2471          var itemWidth = item.actual("outerWidth", { includeMargin: true });
2472
2473          arItemsHideWidth[i] = (itemsWidth += itemWidth) + (i == cntItems - 1 ? 0 : moreWidth);
2474        }
2475      }
2476    }
2477
2478    function _gummi() {
2479      var rowWidth = $menuTopest.actual("innerWidth");
2480      var arItems = $menuTopest.find(".menu-topest__item");
2481      var cntItems = arItems.length;
2482      var arItemsToRemove = [];
2483
2484      if (cntItems) {
2485        var bMore = false;
2486        var moreItems = [];
2487        for (var i = cntItems - 1; i >= 0; --i) {
2488          var item = arItems.eq(i);
2489          var bInMore = item.parents(".menu-topest__more").length > 0;
2490          if (!bInMore) {
2491            if (arItemsHideWidth[i] > rowWidth + 1) {
2492              if (!bMore) {
2493                bMore = true;
2494                more.removeClass("hidden");
2495              }
2496              var clone = item.clone();
2497              clone.find(">a").addClass("dark_font");
2498              moreItems.push(clone[0]);
2499              arItemsToRemove.push(i);
2500            } else {
2501              break;
2502            }
2503          }
2504        }
2505        $(moreItems).prependTo(moreDropdown);
2506
2507        if (!bMore) {
2508          for (var i = 0; i < cntItems; ++i) {
2509            var item = arItems.eq(i);
2510            var bInMore = item.parents(".menu-topest__more li").length > 0;
2511            if (bInMore) {
2512              if (arItemsHideWidth[i] <= rowWidth) {
2513                if (i === cntItems - 1) {
2514                  bMore = false;
2515                  more.addClass("hidden");
2516                }
2517                var clone = item.clone();
2518                clone.find(">a").removeClass("dark_font");
2519                clone.insertBefore(more);
2520                item.addClass("cloned");
2521              }
2522            }
2523          }
2524        }
2525
2526        if (arItemsToRemove.length) {
2527          arItemsToRemove.map(function (elIndex) {
2528            $(arItems[elIndex]).remove();
2529          });
2530        }
2531
2532        $menuTopest.find(".menu-topest__item.cloned").remove();
2533        $menuTopest.closest(".menu-topest__wrapper").addClass("dotted-complete");
2534        var wrapper = $menuTopest.closest(".hide-dotted");
2535        if (wrapper.length) {
2536          wrapper.addClass("dotted-complete");
2537        }
2538      }
2539    }
2540
2541    var $menuTopest = $(".menu-topest");
2542    if ($menuTopest.length) {
2543      var more = $menuTopest.find(".menu-topest__more");
2544      var moreDropdown = more.find(">.dropdown");
2545      var moreWidth = more.actual("outerWidth", { includeMargin: true });
2546      var arItemsHideWidth = [];
2547
2548      ignoreResize.push(true);
2549      _init();
2550      _gummi();
2551      ignoreResize.pop();
2552
2553      BX.addCustomEvent("onWindowResize", function (eventdata) {
2554        try {
2555          ignoreResize.push(true);
2556          _gummi();
2557        } catch (e) {
2558        } finally {
2559          ignoreResize.pop();
2560        }
2561      });
2562    }
2563  }
2564};
2565
2566CheckHeaderFixedMenu = function () {
2567  if (
2568    arAsproOptions["THEME"]["HEADER_FIXED"] == 2 &&
2569    $("#headerfixed .js-nav").length &&
2570    window.matchMedia("(min-width: 992px)").matches
2571  ) {
2572    $("#headerfixed .js-nav").css("width", "0");
2573    var all_width = 0,
2574      cont_width = $("#headerfixed .maxwidth-theme").actual("width"),
2575      padding_menu =
2576        $("#headerfixed .logo-row.v2 .menu-block").actual("outerWidth") -
2577        $("#headerfixed .logo-row.v2 .menu-block").actual("width");
2578    $("#headerfixed .logo-row.v2 > .inner-table-block").each(function () {
2579      if (!$(this).hasClass("menu-block")) all_width += $(this).actual("outerWidth");
2580    });
2581    $("#headerfixed .js-nav").width(cont_width - all_width - padding_menu);
2582  }
2583};
2584
2585CheckTopMenuPadding = function () {
2586  if ($(".logo_and_menu-row .right-icons .wrap_icon").length && $(".logo_and_menu-row .menu-row").length) {
2587    var menuPosition = $(".menu-row .menu-only").position().left,
2588      maxWidth = $(".logo_and_menu-row .maxwidth-theme").width() - 32,
2589      leftPadding = 0,
2590      rightPadding = 0;
2591
2592    $(".logo_and_menu-row .menu-row>div")
2593      .each(function (indx) {
2594        if (!$(this).hasClass("menu-only")) {
2595          var elementPosition = $(this).position().left,
2596            elementWidth = $(this).outerWidth();
2597
2598          if (elementPosition > menuPosition) {
2599            rightPadding += elementWidth;
2600          } else {
2601            leftPadding += elementWidth;
2602          }
2603        }
2604      })
2605      .promise()
2606      .done(function () {
2607        $(".logo_and_menu-row .menu-only").css({ "padding-left": leftPadding, "padding-right": rightPadding + 1 });
2608      });
2609  }
2610};
2611
2612CheckTopMenuOncePadding = function () {
2613  if ($(".menu-row.sliced .right-icons .wrap_icon").length) {
2614    var menuPosition = $(".menu-row .menu-only").position().left,
2615      maxWidth = $(".logo_and_menu-row .maxwidth-theme").width() - 32,
2616      leftPadding = 0,
2617      rightPadding = 0;
2618
2619    $(".menu-row.sliced .maxwidth-theme>div>div")
2620      .each(function (indx) {
2621        if (!$(this).hasClass("menu-only")) {
2622          var elementPosition = $(this).position().left,
2623            elementWidth = $(this).outerWidth();
2624
2625          if (elementPosition > menuPosition) {
2626            rightPadding += elementWidth;
2627          } else {
2628            leftPadding += elementWidth;
2629          }
2630        }
2631      })
2632      .promise()
2633      .done(function () {
2634        $(".menu-row.sliced .menu-only").css({ "padding-left": leftPadding, "padding-right": rightPadding + 1 });
2635      });
2636  }
2637};
2638
2639CheckSearchWidth = function () {
2640  if ($(".logo_and_menu-row .search_wrap").length) {
2641    var searchPosition = $(".logo_and_menu-row .search_wrap").position().left,
2642      maxWidth = $(".logo_and_menu-row .maxwidth-theme").width() - 32;
2643    width = 0;
2644
2645    $(".logo_and_menu-row .maxwidth-theme>div")
2646      .each(function () {
2647        if (!$(this).hasClass("search_wrap")) {
2648          var elementWidth = $(this).outerWidth();
2649
2650          width = width ? width - elementWidth : maxWidth - elementWidth;
2651        }
2652      })
2653      .promise()
2654      .done(function () {
2655        $(".logo_and_menu-row .search_wrap").outerWidth(width).css({ opacity: 1, visibility: "visible" });
2656      });
2657  }
2658};
2659
2660waitCounter = function (idCounter, delay, callback) {
2661  var obCounter = window["yaCounter" + idCounter];
2662  if (typeof obCounter == "object") {
2663    if (typeof callback == "function") callback();
2664  } else {
2665    setTimeout(function () {
2666      waitCounter(idCounter, delay, callback);
2667    }, delay);
2668  }
2669};
2670
2671var waitReCaptcha = function (delay, callback) {
2672  if (typeof grecaptcha == "object") {
2673    if (typeof callback == "function") {
2674      callback();
2675    }
2676  } else {
2677    setTimeout(function () {
2678      waitReCaptcha(delay, callback);
2679    }, delay);
2680  }
2681};
2682
2683var reCaptchaRender = function (response) {
2684  if ($(".g-recaptcha:not(.rendered)").length) {
2685    waitReCaptcha(50, function () {
2686      $(".g-recaptcha:not(.rendered)").each(function () {
2687        $this = $(this);
2688        $this.addClass("rendered");
2689        var id = grecaptcha.render($this[0], {
2690          sitekey: $this.attr("data-sitekey"),
2691          theme: $this.attr("data-theme"),
2692          size: $this.attr("data-size"),
2693          callback: $this.attr("data-callback"),
2694        });
2695        $this.attr("data-widgetid", id);
2696      });
2697    });
2698  }
2699};
2700
2701var reCaptchaVerify = function (response) {
2702  $(".g-recaptcha.rendered").each(function () {
2703    var id = $(this).attr("data-widgetid");
2704    if (typeof id !== "undefined") {
2705      if (grecaptcha.getResponse(id) != "") {
2706        $(this).closest("form").find(".recaptcha").valid();
2707      }
2708    }
2709  });
2710};
2711
2712var reCaptchaVerifyHidden = function (response) {
2713  $(".g-recaptcha.rendered:last").each(function () {
2714    var id = $(this).attr("data-widgetid");
2715    if (typeof id !== "undefined" && response) {
2716      if (!$(this).closest("form").find(".g-recaptcha-response").val())
2717        $(this).closest("form").find(".g-recaptcha-response").val(response);
2718      $(this).closest("form").submit();
2719    }
2720  });
2721};
2722
2723waitYTPlayer = function (delay, callback) {
2724  if (typeof YT !== "undefined" && YT && YT.Player) {
2725    if (typeof callback == "function") callback();
2726  } else {
2727    setTimeout(function () {
2728      waitYTPlayer(delay, callback);
2729    }, delay);
2730  }
2731};
2732
2733var scrollToTopAnimateClassIn = false;
2734var scrollToTopAnimateClassOut = false;
2735
2736var $body = {};
2737var $scrolltotop = {};
2738var isOnceInited = false;
2739
2740if (navigator.userAgent.indexOf("Edge") != -1) document.documentElement.className += " edge";
2741
2742initFull = function () {
2743  checkMobileRegion();
2744};
2745
2746var isFrameDataReceived = false;
2747if (typeof window.frameCacheVars !== "undefined") {
2748  BX.addCustomEvent(window, "onFrameDataRequestFail", function (response) {
2749    // console.log(response);
2750  });
2751
2752  BX.addCustomEvent("onFrameDataReceivedBefore", function () {
2753    // stop ya metrika webvisor DOM indexer
2754    pauseYmObserver();
2755  });
2756
2757  BX.addCustomEvent("onFrameDataReceived", function (json) {
2758    initFull();
2759
2760    // resume ya metrika webvisor
2761    // (100ms sliceHeight) + (200ms mCustomScroll) + (100ms lazyload)
2762    setTimeout(resumeYmObserver, 400);
2763
2764    isFrameDataReceived = true;
2765  });
2766} else {
2767  $(document).ready(initFull);
2768}
2769
2770scrollPreviewBlock = function () {
2771  scrollToBlock($.cookie("scroll_block"));
2772  $.cookie("scroll_block", null);
2773};
2774
2775checkMobileRegion = function () {
2776  if ($(".confirm_region").length) {
2777    if (!$(".top_mobile_region").length)
2778      $('<div class="top_mobile_region"><div class="confirm_region"></div></div>').insertBefore($(".body"));
2779    $(".top_mobile_region .confirm_region").html($(".regions .confirm_region").html());
2780  }
2781};
2782
2783$(document).on("click", ".map-items__item", function () {
2784  var _this = $(this),
2785    itemID = _this.data("id"),
2786    animationTime = 200;
2787
2788  _this.closest(".map-wrapper").find(".index-block__subtitle").addClass("hidden");
2789  _this.closest(".map-wrapper").find(".index-block__title-wrapper").addClass("hidden");
2790  _this.closest(".map-wrapper").find(".index-block__preview").addClass("hidden");
2791
2792  _this.closest(".map-container").find(" > .map-detail-items__item-svg").fadeIn(animationTime);
2793
2794  _this.closest(".map-items").fadeOut(animationTime, function () {
2795    _this.closest(".map-container").find(".map-detail-items").fadeIn(animationTime);
2796    _this
2797      .closest(".map-container")
2798      .find(".map-detail-items .map-detail-items__item[data-id=" + itemID + "]")
2799      .fadeIn(animationTime);
2800
2801    var arCoordinates = _this.data("coordinates").split(",");
2802
2803    if (typeof map === "object" && map !== null && "setCenter" in map) {
2804      if ($(".bx-google-map").length) {
2805        map.setCenter({ lat: +arCoordinates[0], lng: +arCoordinates[1] });
2806        map.setZoom(17);
2807      } else {
2808        map.setCenter([arCoordinates[0], arCoordinates[1]], 15);
2809      }
2810    }
2811  });
2812});
2813
2814$(document).on("click", ".map-detail-items__item-svg", function () {
2815  var _this = $(this).closest(".map-container").find(".map-detail-items__item:visible"),
2816    animationTime = 200;
2817
2818  _this.fadeOut(animationTime);
2819
2820  _this.closest(".map-container").find(" > .map-detail-items__item-svg").fadeOut(10);
2821
2822  _this
2823    .closest(".map-container")
2824    .find(".map-detail-items")
2825    .fadeOut(animationTime, function () {
2826      _this.closest(".map-container").find(".map-items").fadeIn(animationTime);
2827
2828      _this.closest(".map-wrapper").find(".index-block__subtitle").removeClass("hidden");
2829      _this.closest(".map-wrapper").find(".index-block__title-wrapper").removeClass("hidden");
2830      _this.closest(".map-wrapper").find(".index-block__preview").removeClass("hidden");
2831
2832      if (typeof map === "object" && map !== null) {
2833        if (typeof clusterer === "object" && clusterer !== null && "setBounds" in map && "getBounds" in clusterer) {
2834          map.setBounds(clusterer.getBounds(), {
2835            zoomMargin: 40,
2836            // checkZoomRange: true
2837          });
2838        } else if (typeof bounds === "object" && bounds !== null && "fitBounds" in map && "getCenter" in bounds) {
2839          map.fitBounds(bounds);
2840        }
2841      }
2842    });
2843});
2844
2845$(document).ready(function () {
2846  scrollToTop();
2847  InitScrollBar();
2848  initCountdown();
2849  setBasketItemsClasses();
2850
2851  // ripple effect for buttons
2852  $.ripple(".btn:not(.btn--no-rippple)", {
2853    debug: false, // Turn Ripple.js logging on/off
2854    on: "mouseenter", // The event to trigger a ripple effect
2855    opacity: 0.4, // The opacity of the ripple
2856    color: "auto", // Set the background color. If set to "auto", it will use the text color
2857    multi: true, // Allow multiple ripples per element
2858    duration: 0.6, // The duration of the ripple
2859    easing: "linear", // The CSS3 easing function of the ripple
2860  });
2861
2862  if (!jQuery.browser.safari) {
2863    CheckTopMenuPadding();
2864    CheckTopMenuOncePadding();
2865    CheckHeaderFixed();
2866    CheckTopMenuDotted();
2867    MegaMenuFixed();
2868    CheckSearchWidth();
2869    InitTopestMenuGummi();
2870    isOnceInited = true;
2871
2872    setTimeout(function () {
2873      $(window).resize(); // need to check resize flexslider & menu
2874    }, 350);
2875
2876    setTimeout(function () {
2877      $(window).scroll();
2878    }, 250); // need to check position fixed ask block
2879  } else {
2880    setTimeout(function () {
2881      $(window).resize(); // need to check resize flexslider & menu
2882
2883      setTimeout(function () {
2884        CheckTopMenuPadding();
2885        CheckTopMenuOncePadding();
2886        CheckHeaderFixed();
2887        CheckTopMenuDotted();
2888        MegaMenuFixed();
2889        CheckSearchWidth();
2890        InitTopestMenuGummi();
2891        isOnceInited = true;
2892
2893        setTimeout(function () {
2894          $(window).scroll();
2895        }, 50);
2896      }, 50);
2897    }, 350);
2898  }
2899
2900  if (arAsproOptions["THEME"]["USE_DEBUG_GOALS"] === "Y") {
2901    $.cookie("_ym_debug", "1");
2902  } else {
2903    $.cookie("_ym_debug", null);
2904  }
2905
2906  //  --- Bind mobile menu  ---
2907  var $mobileMenu = $("#mobilemenu");
2908  if ($mobileMenu.length) {
2909    $mobileMenu.isOpen = $mobileMenu.hasClass("show");
2910    $mobileMenu.isLeftSide = $("body").hasClass("mmenu_leftside");
2911    $mobileMenuNlo = $mobileMenu.find("[data-nlo]");
2912
2913    $(document).on("click", "#mobileheader .burger", function () {
2914      SwipeMobileMenu();
2915      CloseMobilePhone();
2916    });
2917
2918    $(document).on("click", ".mobilemenu__close", function () {
2919      CloseMobileMenu();
2920    });
2921
2922    $(document).on("click", ".mobilemenu__menu .toggle_block", function (e) {
2923      var $this = $(this);
2924      var $item = $this.closest(".mobilemenu__menu-item");
2925
2926      if ($item.hasClass("mobilemenu__menu-item--parent")) {
2927        e.preventDefault();
2928
2929        $item.addClass("mobilemenu__menu-item--expanded");
2930        MoveMobileMenuWrapNext();
2931      }
2932    });
2933
2934    $(document).on("click", ".mobilemenu__menu a", function (e) {
2935      var $this = $(this);
2936      var $item = $this.closest(".mobilemenu__menu-item");
2937
2938      if ($item.hasClass("mobilemenu__menu-item--back")) {
2939        e.preventDefault();
2940
2941        MoveMobileMenuWrapPrev();
2942        setTimeout(function () {
2943          $item.closest(".mobilemenu__menu-item--expanded").removeClass("mobilemenu__menu-item--expanded");
2944        }, 400);
2945      } else {
2946        var href = $this.attr("href");
2947        if (typeof href !== "undefined") {
2948          if (href.length) {
2949            window.location.href = href;
2950            window.location.reload();
2951          } else {
2952            if ($item.hasClass("mobilemenu__menu-item--parent")) {
2953              e.preventDefault();
2954
2955              $item.addClass("mobilemenu__menu-item--expanded");
2956              MoveMobileMenuWrapNext();
2957
2958              return;
2959            } else if ($item.hasClass("mobilemenu__menu-item--title")) {
2960              e.preventDefault();
2961
2962              return;
2963            }
2964          }
2965        }
2966
2967        CloseMobileMenu();
2968      }
2969    });
2970
2971    if ($mobileMenu.isLeftSide) {
2972      $mobileMenu.parent().append('<div class="mobilemenu__overlay"></div>');
2973      var $mobileMenuOverlay = $(".mobilemenu__overlay");
2974
2975      $mobileMenuOverlay.click(function () {
2976        if ($mobileMenu.isOpen) {
2977          CloseMobileMenu();
2978        }
2979      });
2980
2981      $(document).swiperight(function (e) {
2982        if (
2983          !$(e.target).closest(".owl-carousel").length &&
2984          !$(e.target).closest(".swipeignore").length &&
2985          !$(e.target).closest(".mobile-scrolled").length
2986        ) {
2987          var partWindowWidth = document.documentElement.clientWidth / 3;
2988          var swipeStart = e.swipestart.coords[0];
2989          if (swipeStart <= partWindowWidth) {
2990            OpenMobileMenu();
2991          }
2992        }
2993      });
2994
2995      $(document).swipeleft(function (e) {
2996        if (
2997          !$(e.target).closest(".owl-carousel").length &&
2998          !$(e.target).closest(".swipeignore").length &&
2999          !$(e.target).closest(".mobile-scrolled").length
3000        ) {
3001          CloseMobileMenu();
3002        }
3003      });
3004    } else {
3005      $(document).on("click", "#mobileheader", function (e) {
3006        if (
3007          !$(e.target).closest("#mobilemenu").length &&
3008          !$(e.target).closest(".burger").length &&
3009          $mobileMenu.isOpen
3010        ) {
3011          CloseMobileMenu();
3012        }
3013      });
3014    }
3015
3016    OpenMobileMenu = function () {
3017      if (!$mobileMenu.isOpen && window.matchMedia("(max-width: 991px)").matches) {
3018        // hide styleswitcher
3019        if ($(".style-switcher").hasClass("active")) {
3020          $(".style-switcher .switch").trigger("click");
3021        }
3022        $(".style-switcher .switch").hide();
3023        $(".style-switcher .switch_presets").hide();
3024
3025        if ($mobileMenu.isLeftSide) {
3026          setTimeout(function () {
3027            // hide body scroll
3028            $("body").addClass("overflow-block");
3029
3030            // blur body
3031            $("#mobileheader").addClass("filter-none");
3032            $("#mobilemenu").addClass("filter-none");
3033            $("body").addClass("jqm-initied");
3034
3035            // show overlay
3036            $mobileMenuOverlay.fadeIn("fast");
3037          }, 100);
3038        } else {
3039          // hide body scroll
3040          $("body").addClass("overflow-block");
3041
3042          // set menu top = bottom of header
3043          $mobileMenu.css({
3044            top: +($("#mobileheader")[0].getBoundingClientRect().top + $("#mobileheader").height()) + "px",
3045          });
3046
3047          // change burger icon
3048          // $('#mobileheader .burger').addClass('c');
3049        }
3050
3051        // show menu
3052        $mobileMenu.addClass("show");
3053        $mobileMenu.isOpen = true;
3054
3055        var $inner = $mobileMenu.find(".mobilemenu__inner");
3056        var params = $inner.data("params");
3057        if (typeof params === "undefined") {
3058          params = {
3059            depth: 0,
3060            scroll: {},
3061            height: {},
3062          };
3063        }
3064        $inner.data("params", params);
3065
3066        if ($mobileMenuNlo.length) {
3067          if (!$mobileMenuNlo.hasClass("nlo-loadings")) {
3068            $mobileMenuNlo.addClass("nlo-loadings");
3069            setTimeout(function () {
3070              $.ajax({
3071                data: { nlo: $mobileMenuNlo.attr("data-nlo") },
3072                error: function () {
3073                  $mobileMenuNlo.removeClass("nlo-loadings");
3074                },
3075                complete: function (jqXHR, textStatus) {
3076                  if (textStatus === "success" || jqXHR.status == 404) {
3077                    var ob = BX.processHTML($.trim(jqXHR.responseText));
3078                    BX.ajax.processScripts(ob.SCRIPT);
3079                    $mobileMenuNlo.replaceWith(ob.HTML);
3080                  }
3081                },
3082              });
3083            }, 300);
3084          }
3085        }
3086      }
3087    };
3088
3089    CloseMobileMenu = function () {
3090      if ($mobileMenu.isOpen) {
3091        // hide menu
3092        $mobileMenu.removeClass("show");
3093        $mobileMenu.isOpen = false;
3094
3095        // show styleswitcher
3096        $(".style-switcher .switch").show();
3097        $(".style-switcher .switch_presets").show();
3098
3099        if ($mobileMenu.isLeftSide) {
3100          setTimeout(function () {
3101            // hide overlay
3102            $mobileMenuOverlay.fadeOut("fast");
3103
3104            // show body scroll
3105            $("body").removeClass("overflow-block");
3106
3107            // unblur body
3108            $("body").removeClass("jqm-initied");
3109            $("#mobilemenu").removeClass("filter-none");
3110            $("#mobileheader").removeClass("filter-none");
3111          }, 100);
3112        } else {
3113          // change burger icon
3114          // $('#mobileheader .burger').removeClass('c');
3115
3116          // show body scroll
3117          $("body").removeClass("overflow-block");
3118        }
3119
3120        setTimeout(function () {
3121          var $scroller = $mobileMenu.find(".mobilemenu");
3122          var $inner = $mobileMenu.find(".mobilemenu__inner");
3123          var params = $inner.data("params");
3124          params.depth = 0;
3125          $inner.data("params", params).attr("style", "");
3126          $mobileMenu.scrollTop(0);
3127          $scroller.css("height", "");
3128        }, 400);
3129      }
3130    };
3131
3132    SwipeMobileMenu = function () {
3133      if ($mobileMenu.isOpen) {
3134        CloseMobileMenu();
3135      } else {
3136        OpenMobileMenu();
3137      }
3138    };
3139
3140    CheckMobileMenu = function () {
3141      if (!window.matchMedia("(max-width: 991px)").matches) {
3142        CloseMobileMenu();
3143      }
3144    };
3145
3146    function MoveMobileMenuWrapNext() {
3147      var $scroller = $mobileMenu.find(".mobilemenu");
3148      var $inner = $mobileMenu.find(".mobilemenu__inner");
3149      if ($inner.length) {
3150        var params = $inner.data("params");
3151        var $dropdownNext = $mobileMenu
3152          .find(".mobilemenu__menu-item--expanded>.mobilemenu__menu-dropdown")
3153          .eq(params.depth);
3154        if ($dropdownNext.length) {
3155          // save scroll position
3156          params.scroll[params.depth] = parseInt($mobileMenu.scrollTop());
3157
3158          // height while move animating
3159          params.height[params.depth + 1] = Math.max(
3160            $dropdownNext.height(),
3161            !params.depth
3162              ? $inner.height()
3163              : $mobileMenu
3164                  .find(".mobilemenu__menu-item--expanded>.mobilemenu__menu-dropdown")
3165                  .eq(params.depth - 1)
3166                  .height()
3167          );
3168          $scroller.css("height", params.height[params.depth + 1] + "px");
3169
3170          // inc depth
3171          ++params.depth;
3172
3173          // translateX for move
3174          $inner.css("transform", "translateX(" + -100 * params.depth + "%)");
3175
3176          // scroll to top
3177          setTimeout(function () {
3178            $mobileMenu.animate({ scrollTop: 0 }, 200);
3179          }, 100);
3180
3181          // height on enimating end
3182          var h =
3183            $dropdownNext.height() +
3184            parseInt($dropdownNext.css("padding-top")) +
3185            parseInt($dropdownNext.css("padding-bottom"));
3186          setTimeout(function () {
3187            if (h) {
3188              $scroller.css("height", h + "px");
3189            } else {
3190              $scroller.css("height", "");
3191            }
3192          }, 200);
3193        }
3194
3195        $inner.data("params", params);
3196      }
3197    }
3198
3199    function MoveMobileMenuWrapPrev() {
3200      var $scroller = $mobileMenu.find(".mobilemenu");
3201      var $inner = $mobileMenu.find(".mobilemenu__inner");
3202      if ($inner.length) {
3203        var params = $inner.data("params");
3204        if (params.depth > 0) {
3205          var $dropdown = $mobileMenu
3206            .find(".mobilemenu__menu-item--expanded>.mobilemenu__menu-dropdown")
3207            .eq(params.depth - 1);
3208          if ($dropdown.length) {
3209            // height while move animating
3210            $scroller.css("height", params.height[params.depth] + "px");
3211
3212            // dec depth
3213            --params.depth;
3214
3215            // translateX for move
3216            $inner.css("transform", "translateX(" + -100 * params.depth + "%)");
3217
3218            // restore scroll position
3219            setTimeout(function () {
3220              $mobileMenu.animate({ scrollTop: params.scroll[params.depth] }, 200);
3221            }, 100);
3222
3223            // height on enimating end
3224            var h = !params.depth
3225              ? false
3226              : $mobileMenu
3227                  .find(".mobilemenu__menu-item--expanded>.mobilemenu__menu-dropdown")
3228                  .eq(params.depth - 1)
3229                  .height();
3230            setTimeout(function () {
3231              if (h) {
3232                $scroller.css("height", h + "px");
3233              } else {
3234                $scroller.css("height", "");
3235              }
3236            }, 200);
3237          }
3238        }
3239
3240        $inner.data("params", params);
3241      }
3242    }
3243  }
3244  //  --- END Bind mobile menu  ---
3245
3246  //  --- Bind mobile phone ---
3247  if ($("#mobilephones").length) {
3248    $(document).on("click", ".mobileheader .phones__inner .icon-block__only-icon", function (e) {
3249      e.stopPropagation();
3250      SwipeMobilePhone();
3251    });
3252
3253    $(document).on("click", ".mobilephones__menu-item a,.mobilephones__close", function (e) {
3254      e.stopPropagation();
3255      CloseMobilePhone();
3256    });
3257  }
3258
3259  SwipeMobilePhone = function () {
3260    if ($("#mobilephones.show").length) {
3261      CloseMobilePhone();
3262    } else {
3263      OpenMobilePhone();
3264    }
3265  };
3266
3267  OpenMobilePhone = function () {
3268    if (!$("#mobilephones.show").length) {
3269      CloseMobileMenu();
3270
3271      // show overlay
3272      $('<div class="jqmOverlay mobp"></div>').appendTo("body");
3273
3274      // blur body
3275      $("#mobileheader").addClass("filter-none");
3276      $("body").addClass("jqm-initied");
3277
3278      // toggle phones
3279      setTimeout(function () {
3280        $("#mobilephones").slideDown("fast", function () {
3281          $("#mobilephones").addClass("show");
3282        });
3283      }, 100);
3284    }
3285  };
3286
3287  CloseMobilePhone = function () {
3288    if ($("#mobilephones.show").length) {
3289      // toggle phones
3290      setTimeout(function () {
3291        $("#mobilephones").slideUp("fast", function () {
3292          $("#mobilephones").removeClass("show");
3293
3294          // unblur body
3295          $("body").removeClass("jqm-initied");
3296          $("#mobileheader").removeClass("filter-none");
3297
3298          // hide overlay
3299          $(".jqmOverlay.mobp").remove();
3300        });
3301      }, 100);
3302    }
3303  };
3304
3305  checkMobilePhone = function () {
3306    if (!window.matchMedia("(max-width: 991px)").matches) {
3307      CloseMobilePhone();
3308    }
3309  };
3310  //  --- END Bind mobile phone ---
3311
3312  // change type2 menu for fixed
3313  if ($("#headerfixed .js-nav").length) {
3314    if (arAsproOptions["THEME"]["HEADER_FIXED"] == 2) CheckHeaderFixedMenu();
3315
3316    setTimeout(function () {
3317      $("#headerfixed .js-nav").addClass("opacity1");
3318    }, 350);
3319  }
3320
3321  // close search block
3322  $("html, body").on("mousedown", function (e) {
3323    if (typeof e.target.className == "string" && e.target.className.indexOf("adm") < 0) {
3324      e.stopPropagation();
3325      var search_target = $(e.target).closest(".searche-result");
3326      if (
3327        !$(e.target).closest("#mobileheader").length &&
3328        !$(e.target).closest("#mobilefilter").length &&
3329        !$(e.target).closest(".popup").length &&
3330        !$(e.target).hasClass("inline-search-block") &&
3331        !$(e.target).hasClass("svg") &&
3332        !search_target.length
3333      ) {
3334        $(".inline-search-block").removeClass("show");
3335        $(".title-search-result").hide();
3336
3337        if (arAsproOptions["THEME"]["TYPE_SEARCH"] == "fixed") {
3338          $(".jqmOverlay.search").detach();
3339          $("body").removeClass("jqm-initied");
3340        }
3341
3342        $("body").removeClass("overflow-block");
3343      }
3344
3345      if (isMobile) {
3346        if (search_target.length) location.href = search_target.attr("href");
3347      }
3348
3349      if (!$(e.target).closest(".hint.active").length) {
3350        $(".hint.active .hint__icon").trigger("click");
3351      }
3352
3353      var class_name = $(e.target).attr("class");
3354      if (typeof class_name == "undefined" || class_name.indexOf("tooltip") < 0)
3355        //tooltip link
3356        $(".tooltip-link").tooltip("hide");
3357    }
3358  });
3359  $(".inline-search-block")
3360    .find("*")
3361    .on("mousedown", function (e) {
3362      e.stopPropagation();
3363    });
3364
3365  $(".filter-action").on("click", function () {
3366    $(this).toggleClass("active");
3367    $(this).find(".svg").toggleClass("white");
3368    if ($(".introtext").length) {
3369      var top_pos = $(".filters-wrap").position();
3370      $(".bx_filter").css({ top: top_pos.top + 40 });
3371    }
3372    $(".bx_filter").slideToggle();
3373  });
3374
3375  // -- scroll after apply option
3376  scrollPreviewBlock();
3377
3378  $.extend($.validator.messages, {
3379    required: BX.message("JS_REQUIRED"),
3380    email: BX.message("JS_FORMAT"),
3381    equalTo: BX.message("JS_PASSWORD_COPY"),
3382    minlength: BX.message("JS_PASSWORD_LENGTH"),
3383    remote: BX.message("JS_ERROR"),
3384  });
3385
3386  $.validator.addMethod(
3387    "regexp",
3388    function (value, element, regexp) {
3389      var re = new RegExp(regexp);
3390      return this.optional(element) || re.test(value);
3391    },
3392    BX.message("JS_FORMAT")
3393  );
3394
3395  $.validator.addMethod(
3396    "filesize",
3397    function (value, element, param) {
3398      return this.optional(element) || element.files[0].size <= param;
3399    },
3400    BX.message("JS_FILE_SIZE")
3401  );
3402
3403  $.validator.addMethod(
3404    "date",
3405    function (value, element, param) {
3406      var status = false;
3407      if (!value || value.length <= 0) {
3408        status = true;
3409      } else {
3410        var re = new RegExp("^([0-9]{2})(.)([0-9]{2})(.)([0-9]{4})$");
3411        var matches = re.exec(value);
3412        if (matches) {
3413          var composedDate = new Date(matches[5], matches[3] - 1, matches[1]);
3414          status =
3415            composedDate.getMonth() == matches[3] - 1 &&
3416            composedDate.getDate() == matches[1] &&
3417            composedDate.getFullYear() == matches[5];
3418        }
3419      }
3420      return status;
3421    },
3422    BX.message("JS_DATE")
3423  );
3424
3425  $.validator.addMethod(
3426    "datetime",
3427    function (value, element, param) {
3428      var status = false;
3429      if (!value || value.length <= 0) {
3430        status = true;
3431      } else {
3432        var re = new RegExp("^([0-9]{2})(.)([0-9]{2})(.)([0-9]{4}) ([0-9]{1,2}):([0-9]{1,2})$");
3433        var matches = re.exec(value);
3434        if (matches) {
3435          var composedDate = new Date(matches[5], matches[3] - 1, matches[1], matches[6], matches[7]);
3436          status =
3437            composedDate.getMonth() == matches[3] - 1 &&
3438            composedDate.getDate() == matches[1] &&
3439            composedDate.getFullYear() == matches[5] &&
3440            composedDate.getHours() == matches[6] &&
3441            composedDate.getMinutes() == matches[7];
3442        }
3443      }
3444      return status;
3445    },
3446    BX.message("JS_DATETIME")
3447  );
3448
3449  $.validator.addMethod(
3450    "extension",
3451    function (value, element, param) {
3452      param = typeof param === "string" ? param.replace(/,/g, "|") : "png|jpe?g|gif";
3453      return this.optional(element) || value.match(new RegExp(".(" + param + ")$", "i"));
3454    },
3455    BX.message("JS_FILE_EXT")
3456  );
3457
3458  $.validator.addMethod(
3459    "captcha",
3460    function (value, element, params) {
3461      let sid = $(element).closest("form").find('input[name="captcha_sid"]').val();
3462      return $.validator.methods.remote.call(this, value, element, {
3463        url: arAsproOptions["SITE_DIR"] + "ajax/check-captcha.php",
3464        type: "post",
3465        data: {
3466          captcha_word: value,
3467          captcha_sid: sid,
3468        },
3469      });
3470    },
3471    BX.message("JS_ERROR")
3472  );
3473
3474  $.validator.addMethod(
3475    "recaptcha",
3476    function (value, element, param) {
3477      var id = $(element).closest("form").find(".g-recaptcha").attr("data-widgetid");
3478      if (typeof id !== "undefined") {
3479        return grecaptcha.getResponse(id) != "";
3480      } else {
3481        return true;
3482      }
3483    },
3484    BX.message("JS_RECAPTCHA_ERROR")
3485  );
3486
3487  // reload captcha
3488  $(document).on("click", ".refresh", function (e) {
3489    var captcha = $(this).parents(".captcha-row");
3490    e.preventDefault();
3491    $.ajax({
3492      url: arAsproOptions["SITE_DIR"] + "ajax/captcha.php",
3493    }).done(function (text) {
3494      captcha.find("input[name=captcha_sid],input[name=captcha_code]").val(text);
3495      captcha.find("img").attr("src", "/bitrix/tools/captcha.php?captcha_sid=" + text);
3496      captcha.find("input[name=captcha_word]").val("").removeClass("error");
3497      captcha.find(".captcha_input").removeClass("error").find(".error").remove();
3498    });
3499  });
3500
3501  $.validator.addClassRules({
3502    phone: {
3503      regexp: arAsproOptions["THEME"]["VALIDATE_PHONE_MASK"],
3504    },
3505    confirm_password: {
3506      equalTo: "input.password",
3507      minlength: 6,
3508    },
3509    password: {
3510      minlength: 6,
3511    },
3512    inputfile: {
3513      extension: arAsproOptions["THEME"]["VALIDATE_FILE_EXT"],
3514      filesize: 5000000,
3515    },
3516    datetime: {
3517      datetime: "",
3518    },
3519    captcha: {
3520      captcha: "",
3521    },
3522    recaptcha: {
3523      recaptcha: "",
3524    },
3525  });
3526
3527  $.validator.setDefaults({
3528    highlight: function (element) {
3529      $(element).parent().addClass("error");
3530    },
3531    unhighlight: function (element) {
3532      $(element).parent().removeClass("error");
3533    },
3534  });
3535
3536  // expand/hide filter values
3537  $(document).on("click", ".expand_block", function () {
3538    togglePropBlock($(this));
3539  });
3540
3541  // popup img list
3542  $(document).on("click", ".fancy-js", function () {
3543    const parent = $(this).closest(".image-list");
3544    let arItems = [];
3545    let index = 0;
3546    parent.find("[data-big]").each(function () {
3547      let _this = $(this);
3548      let obItem = {
3549        src: _this.data("big"),
3550        opts: {
3551          caption: _this.attr("alt"),
3552        },
3553      };
3554      arItems.push(obItem);
3555    });
3556    index = parent.find(".active").index();
3557    if (arItems.length) {
3558      if (typeof $.fn.fancybox === "function") {
3559        $.fancybox.open(arItems, { loop: false }, index);
3560      }
3561    }
3562  });
3563
3564  $(".mobilemenu__menu-item--city a").on("click", function (e) {
3565    e.preventDefault();
3566    var _this = $(this);
3567    $.removeCookie("current_region");
3568
3569    if (arAsproOptions["SITE_ADDRESS"].indexOf(",") != "-1") {
3570      var arDomains = arAsproOptions["SITE_ADDRESS"].split(",");
3571      if (arDomains) {
3572        for (var i in arDomains) {
3573          var domain_name = arDomains[i].replace("\n", "");
3574          domain_name = arDomains[i].replace("'", "");
3575          $.cookie("current_region", _this.data("id"), { path: "/", domain: domain_name });
3576        }
3577      }
3578    }
3578 else $.cookie("current_region", _this.data("id"), { path: "/", domain: arAsproOptions["SITE_ADDRESS"] });
3579
3580    location.href = _this.attr("href");
3581  });
3582
3583  InitOwlSlider();
3584  InitFlexSlider();
3585  InitFlexSliderMin();
3586
3587  InitFancyBox();
3588  InitFancyBoxVideo();
3589
3590  // for check flexslider bug in composite mode
3591  waitingNotExists(".detail .galery #slider", ".detail .galery #slider .flex-viewport", 1000, function () {
3592    InitOwlSlider();
3593    InitFlexSlider();
3594    setTimeout(function () {
3595      $(window).resize();
3596    }, 350);
3597  });
3598
3599  // change view type catalog
3600  $(".view-button").on("click", function () {
3601    $(this).siblings().removeClass("cur");
3602    $(this).addClass("cur");
3603  });
3604
3605  // -- escape close popup form
3606  $(document).on("keydown", function (e) {
3607    if (e.keyCode == 27) {
3608      if ($(".jqmWindow.show").length) $(".jqmWindow.show .jqmClose").click();
3609      if ($(".inline-search-block.fixed.show").length) {
3610        $(".inline-search-block.fixed .inline-search-hide").click();
3611        setTimeout(function () {
3612          $(".title-search-result").hide();
3613        }, 0);
3614      }
3615      if ($(".mega-fixed-menu").is(":visible")) {
3616        $(".mega-fixed-menu .mega-fixed-menu__close").click();
3617      }
3618    }
3619  });
3620
3621  $(document).on("click", '*[data-event="jqm"]', function (e) {
3622    e.preventDefault();
3623    e.stopPropagation();
3624    if (!$(this).hasClass("clicked")) {
3625      $(this).addClass("clicked");
3626      $(this).jqmEx();
3627      $(this).trigger("click");
3628    }
3629  });
3630
3631  $(".animate-load").on("click", function () {
3632    $(this).parent().addClass("loadings");
3633  });
3634
3635  BX.addCustomEvent("onCompleteAction", function (eventdata, _this) {
3636    try {
3637      if (eventdata.action === "loadForm") {
3638        $(_this).parent().removeClass("loadings");
3639        $(_this).removeClass("clicked");
3640      } else if (eventdata.action === "loadBasket") {
3641        var basket_js_block = $(".js-basket-block");
3642        if (basket_js_block.length) {
3643          var count = basket_js_block.find(".header-cart__count").length
3644            ? parseInt($(_this).find(".count").text())
3645            : parseInt($(_this).find(".header-cart__count").text());
3646          if (count) {
3647            basket_js_block.removeClass("header-cart__inner--empty");
3648          } else {
3649            basket_js_block.addClass("header-cart__inner--empty");
3650          }
3651        }
3652
3653        setBasketItemsClasses();
3654      } else if (eventdata.action === "loadRSS") {
3655      } else if (eventdata.action === "jsLoadBlock") {
3656        InitScrollBar();
3657      } else if (eventdata.action === "ajaxContentLoaded") {
3658        if ("type" in eventdata) {
3659          if (eventdata.type == "table_block") {
3660            $(".catalog.item-views.table .item .title").sliceHeight();
3661            $(".catalog.item-views.table .item .cont").sliceHeight();
3662            // $('.catalog.item-views.table .item .slice_price').sliceHeight();
3663            $(".catalog.item-views.table .item").sliceHeight({ classNull: ".footer-button" });
3664          } else if (eventdata.type == "table_block2") {
3665            $(".catalog.item-views.table .item .title").sliceHeight();
3666            $(".catalog.item-views.table .item .cont").sliceHeight({
3667              autoHeightBlock: ".cont_inner",
3668              classNull: ".props_wrapper",
3669            });
3670            // $('.catalog.item-views.table .item .slice_price').sliceHeight();
3671            $(".catalog.item-views.table .item").sliceHeight({
3672              classNull: ".footer-button",
3673              autoHeightBlock: ".cont_inner",
3674              callback: setHoverHeight,
3675            });
3676          }
3677        }
3678      }
3679    } catch (e) {
3680      console.error(e);
3681    }
3682  });
3683
3684  BX.addCustomEvent("onCounterGoals", function (eventdata) {
3685    if (arAsproOptions["THEME"]["YA_GOALS"] == "Y" && arAsproOptions["THEME"]["YA_COUNTER_ID"]) {
3686      var idCounter = arAsproOptions["THEME"]["YA_COUNTER_ID"];
3687      idCounter = parseInt(idCounter);
3688
3689      if (typeof eventdata != "object") eventdata = { goal: "undefined" };
3690
3691      if (typeof eventdata.goal != "string") eventdata.goal = "undefined";
3692
3693      if (idCounter) {
3694        try {
3695          waitCounter(idCounter, 50, function () {
3696            var obCounter = window["yaCounter" + idCounter];
3697            if (typeof obCounter == "object") {
3698              obCounter.reachGoal(eventdata.goal);
3699            }
3700          });
3701        } catch (e) {
3702          console.error(e);
3703        }
3704      } else {
3705        console.info("Bad counter id!", idCounter);
3706      }
3707    }
3708  });
3709
3710  BX.addCustomEvent(window, "onAjaxSuccess", function (e) {
3711    if (e != "OK") {
3712      InitOwlSlider();
3713      InitFlexSlider();
3714      InitFlexSliderMin();
3715    }
3716  });
3717
3718  // show print
3719  if (arAsproOptions["THEME"]["PRINT_BUTTON"] == "Y") {
3720    setTimeout(function () {
3721      if ($(".page-top .rss-block.top").length) {
3722        $('<div class="print-link"><i class="svg svg-print"></i></div>').insertBefore(
3723          $(".page-top .rss-block.top .shares-block")
3724        );
3725      } else if ($(".page-top .rss").length) {
3726        $('<div class="print-link"><i class="svg svg-print"></i></div>').insertAfter($(".page-top .rss"));
3727      } else if ($(".page-top h1").length)
3728        $('<div class="print-link"><i class="svg svg-print"></i></div>').insertBefore($(".page-top h1"));
3729      // else
3730      // $('footer .print-block').html('<div class="print-link"><i class="svg svg-print"><svg id="Print.svg" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewB
3730ox="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>');
3731    }, 150);
3732  }
3733
3734  $(document).on("click", ".print-link", function () {
3735    window.print();
3736  });
3737
3738  $(".head-block .item-link").on("click", function () {
3739    var _this = $(this);
3740    _this.siblings().removeClass("active");
3741    _this.addClass("active");
3742  });
3743
3744  //alert(navigator.userAgent);
3745  $("table.table").each(function () {
3746    var _this = $(this),
3747      first_td = _this.find("thead tr th");
3748    if (!first_td.length) first_td = _this.find("thead tr td");
3749    if (first_td.length) {
3750      _this.find("tbody tr:not(.nomobile)").each(function (i) {
3751        $(this)
3752          .find("td")
3753          .each(function (i) {
3754            if (typeof first_td[i] !== "undefined")
3755              $('<div class="th-mobile">' + first_td[i].textContent + "</div>").appendTo($(this));
3756          });
3757      });
3758    }
3759  });
3760
3761  if ($("a.fancybox").length) {
3762    if (typeof $.fn.fancybox == "function") {
3763      $("a.fancybox").fancybox();
3764    }
3765  }
3766
3767  // flex pagination
3768  $(document).on("mouseenter", ".flex-viewport .item", function () {
3769    $(this).closest(".flexslider").find(".flex-control-nav").toggleClass("noz");
3770    $(this).closest(".flexslider").find(".flex-control-nav").css("z-index", "0");
3771  });
3772  $(document).on("mouseleave", ".flex-viewport .item", function () {
3773    $(this).closest(".flexslider").find(".flex-control-nav").toggleClass("noz");
3774    $(this).closest(".flexslider").find(".flex-control-nav").css("z-index", "2");
3775  });
3776
3777  // ajax more items
3778  $(document).on("click", ".ajax_load_btn", function () {
3779    var url = $(this).closest(".bottom_nav").find(".arrows-pagination__next").attr("href"),
3780      th = $(this).find(".more_text_ajax"),
3781      _this = $(this),
3782      bottom_nav = $(this).closest(".bottom_nav");
3783    if (!th.hasClass("loading")) {
3784      th.addClass("loading");
3785      var objUrl = parseUrlQuery(),
3786        add_url = "",
3787        obData = { AJAX_REQUEST: "Y", ajax_get: "Y", bitrix_include_areas: "N" };
3788
3789      //index page
3790      if ($(".body.index").length) {
3791        var class_block = th.closest(".drag-block").data("class").replace("_drag", "");
3792        class_block = class_block.replace(/\s/g, "");
3793        obData.BLOCK = class_block;
3794      }
3795      if (_this.closest(".ajax-pagination-wrapper").length) {
3796        obData.BLOCK = _this.closest(".ajax-pagination-wrapper").data("class");
3797      }
3798      if ("clear_cache" in objUrl && objUrl.clear_cache == "Y") {
3799        add_url = "&clear_cache=Y";
3800      }
3801      if ($(".banners-small.front").length) {
3802        obData.MD = $(".banners-small.front").find(".items").data("colmd");
3803        obData.SM = $(".banners-small.front").find(".items").data("colsm");
3804      }
3805
3806      //tabs block
3807      if (_this.closest(".tab-content-block").length) {
3808        var filter = th.closest(".tab-content-block").data("filter");
3809        obData.GLOBAL_FILTER = filter;
3810      }
3811      $.ajax({
3812        url: url + "" + add_url,
3813        data: BX.ajax.prepareData(obData),
3814        success: function (html) {
3815          var html = html.trim();
3816          var mobileBottomClicked = bottom_nav.hasClass("mobile_slider");
3817          var hasMobileBottomNav = $(html).find(".bottom_nav.mobile_slider");
3818          var bottomNav = hasMobileBottomNav.length ? hasMobileBottomNav : $(html).find(".bottom_nav");
3819          var bottomNavHtml = bottomNav.html();
3820          var bottomNavScrollClass = bottomNav.data("scroll-class");
3821          var hasBottomNav = $(html).find(".ajax_load_btn").length;
3822
3823          var eventdata = { action: "ajaxContentLoaded", content: html };
3824
3825          if ($(".banners-small.front").length) {
3826            $(".banners-small .items.row").append(html);
3827            $(".bottom_nav").html($(".banners-small .items.row .bottom_nav").html());
3828            $(".banners-small .items.row .bottom_nav").remove();
3829          } else if (bottom_nav.data("append") !== undefined && bottom_nav.data("parent") !== undefined) {
3830            var $slider = th.closest(bottom_nav.data("parent")).find(".owl-carousel");
3831            if ($slider.length) {
3832              var obData = BX.processHTML(html);
3833              html = obData.HTML;
3834
3835              var $slides = $("<div>" + html + "</div>").find(">*");
3836              $slides.each(function () {
3837                if (!$(this).hasClass("wrap_nav")) {
3838                  $slider.trigger("add.owl.carousel", [$(this).wrap("<div></div>").parent().html()]);
3839                }
3840              });
3841              $slider.trigger("refresh.owl.carousel");
3842
3843              setTimeout(function () {
3844                BX.ajax.processScripts(obData.SCRIPT);
3845              }, 100);
3846            } else {
3847              var target = html;
3848              if (bottom_nav.data("target") !== undefined) {
3849                target = $(html).find(bottom_nav.data("target"));
3850              }
3851              if (mobileBottomClicked || hasMobileBottomNav.length) {
3852                var mobileSliderNav = th.closest(bottom_nav.data("parent")).find(".bottom_nav.mobile_slider");
3853                if (mobileSliderNav.length) {
3854                  mobileSliderNav.before(target);
3855                } else {
3856                  bottom_nav.before(target);
3857                }
3858              } else {
3859                th.closest(bottom_nav.data("parent")).find(bottom_nav.data("append")).append(target);
3860              }
3861              th.closest(bottom_nav.data("parent"))
3862                .find(bottom_nav.data("append"))
3863                .find(".bottom_nav_wrapper")
3864                .remove();
3865
3866              if (hasBottomNav) {
3867                if (bottomNavScrollClass !== undefined) {
3868                  th.closest(bottom_nav.data("parent")).find(bottomNavScrollClass).addClass("has-bottom-nav");
3869                }
3870                th.closest(bottom_nav.data("parent")).find(bottom_nav.data("append")).addClass("has-bottom-nav");
3871              } else {
3872                if (bottomNavScrollClass !== undefined) {
3873                  th.closest(bottom_nav.data("parent")).find(bottomNavScrollClass).removeClass("has-bottom-nav");
3874                }
3875                th.closest(bottom_nav.data("parent")).find(bottom_nav.data("append")).removeClass("has-bottom-nav");
3876              }
3877            }
3878
3879            bottom_nav = th.closest(bottom_nav.data("parent")).find(".bottom_nav");
3880            bottom_nav.html(bottomNavHtml);
3881            var icon = bottom_nav.find(".svg-inline-bottom_nav-icon");
3882            icon.css("display", "");
3883
3884            eventdata.container = th.closest(bottom_nav.data("parent"));
3885          } else {
3886            $(html).insertBefore($(".blog .bottom_nav"));
3887            $(".bottom_nav").html($(".blog .bottom_nav:hidden").html());
3888            $(".blog .bottom_nav:hidden").remove();
3889          }
3890
3891          setTimeout(function () {
3892            BX.onCustomEvent("onCompleteAction", [eventdata, th[0]]);
3893            $(".banners-small .item.normal-block").sliceHeight();
3894            th.removeClass("loading");
3895          }, 100);
3896        },
3897      });
3898    }
3899  });
3900
3901  // bug fix in ff
3902  $("img").removeAttr("draggable");
3903
3904  // Responsive Menu Events
3905  var addActiveClass = false;
3906  $("#mainMenu li.dropdown > a > i, #mainMenu li.dropdown-submenu > a > i").on("click", function (e) {
3907    e.preventDefault();
3908    if ($(window).width() > 979) return;
3909    addActiveClass = $(this).closest("li").hasClass("resp-active");
3910    // $('#mainMenu').find('.resp-active').removeClass('resp-active');
3911    if (!addActiveClass) {
3912      $(this).closest("li").addClass("resp-active");
3913    } else {
3914      $(this).closest("li").removeClass("resp-active");
3915    }
3916  });
3917
3918  // animate increment
3919  if ($(".spincrement").length) {
3920    $(".spincrement").counterUp({
3921      delay: 80,
3922      time: 1000,
3923    });
3924  }
3925
3926  // form rating
3927  $(document).on("mouseenter", ".form .votes_block.with-text .item-rating", function () {
3928    var $this = $(this),
3929      index = $this.index(),
3930      ratingMessage = $this.data("message");
3931
3932    $(this).addClass("filed");
3933    $this.siblings().each(function () {
3934      if ($(this).index() <= index) $(this).addClass("filed");
3935      else $(this).removeClass("filed");
3936    });
3937    $this.closest(".votes_block").find(".rating_message").text(ratingMessage);
3938  });
3939
3940  $(document).on("mouseleave", ".form .votes_block.with-text", function () {
3941    var $this = $(this),
3942      index = $this.data("rating"),
3943      ratingMessage = $this.closest(".votes_block").find(".rating_message").data("message");
3944
3945    $this.find(".item-rating").each(function () {
3946      if ($(this).index() < index && index !== undefined) $(this).addClass("filed");
3947      else $(this).removeClass("filed");
3948    });
3949    $this.closest(".votes_block").find(".rating_message").text(ratingMessage);
3950  });
3951
3952  $(document).on("click", ".form .votes_block.with-text .item-rating", function () {
3953    var $this = $(this),
3954      rating = $this.closest(".votes_block").data("rating"),
3955      index = $this.index() + 1,
3956      ratingMessage = $this.data("message");
3957
3958    $this.closest(".votes_block").data("rating", index);
3959    if ($this.closest(".form-group").find("input[name=RATING]").length) {
3960      $this.closest(".form-group").find("input[name=RATING]").val(index);
3961    } else {
3962      $this.closest(".form-group").find("input[data-sid=RATING]").val(index);
3963    }
3964    $this.closest(".votes_block").find(".rating_message").data("message", ratingMessage);
3965  });
3966
3967  $(".bx_filter_input_container input[type=text]").numeric({ allow: "." });
3968
3969  $(".toggle .more_items").on("click", function () {
3970    $(this).closest(".toggle").find(".collapsed").fadeToggle();
3971    $(this).remove();
3972    if (typeof $(this).data("resize") !== "undefined" && $(this).data("resize")) $(window).resize();
3973  });
3974  $(".toggle_menu .more_items").on("click", function () {
3975    $(this).closest(".toggle_menu").find(".collapsed").addClass("clicked_exp");
3976    $(this).remove();
3977  });
3978
3979  // search sync
3980  $(document).on("keyup", ".search-input-div input", function (e) {
3981    var inputValue = $(this).val();
3982    $(".search-input-div input").val(inputValue);
3983
3984    if ($(this).closest("#headerfixed").length) {
3985      if (e.keyCode == 13) $(".search form").submit();
3986    }
3987  });
3988  $(document).on("click", ".search-button-div button", function (e) {
3989    if ($(this).closest("#headerfixed").length) $(".search form").submit();
3990  });
3991
3992  $(document).on(
3993    "click",
3994    ".header-search, .inline-search-hide, .bottom-icons-panel__content-link--search",
3995    function (e) {
3996      //if (window.matchMedia("(min-width: 600px)").matches) {
3997      CloseMobilePhone();
3998
3999      if (typeof $(this).data("type_search") != "undefined" && $(this).data("type_search") == "fixed") {
4000        $(".inline-search-block").addClass("fixed");
4001      }
4002
4003      $(".inline-search-block").toggleClass("show");
4004
4005      if (arAsproOptions["THEME"]["TYPE_SEARCH"] == "fixed") {
4006        if ($(".inline-search-block").hasClass("show")) {
4007          $('<div class="jqmOverlay search"></div>').appendTo("body");
4008          $("body").addClass("overflow-block");
4009          $("body").addClass("jqm-initied");
4010        } else {
4011          $("body").removeClass("jqm-initied");
4012          $("body").removeClass("overflow-block");
4013          $(".jqmOverlay").remove();
4014        }
4015      }
4016
4017      if ($(".inline-search-block").hasClass("show")) {
4018        setTimeout(function () {
4019          $(".inline-search-block.fixed .search-input").focus();
4020        }, 400);
4021      }
4022      // } else {
4023      //   location.href = arAsproOptions["SITE_DIR"] + "search/";
4024      // }
4025    }
4026  );
4027
4028  if ($(".styled-block .row > div.col-md-3").length) {
4029    BX.addCustomEvent("onWindowResize", function (eventdata) {
4030      try {
4031        ignoreResize.push(true);
4032        $(".styled-block .row > div.col-md-3").each(function () {
4033          $(this).css({ height: "", "line-height": "" });
4034          var z = parseInt($(".body_media").css("top"));
4035          if (z > 0) {
4036            var rowHeight = $(this).parents(".row").first().actual("outerHeight");
4037            $(this).css({ height: rowHeight + "px", "line-height": rowHeight + "px" });
4038          }
4039        });
4040      } catch (e) {
4041      } finally {
4042        ignoreResize.pop();
4043      }
4044    });
4045  }
4046
4047  if ($(".order-block").length) {
4048    BX.addCustomEvent("onWindowResize", function (eventdata) {
4049      try {
4050        ignoreResize.push(true);
4051        $(".order-block").each(function () {
4052          var cols = $(this).find(".row > div");
4053          if (cols.length) {
4054            var colFirst = cols.first();
4055            var colLast = cols.last();
4056            var colText = colFirst.find(".text");
4057            var bText = colText.length;
4058            var bOnlyText = cols.length === 1 && bText;
4059            var bPrice = colFirst.find(".price").length;
4060            var z = parseInt($(".body_media").css("top"));
4061
4062            cols.css({ height: "", "padding-top": "", "padding-bottom": "" });
4063            colText.css({ height: "", "padding-top": "", "padding-bottom": "" });
4064            if ((!bPrice && z > 0) || (bPrice && z > 1)) {
4065              var minHeight = 83;
4066
4067              if (!bOnlyText) {
4068                var colLast_height = colLast.outerHeight();
4069                colLast_height = colLast_height >= minHeight ? colLast_height : minHeight;
4070              }
4071
4072              if (bText) {
4073                var colFirst_height = colFirst.outerHeight();
4074                colFirst_height = colFirst_height >= minHeight ? colFirst_height : minHeight;
4075              }
4076
4077              var colMax_height = bText
4078                ? !bOnlyText
4079                  ? colLast_height >= colFirst_height
4080                    ? colLast_height
4081                    : colFirst_height
4082                  : colLast_height
4083                : colFirst_height;
4084
4085              if (!bOnlyText) {
4086                var textPadding = 41 + (colMax_height - colFirst.outerHeight()) / 2;
4087                colLast.find(".btns").css({
4088                  "padding-top": textPadding + "px",
4089                  "padding-bottom": textPadding + "px",
4090                  height: colMax_height + "px",
4091                });
4092              }
4093              if (bText) {
4094                colLast.css({ height: colMax_height + "px" });
4095                var textPadding = 41 + (colMax_height - colText.outerHeight()) / 2;
4096                colText.css({
4097                  "padding-top": textPadding + "px",
4098                  "padding-bottom": textPadding + "px",
4099                  height: colMax_height + "px",
4100                });
4101              }
4102            }
4103          }
4104        });
4105      } catch (e) {
4106      } finally {
4107        ignoreResize.pop();
4108      }
4109    });
4110  }
4111
4112  if ($(".equal-padding").length) {
4113    BX.addCustomEvent("onWindowResize", function (eventdata) {
4114      try {
4115        ignoreResize.push(true);
4116        $(".equal-padding").each(function () {
4117          $(this).find(".text").css({ "padding-top": "0px", "padding-bottom": "0px" });
4118          var equal_block = $(this).siblings(".equals"),
4119            height = $(this).actual("outerHeight");
4120
4121          delta = Math.round((equal_block.actual("outerHeight") - height) / 2);
4122          if (delta)
4123            $(this)
4124              .find(".text")
4125              .css({ "padding-top": delta + "px", "padding-bottom": delta + "px" });
4126        });
4127      } catch (e) {
4128      } finally {
4129        ignoreResize.pop();
4130      }
4131    });
4132  }
4133
4134  $(document).on("click", ".mega-menu .dropdown-menu", function (e) {
4135    e.stopPropagation();
4136  });
4137
4138  $(document).on("click", ".mega-menu .dropdown-toggle.more-items", function (e) {
4139    e.preventDefault();
4140  });
4141
4142  // $(".table-menu .dropdown,.table-menu .dropdown-submenu,.table-menu .dropdown-toggle").on("mouseenter", function () {
4143  //   CheckTopVisibleMenu();
4144  // });
4145
4146  $(document).on(
4147    "mouseenter",
4148    ".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",
4149    function (e) {
4150      CheckTopVisibleMenu($(e.currentTarget));
4151    }
4152  );
4153
4154  $(document).on(
4155    "mouseenter",
4156    ".header-menu__item--wide, .header-menu__item--wide .header-menu__dropdown-menu",
4157    function () {
4158      var bannerMenu = $(this).find(".side_banners .owl-carousel-hover");
4159      if (bannerMenu.length) {
4160        bannerMenu.removeClass("owl-carousel-hover").addClass("owl-carousel");
4161        setTimeout(function () {
4162          InitOwlSlider();
4163          bannerMenu.removeClass("loading-state");
4164        }, 1);
4165      }
4166    }
4167  );
4168
4169  $(document).on("mouseenter", ".menu-side-column__item--wide", function () {
4170    var bannerMenu = $(".bottom-banners .owl-carousel-hover");
4171    if (bannerMenu.length) {
4172      bannerMenu.removeClass("owl-carousel-hover").addClass("owl-carousel");
4173      setTimeout(function () {
4174        InitOwlSlider();
4175        bannerMenu.removeClass("loading-state");
4176      }, 1);
4177    }
4178  });
4179
4180  $(".mega-menu .search-item .search-icon, .menu-row #title-search .fa-close").on("click", function (e) {
4181    e.preventDefault();
4182    $(".menu-row #title-search").toggleClass("hide");
4183  });
4184
4185  $(".mega-menu ul.nav .search input").on("keyup", function (e) {
4186    var inputValue = $(this).val();
4187    $(".menu-row > .search input").val(inputValue);
4188    if (e.keyCode == 13) {
4189      $(".menu-row > .search form").submit();
4190    }
4191  });
4192
4193  $(".menu-row > .search input").on("keyup", function (e) {
4194    var inputValue = $(this).val();
4195    $(".mega-menu ul.nav .search input").val(inputValue);
4196    if (e.keyCode == 13) {
4197      $(".menu-row > .search form").submit();
4198    }
4199  });
4200
4201  $(".mega-menu ul.nav .search button").on("click", function (e) {
4202    e.preventDefault();
4203    var inputValue = $(this).parents(".search").find("input").val();
4204    $(".menu-and-search .search input").val(inputValue);
4205    $(".menu-row > .search form").submit();
4206  });
4207
4208  $(".filter .calendar").on("click", function () {
4209    var button = $(this).next();
4210    if (button.hasClass("calendar-icon")) {
4211      button.trigger("click");
4212    }
4213  });
4214
4215  // sliceheights
4216  if ($(".banners-small .item.normal-block").length) $(".banners-small .item.normal-block").sliceHeight();
4217  if ($(".teasers .item").length) $(".teasers .item").sliceHeight();
4218  if ($(".wrap-portfolio-front .row.items > div").length)
4219    $(".wrap-portfolio-front .row.items > div").sliceHeight({ row: ".row.items", item: ".item1" });
4220
4221  SliceHeightBlocks();
4222
4223  // toggle
4224  var $this = this,
4225    previewParClosedHeight = 25;
4226
4227  $("section.toggle > label").prepend($("<i />").addClass("fa fa-plus"));
4228  $("section.toggle > label").prepend($("<i />").addClass("fa fa-minus"));
4229  $("section.toggle.active > p").addClass("preview-active");
4230  $("section.toggle.active > div.toggle-content").slideDown(350, function () {});
4231
4232  $("section.toggle > label").click(function (e) {
4233    var parentSection = $(this).parent(),
4234      parentWrapper = $(this).parents("div.toogle"),
4235      previewPar = false,
4236      isAccordion = parentWrapper.hasClass("toogle-accordion");
4237
4238    if (isAccordion && typeof e.originalEvent != "undefined") {
4239      parentWrapper.find("section.toggle.active > label").trigger("click");
4240    }
4241
4242    parentSection.toggleClass("active");
4243
4244    // Preview Paragraph
4245    if (parentSection.find("> p").get(0)) {
4246      previewPar = parentSection.find("> p");
4247      var previewParCurrentHeight = previewPar.css("height");
4248      previewPar.css("height", "auto");
4249      var previewParAnimateHeight = previewPar.css("height");
4250      previewPar.css("height", previewParCurrentHeight);
4251    }
4252
4253    // Content
4254    var toggleContent = parentSection.find("> div.toggle-content");
4255
4256    if (parentSection.hasClass("active")) {
4257      $(previewPar).animate(
4258        {
4259          height: previewParAnimateHeight,
4260        },
4261        350,
4262        function () {
4263          $(this).addClass("preview-active");
4264        }
4265      );
4266      toggleContent.slideDown(350, function () {});
4267    } else {
4268      $(previewPar).animate(
4269        {
4270          height: previewParClosedHeight,
4271        },
4272        350,
4273        function () {
4274          $(this).removeClass("preview-active");
4275        }
4276      );
4277      toggleContent.slideUp(350, function () {});
4278    }
4279  });
4280
4281  // accordion
4282  $(".accordion-head").on("click", function (e) {
4283    e.preventDefault();
4284    if (!$(this).next().hasClass("collapsing")) {
4285      $(this).toggleClass("accordion-open");
4286      $(this).toggleClass("accordion-close");
4287    }
4288  });
4289
4290  // progress bar
4291  $("[data-appear-progress-animation]").iAppear(
4292    function () {
4293      var $this = $(this);
4294
4295      var delay = $this.attr("data-appear-animation-delay") ? $this.attr("data-appear-animation-delay") : 1;
4296      if (delay > 1) $this.css("animation-delay", delay + "ms");
4297      $this.addClass($this.attr("data-appear-animation"));
4298
4299      setTimeout(function () {
4300        $this.animate(
4301          {
4302            width: $this.attr("data-appear-progress-animation"),
4303          },
4304          1500,
4305          "easeOutQuad",
4306          function () {
4307            $this.find(".progress-bar-tooltip").animate(
4308              {
4309                opacity: 1,
4310              },
4311              500,
4312              "easeOutQuad"
4313            );
4314          }
4315        );
4316      }, delay);
4317    },
4318    {
4319      rootMargin: "-50px 0px -50px 0px",
4320      accX: 0,
4321      accY: -50,
4322    }
4323  );
4324
4325  // portfolio item
4326  $(".item.animated-block").iAppear(function () {
4327    $(this).addClass($(this).data("animation")).addClass("visible");
4328  });
4329
4330  // flexslider appear
4331  $(".appear-block").iAppear(function () {
4332    $(this).removeClass("appear-block");
4333    CheckFlexSlider();
4334    InitFlexSlider();
4335    InitOwlSlider();
4336  });
4337
4338  // js-load-block appear
4339  if ($(".js-load-block").length) {
4340    var objUrl = parseUrlQuery();
4341    var bClearCache = false;
4342    if ("clear_cache" in objUrl) {
4343      if (objUrl.clear_cache == "Y") {
4344        bClearCache = true;
4345      }
4346    }
4347
4348    var items = [];
4349    var bIdle = true;
4350    var insertNextBlockContent = function () {
4351      if (bIdle) {
4352        if (items.length) {
4353          bIdle = false;
4354          var item = items.pop();
4355
4356          item.content = $.trim(item.content);
4357
4358          // remove /bitrix/js/main/core/core_window.js if it was loaded already
4359          if (item.content.indexOf("/bitrix/js/main/core/core_window.") !== -1 && BX.WindowManager) {
4360            item.content = item.content.replace(
4361              /<script src="\/bitrix\/js\/main\/core\/core_window\.[^>]*><\/script>/gm,
4362              ""
4363            );
4364          }
4365
4366          // remove /bitrix/js/currency/core_currency.js if it was loaded already
4367          if (
4368            item.content.indexOf("/bitrix/js/currency/core_currency.") !== -1 &&
4369            typeof BX.Currency === "object" &&
4370            BX.Currency.defaultFormat
4371          ) {
4372            item.content = item.content.replace(
4373              /<script src="\/bitrix\/js\/currency\/core_currency\.[^>]*><\/script>/gm,
4374              ""
4375            );
4376          }
4377
4378          // remove /bitrix/js/main/pageobject/pageobject.js if it was loaded already
4379          if (item.content.indexOf("/bitrix/js/main/pageobject/pageobject.") !== -1 && BX.PageObject) {
4380            item.content = item.content.replace(
4381              /<script src="\/bitrix\/js\/main\/pageobject\/pageobject\.[^>]*><\/script>/gm,
4382              ""
4383            );
4384          }
4385
4386          // remove /bitrix/js/main/polyfill/promise/js/promise.js if it not need
4387          if (
4388            item.content.indexOf("/bitrix/js/main/polyfill/promise/js/promise.") !== -1 &&
4389            typeof window.Promise !== "undefined" &&
4390            window.Promise.toString().indexOf("[native code]") !== -1
4391          ) {
4392            item.content = item.content.replace(
4393              /<script src="\/bitrix\/js\/main\/polyfill\/promise\/js\/promise\.[^>]*><\/script>/gm,
4394              ""
4395            );
4396          }
4397
4398          var ob = BX.processHTML(item.content);
4399
4400          // stop ya metrika webvisor DOM indexer
4401          pauseYmObserver();
4402
4403          item.block.removeAttr("data-file").removeClass("loader_circle");
4404
4405          if (item.block.data("appendTo")) {
4406            item.block.find(item.block.data("appendTo"))[0].innerHTML = ob.HTML;
4407          } else {
4408            if (item.block.find('> div[id*="bx_incl_"]').length) {
4409              item.block.find('> div[id*="bx_incl_"]')[0].innerHTML = ob.HTML;
4410            } else {
4411              item.block[0].innerHTML = ob.HTML;
4412            }
4413          }
4414
4415          BX.ajax.processScripts(ob.SCRIPT);
4416
4417          var eventdata = { action: "jsLoadBlock" };
4418          BX.onCustomEvent("onCompleteAction", [eventdata, item.block]);
4419
4420          // resume ya metrika webvisor
4421          // 500ms
4422          setTimeout(resumeYmObserver, 500);
4423
4424          bIdle = true;
4425          insertNextBlockContent();
4426        }
4427      }
4428    };
4429
4430    $(".js-load-block").iAppear(
4431      function () {
4432        var $this = $(this);
4433
4434        if ($this.data("file")) {
4435          var add_url = bClearCache ? "?clear_cache=Y" : "";
4436          if ($this.data("block")) {
4437            add_url += (bClearCache ? "&" : "?") + "BLOCK=" + $this.data("block");
4438          }
4439
4440          // get content
4441          $.get($this.data("file") + add_url).done(function (html) {
4442            items.push({
4443              block: $this,
4444              content: html,
4445            });
4446
4447            if (items.length == 1) {
4448              setTimeout(insertNextBlockContent, 100);
4449            }
4450          });
4451        }
4452      },
4453      {
4454        rootMargin: isMobile ? "300px 0px 300px 0px" : "150px 0px 150px 0px",
4455        accX: 0,
4456        accY: isMobile ? 300 : 150,
4457      }
4458    );
4459  }
4460
4461  $("a[rel=tooltip]").tooltip();
4462  $("span[data-toggle=tooltip]").tooltip();
4463
4464  $("select.sort").on("change", function () {
4465    location.href = $(this).val();
4466  });
4467
4468  setTimeout(function (th) {
4469    $(".catalog.group.list .item").each(function () {
4470      var th = $(this);
4471      if ((tmp = th.find(".image").outerHeight() - th.find(".text_info").outerHeight()) > 0) {
4472        th.find(".text_info .titles").height(th.find(".text_info .titles").outerHeight() + tmp);
4473      }
4474    });
4475  }, 50);
4476
4477  // ajax tabs
4478
4479  // tabs on front in mobile
4480  $(".items-link-mobile").each(function () {
4481    var _this = $(this),
4482      selectOption = _this.find("option"),
4483      selectOptionLength = selectOption.length,
4484      selectedOption = selectOption.filter(":selected"),
4485      duration = 200; //
4486
4487    _this.hide();
4488    _this.wrap('<div class="select"></div>');
4489    $("<div>", {
4490      class: "new-select",
4491      text: _this.children("option:disabled").text(),
4492    }).insertAfter(_this);
4493
4494    var selectHead = _this.next(".new-select");
4495    $("<div>", {
4496      class: "new-select__list",
4497    }).insertAfter(selectHead);
4498
4499    var selectList = selectHead.next(".new-select__list");
4500    for (var i = 1; i < selectOptionLength; i++) {
4501      $("<div>", {
4502        class: "new-select__item",
4503        html: $("<span>", {
4504          text: selectOption.eq(i).text(),
4505        }),
4506      })
4507        .attr("data-value", selectOption.eq(i).val())
4508        .appendTo(selectList);
4509    }
4510
4511    var selectItem = selectList.find(".new-select__item");
4512    var selectItemFirst = selectList.find(".new-select__item:first-child");
4513    selectList.slideUp();
4514    selectHead.on("click", function () {
4515      if (!$(this).hasClass("on")) {
4516        $(this).addClass("on");
4517        selectList.slideDown(duration);
4518
4519        selectItemCur = selectList.find(".new-select__item.active");
4520
4521        if (!selectItem.hasClass("active")) {
4522          selectItemFirst.addClass("active");
4523          selectItemCur = selectItemFirst;
4524        }
4525
4526        selectItem.on("click", function () {
4527          selectItemCur.removeClass("active");
4528          var chooseItem = $(this).data("value");
4529
4530          $("select").val(chooseItem).attr("selected", "selected");
4531          selectHead.text($(this).find("span").text());
4532          selectHead.attr("data-value", $(this).attr("data-value"));
4533          $(this).addClass("active");
4534          var _this = $(this);
4535          selectList.slideUp(150, function () {
4536            selectHead.removeClass("on");
4537
4538            var index = _this.index();
4539            var curHeadBlock = _this.closest(".head-block");
4540            var indexTab = curHeadBlock.find(".items-link .item-link.active");
4541            var indexActiveTab = indexTab.index();
4542
4543            if (indexActiveTab != index) {
4544              curHeadBlock.find(".items-link .item-link").eq(index).trigger("click");
4545            }
4546          });
4547        });
4548      } else {
4549        $(this).removeClass("on");
4550        selectList.slideUp(duration);
4551      }
4552    });
4553  });
4554
4555  // gallery in list
4556  $(document).on("mouseenter", ".section-gallery-wrapper .section-gallery-wrapper__item", function () {
4557    const _this = $(this);
4558    const index = _this.index();
4559    const nav_items = _this.closest(".image-list-wrapper").find(".section-gallery-nav .section-gallery-nav__item");
4560
4561    _this.siblings().removeClass("active");
4562    _this.addClass("active");
4563
4564    nav_items.removeClass("active");
4565    nav_items.filter(":eq(" + index + ")").addClass("active");
4566  });
4567
4568  $(document).on("click", ".section-gallery-nav .section-gallery-nav__item", function () {
4569    const _this = $(this);
4570    const index = _this.index();
4571    const items = _this.closest(".image-list-wrapper").find(".section-gallery-wrapper .section-gallery-wrapper__item");
4572
4573    _this.siblings().removeClass("active");
4574    _this.addClass("active");
4575
4576    items.removeClass("active");
4577    items.filter(":eq(" + index + ")").addClass("active");
4578  });
4579
4580  // item galery
4581  $(".thumbs .item a").on("click", function (e) {
4582    e.preventDefault();
4583    $(".thumbs .item").removeClass("current");
4584    $(this).closest(".item").toggleClass("current");
4585    $(".slides li" + $(this).attr("href"))
4586      .addClass("current")
4587      .siblings()
4588      .removeClass("current");
4589  });
4590
4591  $("header.fixed .btn-responsive-nav").on("click", function () {
4592    $("html, body").animate({ scrollTop: 0 }, 400);
4593  });
4594
4595  $("body").on("click", ".form .refresh-page", function () {
4596    location.href = location.href;
4597  });
4598
4599  $(document).on("click", ".basket.fly .opener", function () {
4600    if (window.matchMedia("(max-width: 767px)").matches) location.href = arAsproOptions["THEME"]["URL_BASKET_SECTION"];
4601    else $(this).closest(".ajax_basket").toggleClass("opened");
4602  });
4603
4604  $(document).on("click", ".basket.fly .close_block", function () {
4605    $(".basket.fly .opener").trigger("click");
4606  });
4607
4608  // show props
4609  $(document).on("click", ".show_props", function () {
4610    $(this).prev(".props_list").stop().slideToggle(333);
4611    $(this).find(".char_title").toggleClass("opened");
4612  });
4613
4614  // animated labels
4615  $(document)
4616    .on("focus", ".fill-animate input,.fill-animate textarea", function () {
4617      $(this).addClass("input-filed");
4618    })
4619    .on("focusout", ".fill-animate input,.fill-animate textarea", function () {
4620      if ("" != $(this).val()) {
4621        $(this).addClass("input-filed");
4622      } else {
4623        $(this).removeClass("input-filed");
4624      }
4625    });
4626
4627  // accordion action
4628  $(".panel-collapse").on("hidden.bs.collapse", function () {
4629    $(this).parent().toggleClass("opened");
4630  });
4631  $(".panel-collapse").on("show.bs.collapse", function () {
4632    $(this).parent().toggleClass("opened");
4633  });
4634
4635  $(document).on("click", ".reload-page", function () {
4636    location.reload(true);
4637  });
4638
4639  // DIGITAL BASKET
4640  // - basket fly close
4641  $(document).on("click", function () {
4642    if ($(".basket.fly").length && $(".ajax_basket").hasClass("opened")) {
4643      $(".ajax_basket").removeClass("opened");
4644    }
4645  });
4646
4647  $(document).on("click", ".basket.fly", function (e) {
4648    e.stopPropagation();
4649  });
4650
4651  // - COUNTER
4652  var timerBasketCounter = false;
4653
4654  // -- keyup input
4655  $(document).on("keydown", ".counter__count", function (e) {
4656    // Allow: backspace, delete, tab, escape, enter and .
4657    if (
4658      $.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 ||
4659      // Allow: Ctrl+A, Command+A
4660      (e.keyCode === 65 && (e.ctrlKey === true || e.metaKey === true)) ||
4661      // Allow: home, end, left, right, down, up
4662      (e.keyCode >= 35 && e.keyCode <= 40)
4663    ) {
4664      // let it happen, don't do anything
4665      return;
4666    }
4667    // Ensure that it is a number and stop the keypress
4668    if ((e.shiftKey || e.keyCode < 48 || e.keyCode > 57) && (e.keyCode < 96 || e.keyCode > 105)) {
4669      e.preventDefault();
4670    }
4671  });
4672  $(document).on("keyup", ".counter__count", function (e) {
4673    var $this = $(this),
4674      counterInputValueNew = $this.val(),
4675      price = $this.closest(".buy_block").find("input[name=PRICE]").val();
4676
4677    Summ($this, counterInputValueNew, price);
4678  });
4679
4680  $("select.region").on("change", function () {
4681    var val = parseInt($(this).val());
4682    if ($("select.city").length) {
4683      if (val) {
4684        $("select.city").removeAttr("disabled");
4685        $("select.city option").hide();
4686        $("select.city option[data-parent_section=" + val + "]").show();
4687      } else $("select.city").attr("disabled", "disabled");
4688    }
4689  });
4690
4691  $("select.city, select.region").on("change", function () {
4692    var _this = $(this),
4693      val = parseInt(_this.val());
4694    if (_this.hasClass("region")) {
4695      $("select.city option:eq(0)").show();
4696      $("select.city").val(0);
4697    }
4698
4699    if ((_this.hasClass("region") && !val) || _this.hasClass("city")) {
4700      $.ajax({
4701        type: "POST",
4702        data: { ID: val },
4703      }).done(function (html) {
4704        var ob = BX.processHTML(html);
4705        $(".ajax_items")[0].innerHTML = ob.HTML;
4706        BX.ajax.processScripts(ob.SCRIPT);
4707      });
4708    }
4709  });
4710
4711  // -- blur input
4712  $(document).on("change", ".counter__count", function () {
4713    BasketCounter($(this));
4714  });
4715
4716  // -- click minus, plus button
4717  $(document).on("click", ".counter__action", function (e) {
4718    e.stopPropagation();
4719    BasketCounter($(this));
4720  });
4721
4722  // - Add2Basket
4723  $(document).on("click", ".to_cart", function (e) {
4724    e.stopPropagation();
4725
4726    var item = $(this).closest("[data-item]");
4727    var _this = $(this);
4728    var itemData = item.data("item");
4729    var buyBlock = item.find(".buy_block");
4730    var buttonToCart = buyBlock.find(".to_cart");
4731    var itemQuantity = parseFloat(buttonToCart.data("quantity"));
4732    if (isNaN(itemQuantity) || itemQuantity <= 0) {
4733      itemQuantity = 1;
4734    }
4735    var countItem = $(".basket .count").length ? parseInt($(".basket .count").first().text()) : 0;
4736    $(".basket .count")
4737      .text(countItem + 1)
4738      .removeClass("empted");
4739
4740    var bBasketTop =
4741      typeof arAsproOptions["THEME"]["ORDER_BASKET_VIEW"] !== "undefined" &&
4742      $.trim(arAsproOptions["THEME"]["ORDER_BASKET_VIEW"]) === "HEADER" &&
4743      $(".basket.top").length;
4744    var bBasketFly =
4745      typeof arAsproOptions["THEME"]["ORDER_BASKET_VIEW"] !== "undefined" && !bBasketTop && $(".basket.fly").length;
4746
4747    if (itemData && !isNaN(itemData.ID) && parseInt(itemData.ID) > 0) {
4748      if (typeof arBasketItems === "object" && typeof arBasketItems[itemData.ID] !== "object") {
4749        arBasketItems[itemData.ID] = { ID: itemData.ID, QUANTITY: itemQuantity };
4750      }
4751
4752      $.ajax({
4753        url: arAsproOptions["SITE_DIR"] + "include/footer/basket.php",
4754        type: "POST",
4755        data: { itemData: itemData, quantity: itemQuantity },
4756      }).done(function (html) {
4757        buyBlock.addClass("in");
4758
4759        var eventdata = { action: "loadForm" };
4760        BX.onCustomEvent("onCompleteAction", [eventdata, _this[0]]);
4761
4762        if (bBasketTop) {
4763          $(".ajax_basket").replaceWith(html);
4764        } else if (bBasketFly) {
4765          $(".ajax_basket").html($($.trim(html)).html());
4766        }
4767
4768        // show cart or notice
4769        if (typeof JNoticeSurface === "undefined") {
4770          if (bBasketTop) {
4771            $(".header-cart").addClass("opened");
4772
4773            if (typeof headerCartHideTimer !== "undefined") {
4774              clearTimeout(headerCartHideTimer);
4775            }
4776
4777            headerCartHideTimer = setTimeout(function () {
4778              $(".header-cart").removeClass("opened");
4779            }, 2000);
4780          } else if (bBasketFly) {
4781            setTimeout(function () {
4782              if (!$(".ajax_basket").hasClass("opened")) {
4783                $(".ajax_basket").addClass("opened");
4784              }
4785            }, 50);
4786          }
4787        } else {
4788          JNoticeSurface.get().onAdd2cart([item[0]]);
4789        }
4790
4791        var eventdata = { action: "loadBasket" };
4792        BX.onCustomEvent("onCompleteAction", [eventdata, $(html)]);
4793
4794        if (arAsproOptions["THEME"]["USE_SALE_GOALS"] != "N") {
4795          var eventdata = { goal: "goal_basket_add", params: { itemData: itemData, quantity: itemQuantity } };
4796          BX.onCustomEvent("onCounterGoals", [eventdata]);
4797        }
4798      });
4799    } else {
4800      $(this).parent().removeClass("loadings");
4801      return;
4802    }
4803  });
4804
4805  // - Remove9Basket
4806  $(document).on("click", ".remove", function (e) {
4807    e.stopPropagation();
4808
4809    var item = $(this).closest("[data-item]");
4810    var itemData = item.data("item");
4811    var bRemove = "Y";
4812    var bRemoveAll = $.trim($(this).closest("[data-remove_all]").data("remove_all")) === "Y" ? "Y" : false;
4813    var getCurUri = $.trim($("input[name=getPageUri]").val());
4814    var countItem = $(".basket .count").length
4815      ? parseInt($(".basket .count").first().text())
4816      : $(".basket.default").length
4817      ? $(".basket.default .cart__item").length
4818      : 0;
4819    var bOneItem = countItem - 1 <= 0;
4820    var scrollTop = $(".basket.fly").length
4821      ? $(".basket.fly .items_wrap").scrollTop()
4822      : $(".header-cart .basket.top").length
4823      ? $(".header-cart .basket.top .items").scrollTop()
4824      : "";
4825
4826    var bBasketTop =
4827      typeof arAsproOptions["THEME"]["ORDER_BASKET_VIEW"] !== "undefined" &&
4828      $.trim(arAsproOptions["THEME"]["ORDER_BASKET_VIEW"]) === "HEADER" &&
4829      $(".basket.top").length;
4830    var bBasketFly =
4831      typeof arAsproOptions["THEME"]["ORDER_BASKET_VIEW"] !== "undefined" && !bBasketTop && $(".basket.fly").length;
4832
4833    if (bRemoveAll) {
4834      arBasketItems = [];
4835    } else if (typeof arBasketItems === "object" && itemData && typeof arBasketItems[itemData.ID] === "object") {
4836      delete arBasketItems[itemData.ID];
4837    }
4838
4839    var _ajax = function () {
4840      $.ajax({
4841        url: arAsproOptions["SITE_DIR"] + "include/footer/basket.php",
4842        type: "POST",
4843        data: { itemData: itemData, remove: bRemove, removeAll: bRemoveAll },
4844      }).done(function (html) {
4845        if (bBasketTop) {
4846          $(".ajax_basket").replaceWith(html);
4847        } else if (bBasketFly) {
4848          $(".ajax_basket").html($($.trim(html)).html());
4849          $(".basket.fly .items_wrap").scrollTop(scrollTop);
4850        }
4851
4852        var eventdata = { action: "loadBasket" };
4853        BX.onCustomEvent("onCompleteAction", [eventdata, $(html)]);
4854
4855        if (getCurUri) {
4856          $.ajax({
4857            url: getCurUri,
4858            type: "POST",
4859          }).done(function (html) {
4860            if ($(".basket.default").length) {
4861              $(".basket.default").html(html);
4862            }
4863          });
4864        }
4865
4866        if (arAsproOptions["THEME"]["USE_SALE_GOALS"] != "N") {
4867          var eventdata = {
4868            goal: "goal_basket_remove",
4869            params: { itemData: itemData, remove: bRemove, removeAll: bRemoveAll },
4870          };
4871          BX.onCustomEvent("onCounterGoals", [eventdata]);
4872        }
4873      });
4874    };
4875
4876    if ((typeof itemData !== "undefined" && !isNaN(itemData.ID) && itemData.ID > 0) || bRemoveAll) {
4877      if (bRemoveAll) {
4878        $(".buy_block").removeClass("in");
4879        $(".basket .count").text(0).addClass("empted");
4880      } else {
4881        $(".basket .count")
4882          .text(countItem - 1)
4883          .removeClass("empted");
4884
4885        $("[data-item]").each(function () {
4886          if ($(this).data("item").ID == itemData.ID) {
4887            $(this).find(".buy_block").removeClass("in").find(".to_cart").data("quantity", 0);
4888            $(this).find(".buy_block").find(".counter__count").val(1);
4889          }
4890        });
4891      }
4892
4893      if (bOneItem || bRemoveAll) {
4894        $(".remove.all").remove();
4895
4896        $(".basket_wrap").fadeOut(200);
4897        setTimeout(function () {
4898          $(".basket .basket_empty").fadeIn(200);
4899          $(".basket.fly .wrap").addClass("empty-basket");
4900        }, 200);
4901        setTimeout(_ajax, 400);
4902      } else {
4903        item.animate({ opacity: 0 }, 200).slideUp(200, function () {
4904          _ajax();
4905        });
4906      }
4907    } else {
4908      return;
4909    }
4910  });
4911
4912  $(document).on("click", ".print", function () {
4913    window.print();
4914  });
4915
4916  $(".choise").on("click", function () {
4917    var $this = $(this);
4918    if (typeof $this.data("block") !== "undefined") {
4919      var block = $this.attr("data-block");
4920
4921      try {
4922        var $block = BX(block) ? $("#" + block) : $(".detail-block." + block);
4923      } catch (e) {
4924        var $block = $(block);
4925      }
4926
4927      if ($block.length) {
4928        if ($block.closest(".tab-pane").length) {
4929          var offset = -206;
4930          if (typeof arAsproOptions !== "undefined") {
4931            offset = window.matchMedia("(max-width:991px)").matches
4932              ? arAsproOptions.THEME.HEADER_MOBILE_FIXED !== "Y" || arAsproOptions.THEME.HEADER_MOBILE_SHOW !== "ALWAYS"
4933                ? -187 + 62
4934                : -187
4935              : arAsproOptions.THEME.TOP_MENU_FIXED !== "Y"
4936              ? -206 + 81
4937              : -206;
4938          }
4939
4940          $block.data("offset", offset);
4941          $('.ordered-block a[href="#' + $block.closest(".tab-pane").attr("id") + '"]').click();
4942        }
4943
4944        scrollToBlock($block);
4945      }
4946    }
4947  });
4948
4949  // touch event
4950  document.addEventListener(
4951    "touchend",
4952    function (event) {
4953      if (!$(event.target).closest(".menu-item").length && !$(event.target).hasClass("menu-item")) {
4954        $(".mega-menu .dropdown-menu").css({ display: "none", opacity: 0 });
4955        $(".menu-item").removeClass("hover");
4956      }
4957      if (!$(event.target).closest(".menu.topest").length) {
4958        $(".menu.topest").css({ overflow: "hidden" });
4959        $(".menu.topest > li").removeClass("hover");
4960      }
4961      if (!$(event.target).closest(".full.has-child").length) {
4962        $(".menu_top_block.catalog_block li").removeClass("hover");
4963      }
4964      // if(!$(event.target).closest('.basket_block').length){
4965      //   $('.basket_block .link').removeClass('hover');
4966      //   $('.basket_block .basket_popup_wrapp').slideUp();
4967      // }
4968      // if(!$(event.target).closest('.catalog_item').length){
4969      //   var tabsContentUnhoverHover = $('.tab:visible').attr('data-unhover') * 1;
4970      //   $('.tab:visible').stop().animate({'height': tabsContentUnhoverHover}, 100);
4971      //   $('.tab:visible').find('.catalog_item').removeClass('hover');
4972      //   $('.tab:visible').find('.catalog_item .buttons_block').stop().fadeOut(233);
4973      //   if($('.catalog_block').length){
4974      //     $('.catalog_block').find('.catalog_item_wrapp').removeClass('hover');
4975      //     $('.catalog_block').find('.catalog_item').removeClass('hover');
4976      //   }
4977      // }
4978    },
4979    false
4980  );
4981
4982  touchMenu(".mega-menu .menu-item");
4983  touchTopMenu(".menu.topest li");
4984});
4985
4986function touchMenu(selector) {
4987  if (isMobile) {
4988    if ($(selector).length) {
4989      $(selector).each(function () {
4990        var th = $(this);
4991        th.on("touchend", function (e) {
4992          var _th = $(e.target).closest(".menu-item");
4993
4994          $(".menu.topest > li").removeClass("hover");
4995          $(".menu_top_block.catalog_block li").removeClass("hover");
4996
4997          if (_th.find(".dropdown-menu").length && !_th.hasClass("hover")) {
4998            e.preventDefault();
4999            e.stopPropagation();
5000            _th.siblings().removeClass("hover");
5001            _th.addClass("hover");
5002            $(".menu-row .dropdown-menu").css({ display: "none", opacity: 0 });
5003            if (_th.hasClass("menu-item")) {
5004              _th.closest(".dropdown-menu").css({ display: "block", opacity: 1 });
5005            }
5006            if (_th.find("> .wrap > .dropdown-menu")) {
5007              _th.find("> .wrap > .dropdown-menu").css({ display: "block", opacity: 1 });
5008            } else if (_th.find("> .dropdown-menu")) {
5009              _th.find("> .dropdown-menu").css({ display: "block", opacity: 1 });
5010            }
5011            CheckTopVisibleMenu();
5012          } else {
5013            var href = $(e.target).attr("href") ? $(e.target).attr("href") : $(e.target).closest("a").attr("href");
5014            if (href && href !== "undefined") location.href = href;
5015          }
5016        });
5017      });
5018    }
5019  } else {
5020    $(selector).off();
5021  }
5022}
5023
5024function touchTopMenu(selector) {
5025  if (isMobile) {
5026    if ($(selector).length) {
5027      $(selector).each(function () {
5028        var th = $(this);
5029        th.on("touchend", function (e) {
5030          var _th = $(e.target).closest("li");
5031
5032          $(".menu-item").removeClass("hover");
5033          $(".menu-item .dropdown-menu").css({ display: "none", opacity: 0 });
5034          $(".menu_top_block.catalog_block li").removeClass("hover");
5035
5036          if (_th.hasClass("more") && !_th.hasClass("hover")) {
5037            e.preventDefault();
5038            e.stopPropagation();
5039            _th.siblings().removeClass("hover");
5040            _th.addClass("hover");
5041            $(".menu.topest").css({ overflow: "visible" });
5042          } else {
5043            var href = $(e.target).attr("href") ? $(e.target).attr("href") : $(e.target).closest("a").attr("href");
5044            if (href && href !== "undefined") location.href = href;
5045          }
5046        });
5047      });
5048    }
5049  } else {
5050    $(selector).off();
5051  }
5052}
5053
5054scrollToBlock = function (block) {
5055  if ($(block).length) {
5056    scrollToBlock.last = block;
5057
5058    if (typeof $(block).data("toggle") !== "undefined") {
5059      $(block).click();
5060    }
5061
5062    var offset = -81 - 64;
5063    if (typeof $(block).data("offset") !== "undefined") {
5064      offset = $(block).data("offset");
5065    } else {
5066      if (typeof arAsproOptions !== "undefined") {
5067        offset = window.matchMedia("(max-width:991px)").matches
5068          ? arAsproOptions.THEME.HEADER_MOBILE_FIXED !== "Y" || arAsproOptions.THEME.HEADER_MOBILE_SHOW !== "ALWAYS"
5069            ? -43
5070            : -62 - 43
5071          : arAsproOptions.THEME.TOP_MENU_FIXED !== "Y"
5072          ? -43
5073          : -81 - 43;
5074
5075        if ($(block).hasClass("drag-block")) {
5076          offset += 43;
5077        }
5078      }
5079    }
5080
5081    offset = $(block).offset().top + offset;
5082
5083    $("body").addClass("scrolling-state");
5084    $("body, html").animate({ scrollTop: offset }, 500);
5085    setTimeout(function () {
5086      $("body").removeClass("scrolling-state");
5087    }, 500);
5088  }
5089};
5090
5091scrollToBlock.rescroll = function () {
5092  if (typeof scrollToBlock.last !== "undefined") {
5093    scrollToBlock(scrollToBlock.last);
5094  }
5095};
5096
5097// DIGITAL BASKET
5098function number_format(number, decimals, dec_point, thousands_sep) {
5099  number = (number + "").replace(/[^0-9+\-Ee.]/g, "");
5100  var n = !isFinite(+number) ? 0 : +number,
5101    prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
5102    sep = typeof thousands_sep === "undefined" ? "," : thousands_sep,
5103    dec = typeof dec_point === "undefined" ? "." : dec_point,
5104    s = "",
5105    toFixedFix = function (n, prec) {
5106      var k = Math.pow(10, prec);
5107      return "" + (Math.round(n * k) / k).toFixed(prec);
5108    };
5109
5110  // Fix for IE parseFloat(0.55).toFixed(0) = 0;
5111  s = (prec ? toFixedFix(n, prec) : "" + Math.round(n)).split(".");
5112
5113  if (s[0].length > 3) {
5114    s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
5115  }
5116
5117  if ((s[1] || "").length < prec) {
5118    s[1] = s[1] || "";
5119    s[1] += new Array(prec - s[1].length + 1).join("0");
5120  }
5121
5122  return s.join(dec);
5123}
5124
5125setBasketItemsClasses = function () {
5126  if (typeof arBasketItems !== "undefined" && typeof arBasketItems !== "string" && arBasketItems) {
5127    if (Object.keys(arBasketItems).length) {
5128      for (var key in arBasketItems) {
5129        $("[data-item]").each(function () {
5130          if ($(this).data("id") == key) {
5131            $(this).find(".buy_block").addClass("in");
5132            $(this).find(".buy_block .counter__count").val(arBasketItems[key].QUANTITY);
5133          }
5134        });
5135      }
5136    }
5137  }
5138};
5139
5140function Summ(el, counterInputValueNew, price) {
5141  if (counterInputValueNew <= 0) {
5142    counterInputValueNew = 1;
5143  }
5144
5145  var summ = number_format(counterInputValueNew * price, 0, ".", " "),
5146    allSumm = 0;
5147
5148  el.closest(".cart")
5149    .find(".cart__item")
5150    .each(function () {
5151      var $this = $(this),
5152        price = parseFloat($this.find("input[name=PRICE]").val()),
5153        count = parseFloat($this.find(".counter__count").val());
5154
5155      if (count <= 0) {
5156        count = 1;
5157      }
5158
5159      if (!isNaN(price) && !isNaN(count)) {
5160        allSumm += count * price;
5161      }
5162    });
5163
5164  allSumm = number_format(parseFloat(allSumm), 0, ".", " ");
5165
5166  el.closest(".cart__item").find(".cart__item-summ .price_val").text(summ);
5167  el.closest(".basket").find(".foot .cart-total__value").text(allSumm);
5168}
5169
5170var timerBasketUpdate = false;
5171// - COUNTER
5172BasketCounter = function (el) {
5173  var elClass = $.trim(el.attr("class")),
5174    bClassMinus = elClass.indexOf("counter__action--minus") > -1,
5175    bClassPlus = elClass.indexOf("counter__action--plus") > -1,
5176    bClassCount = elClass.indexOf("counter__count") > -1,
5177    getCurUri = $.trim($("input[name=getPageUri]").val()),
5178    buyBlock = el.closest(".buy_block"),
5179    buttonToCart = buyBlock.find(".to_cart"),
5180    counterWrapper = el.closest(".counter"),
5181    counterInput = counterWrapper.find(".counter__count"),
5182    counterInputValue = parseFloat($.trim(counterInput.val())),
5183    price = parseFloat(buyBlock.find("input[name=PRICE]").val()),
5184    counterInputMaxCount = Math.pow(10, parseInt(counterInput.attr("maxlength"))) - 1,
5185    bAjax = el.closest(".basket").length || counterWrapper.hasClass("js-ajax") ? true : false;
5186  var bBasket = el.closest(".basket").length;
5187
5188  // class minus button
5189  if (bClassMinus) {
5190    var counterInputValueNew = counterInputValue - 1;
5191
5192    if (counterInputValueNew <= 0) {
5193      counterInputValueNew = 1;
5194    }
5195
5196    counterInput.val(counterInputValueNew);
5197
5198    if (bAjax) {
5199      Summ(el, counterInputValueNew, price);
5200
5201      if (timerBasketUpdate) {
5202        clearTimeout(timerBasketUpdate);
5203        timerBasketUpdate = false;
5204      }
5205
5206      timerBasketUpdate = setTimeout(function () {
5207        BasketUpdate(el, counterInputValueNew, bBasket);
5208        timerBasketUpdate = false;
5209      }, 700);
5210    }
5211  }
5212  // class plus button
5213  else if (bClassPlus) {
5214    var counterInputValueNew = counterInputValue + 1;
5215
5216    if (counterInputValueNew > counterInputMaxCount) {
5217      counterInputValueNew = counterInputMaxCount;
5218    }
5219
5220    counterInput.val(counterInputValueNew);
5221
5222    if (bAjax) {
5223      Summ(el, counterInputValueNew, price);
5224
5225      if (timerBasketUpdate) {
5226        clearTimeout(timerBasketUpdate);
5227        timerBasketUpdate = false;
5228      }
5229
5230      timerBasketUpdate = setTimeout(function () {
5231        BasketUpdate(el, counterInputValueNew, bBasket);
5232        timerBasketUpdate = false;
5233      }, 700);
5234    }
5235  }
5236  // class input
5237  else if (bClassCount) {
5238    var counterInputValueNew = counterInputValue;
5239
5240    if (counterInputValueNew <= 0 || isNaN(counterInputValueNew)) {
5241      counterInputValueNew = 1;
5242    }
5243    el.val(counterInputValueNew);
5244
5245    if (bAjax) {
5246      BasketUpdate(el, counterInputValueNew, bBasket);
5247    }
5248  }
5249
5250  if (!getCurUri && !el.closest(".basket.fly").length) {
5251    buttonToCart.data("quantity", counterInputValueNew);
5252  }
5253};
5254
5255BasketUpdate = function (el, counterInputValueNew, actualCounter) {
5256  var itemData = el.closest("[data-item]").data("item");
5257  var itemData =
5258    typeof arBasketItems === "object" && typeof arBasketItems[itemData.ID] === "object"
5259      ? arBasketItems[itemData.ID]
5260      : itemData;
5261  var getCurUri = $.trim($("input[name=getPageUri]").val());
5262  var scrollTop = $(".basket.fly").length
5263    ? $(".basket.fly .items_wrap").scrollTop()
5264    : $(".header-cart .basket.top").length
5265    ? $(".header-cart .basket.top .items").scrollTop()
5266    : "";
5267
5268  var bBasketTop =
5269    typeof arAsproOptions["THEME"]["ORDER_BASKET_VIEW"] !== "undefined" &&
5270    $.trim(arAsproOptions["THEME"]["ORDER_BASKET_VIEW"]) === "HEADER" &&
5271    $(".basket.top").length;
5272  var bBasketFly =
5273    typeof arAsproOptions["THEME"]["ORDER_BASKET_VIEW"] !== "undefined" && !bBasketTop && $(".basket.fly").length;
5274
5275  if (typeof itemData != "undefined" && !isNaN(itemData.ID) && itemData.ID > 0) {
5276    $.ajax({
5277      url: arAsproOptions["SITE_DIR"] + "include/footer/basket.php",
5278      type: "POST",
5279      data: { itemData: itemData, quantity: counterInputValueNew },
5280    }).done(function (html) {
5281      if (typeofExt(arBasketItems) === "object" || typeofExt(arBasketItems) === "array") {
5282        if (typeofExt(arBasketItems[itemData.ID]) === "object") {
5283          arBasketItems[itemData.ID]["QUANTITY"] = counterInputValueNew;
5284        }
5285      }
5286
5287      if (bBasketTop) {
5288        $(".ajax_basket").replaceWith(html);
5289      } else if (bBasketFly) {
5290        $(".ajax_basket").html($($.trim(html)).html());
5291        $(".basket.fly .items_wrap").scrollTop(scrollTop);
5292      }
5293
5294      var eventdata = { action: "loadBasket" };
5295      BX.onCustomEvent("onCompleteAction", [eventdata, $(html)]);
5296
5297      if (getCurUri) {
5298        $.ajax({
5299          url: getCurUri,
5300          type: "POST",
5301        }).done(function (html) {
5302          if ($(".basket.default").length) {
5303            $(".basket.default").html(html);
5304          }
5305        });
5306      }
5307    });
5308  } else {
5309    return;
5310  }
5311};
5312
5313CheckTabActive = function () {};
5314
5315/* parallax bg */
5316ParallaxBg = function () {
5317  if ($("*[data-type=parallax-bg]").length) {
5318    var x = $(window).scrollTop() / $(document).height();
5319    x = parseInt(-x * 280);
5320    $("*[data-type=parallax-bg]")
5321      .stop()
5322      .animate({ "background-position-y": x + "px" }, 400, "swing");
5323  }
5324};
5325
5326// Events
5327var timerScroll = false,
5328  ignoreScroll = [],
5329  documentScrollTopLast = $(document).scrollTop(),
5330  documentScrollTop = documentScrollTopLast;
5331$(window).scroll(function () {
5332  documentScrollTop = $(document).scrollTop();
5333
5334  if (!ignoreScroll.length) {
5335    if (timerScroll) {
5336      clearTimeout(timerScroll);
5337      timerScroll = false;
5338    }
5339    timerScroll = setTimeout(function () {
5340      BX.onCustomEvent("onWindowScroll", false);
5341    }, 100);
5342  }
5343
5344  documentScrollTopLast = $(document).scrollTop();
5345});
5346
5347var timerResize = false,
5348  ignoreResize = [];
5349
5350$(window).resize(function () {
5351  documentScrollTop = $(document).scrollTop();
5352
5353  CheckScrollToTop();
5354  CheckTopMenuPadding();
5355  CheckTopMenuOncePadding();
5356  CheckSearchWidth();
5357
5358  if (!ignoreResize.length) {
5359    if (timerResize) {
5360      clearTimeout(timerResize);
5361      timerResize = false;
5362    }
5363    timerResize = setTimeout(function () {
5364      BX.onCustomEvent("onWindowResize", false);
5365    }, 100);
5366  }
5367
5368  if (
5369    typeof arAsproOptions !== "undefined" &&
5370    arAsproOptions["THEME"] &&
5371    arAsproOptions["THEME"]["COMPACT_FOOTER_MOBILE"] == "Y"
5372  ) {
5373    if (window.matchMedia("(max-width:767px)").matches) {
5374      $("footer").addClass("mobile");
5375      $(".bottom-menu .items>.wrap_compact_mobile").addClass("accordion-body collapse");
5376      $(".bottom-menu .items>.item-link").attr("data-toggle", "collapse");
5377    } else {
5378      $("footer").removeClass("mobile");
5379      $(".bottom-menu .items>.wrap_compact_mobile").removeClass("accordion-body collapse");
5380      $(".bottom-menu .items>.item-link").removeAttr("data-toggle");
5381    }
5382  }
5383
5384  documentScrollTopLast = $(document).scrollTop();
5385});
5386
5387BX.addCustomEvent("onWindowScroll", function (eventdata) {
5388  try {
5389    ignoreScroll.push(true);
5390    ParallaxBg();
5391
5392    if (arAsproOptions["THEME"]["TYPE_SEARCH"] != "fixed") {
5393      if (!$("header > .top-block").length) {
5394        var height_block = 0,
5395          scrollVal = $(window).scrollTop();
5396        height_block = $(".logo_and_menu-row").actual("outerHeight");
5397        if (!scrollVal) {
5398          $(".inline-search-block").css({
5399            height: height_block,
5400            "line-height": height_block - 4 + "px",
5401            top: -height_block,
5402          });
5403        }
5404      }
5405    }
5406
5407    //CheckTopMenuDotted();
5408  } catch (e) {
5409  } finally {
5410    ignoreScroll.pop();
5411  }
5412});
5413
5414BX.addCustomEvent("onWindowResize", function (eventdata) {
5415  try {
5416    ignoreResize.push(true);
5417
5418    CheckHeaderFixedMenu();
5419    CheckTopMenuDotted();
5420    CheckTopVisibleMenu();
5421    CheckFlexSlider();
5422    CheckMainBannerSliderVText($(".banners-big .flexslider"));
5423    CheckObjectsSizes();
5424
5425    if (funcDefined("CoverPlayer")) {
5426      CoverPlayer();
5427    }
5428
5429    verticalAlign();
5430    CheckTabActive();
5431    setTimeout(function () {
5432      createTableCompare(
5433        $(".main-block .items .title-block:not(.clone) .item"),
5434        $(".prop_title_table"),
5435        $(".main-block .prop_title_table .item.clone")
5436      );
5437    }, 100);
5438    SliceHeightBlocks();
5439
5440    if (funcDefined("checkMobileFilter")) {
5441      checkMobileFilter();
5442    }
5443
5444    if (window.matchMedia("(min-width: 992px)").matches) {
5445      CloseMobileMenu();
5446      CloseMobilePhone();
5447    }
5448
5449    if (window.matchMedia("(min-width:768px)").matches) {
5450      closeFullscreenMap();
5451    }
5452  } catch (e) {
5453  } finally {
5454    ignoreResize.pop();
5455  }
5456});
5457
5458BX.addCustomEvent("onSlide", function (eventdata) {
5459  try {
5460    ignoreResize.push(true);
5461
5462    if (eventdata) {
5463      var slider = eventdata.slider;
5464      var slideClass = ".banners-big__item";
5465      var jsDots = $(slider).siblings(".owl-carousel__dots--line");
5466      if (jsDots.length) {
5467        if (eventdata.data) {
5468          if (eventdata.data.relatedTarget) {
5469            var dotScroll = jsDots.find(".owl-carousel__dot-scroll");
5470            var dotsWidth = jsDots.width();
5471            if (dotScroll.length) {
5472              var owlOptions = eventdata.data.relatedTarget;
5473
5474              if (owlOptions) {
5475                var itemsCount = owlOptions._items.length;
5476                var itemsInRow = owlOptions.settings.items;
5477                var currentItem = owlOptions._current; // + 1;
5478
5479                //orig old
5480                //currentItem = currentItem < itemsInRow  ? itemsCount + itemsInRow - 1 : currentItem;
5481                //var offset = ((currentItem - itemsInRow) / itemsCount) * dotsWidth;
5482
5483                //new by use count clones in slider
5484                var clonesInStart = Math.ceil(itemsCount / 2);
5485                currentItem = currentItem < clonesInStart ? itemsCount + clonesInStart - 1 : currentItem;
5486                currentItem = currentItem === itemsCount + clonesInStart ? clonesInStart : currentItem;
5487                var offset = ((currentItem - clonesInStart) / itemsCount) * dotsWidth;
5488
5489                var styles = {
5490                  width: dotsWidth / itemsCount + "px",
5491                  display: "block",
5492                  left: offset,
5493                };
5494
5495                dotScroll.css(styles);
5496              }
5497            }
5498          }
5499        }
5500      }
5501      if (slider) {
5502        // add classes .curent & .shown to slide
5503        slider.find(slideClass).removeClass("current");
5504        var curSlideIndex = eventdata.data.item.index;
5505        var curSlide = slider.find(".owl-item:eq(" + curSlideIndex + ")" + " " + slideClass);
5506
5507        curSlide.addClass("current");
5508        curSlide.addClass("shown");
5509        slider.resize();
5510
5511        if (slider.closest(".blocks").length)
5512          slider.closest(".blocks").find(".flex-direction-nav li").addClass("initied");
5513
5514        if (slider.closest(".wraps").length)
5515          slider.closest(".wraps").find(".flex-direction-nav li").addClass("initied");
5516
5517        if (!slider.find(".flex-control-nav li").length && slider.hasClass("normal")) {
5518          slider.find(".flex-direction-nav li a").addClass("flex-disabled");
5519        }
5520
5521        if (slider.closest(".banners-big").length) {
5522          // var curSlide = slider.find('.item.flex-active-slide');
5523          //logo src
5524          var logoOpacity =
5525            $("body.header_opacity").length &&
5526            (!$("header.header--offset").length || $("header .logo").closest(".header__top-part").length);
5527          var bLogoImg = $("body:not(.left_header_column) header .logo img").length && logoOpacity;
5528          if (bLogoImg) $("header .logo img").attr("src", arAsproOptions.THEME.LOGO_IMAGE);
5529
5530          //nav flex color
5531          slider.find(".flex-control-nav li").removeClass();
5532
5533          //header color
5534          $("header").removeClass("light dark");
5535          // slider.closest('.banners-big').find('.owl-carousel').removeClass('owl-carousel--light owl-carousel--dark');
5536
5537          if (typeof curSlide.data("color") != "undefined") {
5538            $("header").addClass(curSlide.data("color"));
5539            // slider.closest('.banners-big').find('.owl-carousel').addClass('owl-carousel--'+curSlide.data('color'));
5540            if (bLogoImg) {
5541              if (arAsproOptions.THEME.LOGO_IMAGE_WHITE && curSlide.data("color") == "light")
5542                $("header .logo img").attr("src", arAsproOptions.THEME.LOGO_IMAGE_WHITE);
5543            }
5544          }
5545        }
5546
5547        if (
5548          !slider.hasClass("flexslider-init-slice") &&
5549          slider.hasClass("nav-title") &&
5550          $(".gallery-block").closest(".tab-pane").hasClass("active")
5551        ) {
5552          slider.find(".item").sliceHeight({ lineheight: -3 });
5553          slider.addClass("flexslider-init-slice");
5554        }
5555
5556        if (slider.find(".flex-direction-nav").length) {
5557          if (slider.find(".flex-direction-nav").find("a.flex-disabled").length)
5558            slider.find(".flex-direction-nav").removeClass("opacity1").addClass("opacity0");
5559          else slider.find(".flex-direction-nav").removeClass("opacity0").addClass("opacity1");
5560        }
5561      }
5562    }
5563  } catch (e) {
5564  } finally {
5565    ignoreResize.pop();
5566  }
5567});
5568
5569BX.addCustomEvent("onSlideBefore", function (eventdata) {
5570  try {
5571    ignoreResize.push(true);
5572    if (eventdata) {
5573      var slider = eventdata.slider;
5574      if (slider) {
5575        if (slider.closest(".banners-big").length) {
5576          setTimeout(function () {
5577            var curSlide = slider.find(".banners-big__item.current");
5578            var logoOpacity =
5579              $("body.header_opacity").length &&
5580              (!$("header.header--offset").length || $("header .logo").closest(".header__top-part").length);
5581            //logo src
5582            var bLogoImg = $("body:not(.left_header_column) header .logo img").length && logoOpacity;
5583            if (bLogoImg) $("header .logo img").attr("src", arAsproOptions.THEME.LOGO_IMAGE);
5584
5585            //nav flex color
5586            slider.find(".flex-control-nav li").removeClass();
5587
5588            //header color
5589            $("header").removeClass("light dark");
5590            if (typeof curSlide.data("color") != "undefined") {
5591              slider.find(".flex-control-nav li").addClass(curSlide.data("color"));
5592              $("header").addClass(curSlide.data("color"));
5593              if (bLogoImg) {
5594                if (arAsproOptions.THEME.LOGO_IMAGE_WHITE && curSlide.data("color") == "light")
5595                  $("header .logo img").attr("src", arAsproOptions.THEME.LOGO_IMAGE_WHITE);
5596              }
5597            }
5598          }, 100);
5599        } else if (slider.hasClass("top-bigs")) {
5600          setTimeout(function () {
5601            var index = slider.find(".item.flex-active-slide").data("slide_key");
5602            $(".bxSlider.top-small .slides").data("bxSlider").goToSlide(index);
5603            $(".bxSlider.top-small .slides li").removeClass("flex-active-slide");
5604            $('.bxSlider.top-small .slides li[data-slide_key="' + index + '"]').addClass("flex-active-slide");
5605          }, 100);
5606        }
5607      }
5608    }
5609  } catch (e) {
5610  } finally {
5611    ignoreResize.pop();
5612  }
5613});
5614
5615BX.addCustomEvent("onSlideEnd", function (eventdata) {
5616  try {
5617    ignoreResize.push(true);
5618    if (eventdata) {
5619      var slider = eventdata.slider;
5620    }
5621  } catch (e) {
5622  } finally {
5623    ignoreResize.pop();
5624  }
5625});
5626
5627var onCaptchaVerifyinvisible = function (response) {
5628  $(".g-recaptcha:last").each(function () {
5629    var id = $(this).attr("data-widgetid");
5630    if (typeof id !== "undefined" && response) {
5631      if (!$(this).closest("form").find(".g-recaptcha-response").val())
5632        $(this).closest("form").find(".g-recaptcha-response").val(response);
5633      if ($("iframe[src*=recaptcha]").length) {
5634        $("iframe[src*=recaptcha]").each(function () {
5635          var block = $(this).parent().parent();
5636          if (!block.hasClass("grecaptcha-badge")) block.css("width", "100%");
5637        });
5638      }
5639      if ($(this).closest("form").attr("name") == "form_comment") BX.submit(BX("form_comment"));
5640      else $(this).closest("form").submit();
5641    }
5642  });
5643};
5644
5645var onCaptchaVerifynormal = function (response) {
5646  $(".g-recaptcha").each(function () {
5647    var id = $(this).attr("data-widgetid");
5648    if (typeof id !== "undefined") {
5649      if (grecaptcha.getResponse(id) != "") {
5650        $(this).closest("form").find(".recaptcha").valid();
5651      }
5652    }
5653  });
5654};
5655
5656BX.addCustomEvent("onSubmitForm", function (eventdata) {
5657  try {
5658    if (!window.renderRecaptchaById || !window.asproRecaptcha || !window.asproRecaptcha.key) {
5659      eventdata.form.submit();
5660      $(eventdata.form).closest(".form").addClass("sending");
5661      return true;
5662    }
5663    if (window.asproRecaptcha.params.recaptchaSize == "invisible" && typeof grecaptcha != "undefined") {
5664      if ($(eventdata.form).find(".g-recaptcha-response").val()) {
5665        eventdata.form.submit();
5666        $(eventdata.form).closest(".form").addClass("sending");
5667      } else {
5668        grecaptcha.execute($(eventdata.form).find(".g-recaptcha").data("widgetid"));
5669        return false;
5670      }
5671    } else {
5672      eventdata.form.submit();
5673      $(eventdata.form).closest(".form").addClass("sending");
5674    }
5675
5676    return true;
5677  } catch (e) {
5678    console.error(e);
5679    return true;
5680  }
5681});

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.