PageSourceSearch

https://mellizos-acc.com/bitrix/templates/aspro-lite/js/general.js

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

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.