PageSourceSearch

https://medcafedra.ru/bitrix/templates/aspro-allcorp3-med/js/general.js

js medcafedra.ru collected 2026-10-01 12:39:11 UTC 190,561 bytes, 5,734 lines download raw bytes

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

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.