PageSourceSearch

https://kristallsmolensk.ru/local/templates/kristall/js/general.js?1772183789191961

js kristallsmolensk.ru collected 2026-10-02 20:52:19 UTC 191,961 bytes, 5,789 lines download raw bytes

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

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.