PageSourceSearch

https://lasik.ru/local/templates/aspro-allcorp3medc/js/general.js?1727433289225467

js lasik.ru collected 2026-10-02 06:51:01 UTC 225,467 bytes, 5,877 lines download raw bytes

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

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.