function gethash() {
	return window.location.hash.replace("#", "")
}

function sleep(t) {
	for (t += (new Date).getTime(); new Date < t;);
}

function isInteger(t) {
	return (0 ^ t) === t
}

function isNumeric(t) {
	return !isNaN(parseFloat(t)) && isFinite(t)
}

function compareNumeric(t, e) {
	return e < t ? 1 : t < e ? -1 : void 0
}

function unique(t) {
	for (var e = {}, i = 0; i < t.length; i++) e[t[i]] = !0;
	return Object.keys(e)
}
var find;

function show_message(t, e) {
	$("#modal_message_html").html(e), $("#modal_message_label").text(t), $("#modal_message").modal("show")
}

function acl() {
	let t = '<a style="text-decoration:none;" href="' + document.location.href + '">.</a>',
		e = window.getSelection(),
		i = e.toString(),
		o = document.getElementsByTagName("body")[0],
		a = document.createElement("div");
	a.style.position = "absolute", a.style.left = "-99999px", o.appendChild(a), i = i.replace(/\./g, t), a.innerHTML = i, e.selectAllChildren(a), window.setTimeout(function () {
		o.removeChild(a)
	}, 0)
}

function scrollToAncor(t, s) {
	s = void 0 !== s ? s : 0, $(t).on("click", function (t) {
		t.preventDefault();
		let e = $(this).data("target") ? $(this).data("target") : $(this).attr("href"),
			i = $(e).offset(),
			o = 0,
			a = $("#hdr").css("position"),
			n = s;
		"fixed" == a && (n = n < $("#hdr").outerHeight() ? $("#hdr").outerHeight() : n), o = i.top > n ? i.top - n : i.top, $("html, body").stop().animate({
			scrollTop: o + 1
		}, 500)
	})
}

function slide_toggle_any(t, e, i) {
	$(t).click(function (t) {
		t.preventDefault(), $(e).stop(!0, !1).slideToggle(i)
	})
}

function slider_init(t, e) {
	$(t).slick(e)
}

function fancybox_init() {
	$("a.lightbox").fancybox({
		buttons: ["print", "zoom", "slideShow", "thumbs", "close"],
		lang: "ru",
		i18n: {
			ru: {
				CLOSE: "Закрыть",
				NEXT: "Вперёд",
				PREV: "Назад",
				ERROR: "Ошибка загрузки. <br/> Повторите запрос позднее.",
				PLAY_START: "Начать слайд-шоу",
				PLAY_STOP: "Приостановить слайд-шоу",
				FULL_SCREEN: "На полный экран",
				THUMBS: "Миниатюры",
				DOWNLOAD: "Скачать",
				SHARE: "Поделиться",
				ZOOM: "Увеличить"
			}
		}
	})
}

function table_responsive_init(t) {
	t = void 0 !== t ? t : "body", $(t).find("table").each(function () {
		$(this).parent().hasClass("table-responsive") || $(this).parent().hasClass("table-responsive-sm") || $(this).parent().hasClass("table-responsive-md") || $(this).parent().hasClass("table-responsive-lg") || $(this).parent().hasClass("table-responsive-xl") || $(this).wrap('<div class="table-responsive"></div>')
	})
}

function embed_responsive_init(t, e) {
	var i = (e = void 0 !== e ? e : 0) ? "embed-responsive embed-responsive-4by3" : "embed-responsive embed-responsive-16by9";
	$(t).find("iframe, embed, object").each(function () {
		$(this).parent().hasClass("embed-responsive") || $(this).wrap('<div class="embed_wrap"><div class="' + i + '"></div></div>')
	})
}

function menu_toggle_upd() {
	$(".menu_toggle .menu_link").each(function (t, e) {
		$(this).next("ul").length && ($(this).next("ul").is(":visible") ? $(this).parent().removeClass("closed").addClass("opened") : $(this).parent().removeClass("opened").addClass("closed"))
	})
}

function menu_sides_init(t) {
	let e = $(t).find("ul").first(),
		i = e.children("li"),
		o = i.length;
	var a;
	0 <= o && (a = o / 2, i.each(function (t, e) {
		t = t < a ? "to_left" : "to_right";
		$(e).addClass(t)
	}))
}

function menu_levels_init(t) {
	$(t).find(".menu").children("li").each(function (t, a) {
		$(a).find("li").each(function (t, e) {
			let i = $(e).attr("class"),
				o = "has_level" + i[i.indexOf("level") + 5];
			$(a).hasClass(o) || $(a).addClass(o)
		})
	})
}
Number.prototype.format = function (t, e, i, o) {
	e = "\\d(?=(\\d{" + (e || 3) + "})+" + (0 < t ? "\\D" : "$") + ")", t = this.toFixed(Math.max(0, ~~t));
	return (o ? t.replace(".", o) : t).replace(new RegExp(e, "g"), "$&" + (i || ","))
}, Array.prototype.in_array = function (t) {
	for (var e = 0, i = this.length; e < i; e++)
		if (this[e] == t) return !0;
	return !1
}, Array.prototype.log = function (t) {
	for (var e = 0, i = this.length; e < i; e++) console.log(this[e]);
	return !0
}, find = [].indexOf ? function (t, e) {
	return t.indexOf(e)
} : function (t, e) {
	for (var i = 0; i < t.length; i++)
		if (t[i] === e) return i;
	return -1
}, $.fn.scrollToTop = function (t) {
	t = void 0 !== t ? t : 100;
	var e = this;
	$(window).scroll(function () {
		$(this).scrollTop() > t ? e.stop(!0, !1).fadeIn("slow") : e.stop(!0, !1).fadeOut("fast")
	}), e.click(function (t) {
		t.preventDefault(), $("html, body").animate({
			scrollTop: 0
		}, "slow")
	})
}, $.fn.scrollToTarget = function (s, l) {
	s = void 0 !== s ? s : 500, l = void 0 !== l ? l : 0, this.click(function (t) {
		t.preventDefault();
		let e = $(this).data("target") ? $(this).data("target") : $(this).attr("href"),
			i = $(e).offset(),
			o = 0,
			a = $(".fixed:visible").first().css("position"),
			n = l;
		"fixed" == a && (n = n < $(".fixed:visible").first().outerHeight() ? $(".fixed:visible").first().outerHeight() : n), o = i.top > n ? i.top - n : i.top, $("html, body").stop(!0).animate({
			scrollTop: o + 1
		}, s)
	})
}, $.fn.spoiler = function (t, e, o, a, n) {
	var s, l;
	this.length && (e = void 0 !== e ? e : 5, o = void 0 !== o ? o : 1, a = void 0 !== a ? a : "Показать всё описание", n = void 0 !== n ? n : "Свернуть описание", console.log(t, e, o, a, n), s = t * e, l = this.outerHeight(), e = '<div class="btn_spoiler_wrap"><span class="btn-spoiler">' + a + "</span></div>", s < l && (this.addClass("spoiler_in").css({
		height: s + "px",
		overflow: "hidden"
	}).after(e), $btn_spoiler = this.next().children()), "undefined" != typeof $btn_spoiler && $btn_spoiler.on("click", function (t) {
		t.preventDefault();
		let e = $(this),
			i = $(this).parent().prev();
		i.hasClass("spoiler_in") && (o && e.hide(), i.animate({
			height: l + "px"
		}, "fast", function () {
			$(this).toggleClass("spoiler_in spoiler_out").css("height", "auto"), e.text(n)
		})), i.hasClass("spoiler_out") && i.animate({
			height: s + "px"
		}, "fast", function () {
			$(this).toggleClass("spoiler_in spoiler_out"), e.text(a)
		})
	}))
}, $(".menu_accord").on("click", ".parent .menu_link", function (t) {
	$(this).next("ul").length && (t.preventDefault(), $(this).parent().toggleClass("opened closed").siblings("li").children("ul:visible").stop(!0, !1).slideToggle(300).parent().toggleClass("opened closed"), $(this).next("ul").stop(!0, !1).slideToggle(300))
}), $(".menu_accord_mobile").on("click", ".parent .menu_link", function (t) {
	$(document).width() <= 751 && $(this).next("ul").length && (t.preventDefault(), $(this).parent().toggleClass("opened closed").siblings("li").children("ul:visible").stop(!0, !1).slideToggle(300).parent().toggleClass("opened closed"), $(this).next("ul").stop(!0, !1).slideToggle(300))
}), $(".menu_toggle").on("click", ".menu_link", function (t) {
	$(this).next("ul").length && (t.preventDefault(), $(this).parent().toggleClass("opened closed"), $(this).next("ul").stop(!0, !1).slideToggle(300))
});
var tabs = {
		init: function (t, e, i) {
			var o = (e = void 0 !== e ? e : ".tabs") + " .tab_title",
				a = (i = void 0 !== i ? i : e) + " .tab_content";
			t && ($(o + "," + a).removeClass("active"), t = void 0 !== $(o).not(".disabled").first().attr("href") ? $(o).first().addClass("active").attr("href") : $(o).first().addClass("active").data("target"), $(t).addClass("active").siblings(".tab_content").hide()), $(e).addClass("tabs_" + $(o).length);
			let n = gethash();
			"" != n && (n = "#" + n, $(o).each(function () {
				n != $(this).attr("href") && n != $(this).data("target") || ($(o + "," + a).removeClass("active"), $(this).addClass("active"), $(n).addClass("active").fadeIn().siblings(".tab_content").hide())
			})), $(o).click(function (t) {
				t.preventDefault(), $(this).hasClass("active") || $(this).hasClass("disabled") || ($(o + "," + a).removeClass("active"), $(this).addClass("active"), tab_active = void 0 !== $(this).attr("href") ? $(this).attr("href") : $(this).data("target"), $(tab_active).addClass("active").fadeIn().siblings(".tab_content").hide(), "function" == typeof tabClickCallback && tabClickCallback($(tab_active)))
			})
		},
		active: function (t, e, i) {
			e = void 0 !== e ? e : ".tabs", i = void 0 !== i ? i : e;
			var o = '.tab_title[data-target="' + t + '"]';
			$(e + " .tab_title" + "," + (i + " .tab_content")).removeClass("active"), $(o).addClass("active"), $(t).addClass("active").fadeIn().siblings(".tab_content").hide()
		}
	},
	backdrop = {
		init: function () {
			var s = this;
			$("body").on("click", '[data-backdrop="click"]', function (t) {
				t.preventDefault(), t.stopPropagation();
				let e = $(this),
					i = e.data("target"),
					o = void 0 !== e.data("type") ? e.data("type") : "clone",
					a = void 0 !== e.data("side") ? e.data("side") : "left",
					n = void 0 !== i ? $(i) : e.next();
				e.toggleClass("active backdrop_close"), s.build(a, n, o), s.show(a, o)
			}), $("body").on("click", ".backdrop_close,.backdrop", function (t) {
				t.preventDefault(), s.destroy()
			})
		},
		swipe_init: function () {
			$(".backdrop_content").swipe({
				swipe: function (t, e, i, o, a, n) {
					$(".backdrop_content").length && ($(".backdrop_content").hasClass("left_side") && "left" == e && backdrop.close(e), $(".backdrop_content").hasClass("right_side") && "right" == e && backdrop.close(e))
				},
				threshold: 20,
				allowPageScroll: "vertical"
			}) 
		},
		build: function (t, e, i) {
			$("body").find(".backdrop_content").length || ($("body").append('<div class="backdrop"></div><div class="backdrop_content ' + t + '_side" data-type="' + i + '"><div class="backdrop_content_inner"></div><a class="hdr_menu_switcher_link menu-toggler active backdrop_close" href="javascript:void;" rel="nofollow" data-backdrop="click" data-target=".mobile_menu" data-side="left"><span class="menu-toggler__bar"></span><span class="menu-toggler__bar"></span><span class="menu-toggler__bar"></span></a></div>'), "self" === i ? (e.before('<div class="backdrop_placeholder"></div>'), $("body").find(".backdrop_content_inner").prepend(e)) : $("body").find(".backdrop_content_inner").prepend(e.clone(!0, !0)), this.swipe_init())
		},
		show: function (t, e) {
			switch (t) {
				case "right":
					$("body").find(".backdrop_content").animate({
						right: "0"
					}, 300);
					break;
				case "left":
				default:
					$("body").find(".backdrop_content").animate({
						left: "0"
					}, 300)
			}
			"clone" == e && $("body").addClass("backdroped")
		},
		close: function (t) {
			switch (t) {
				case "left":
					$("body").find(".backdrop_content").animate({
						left: "-300"
					}, 300, function () {
						backdrop.destroy()
					});
					break;
				case "right":
					$("body").find(".backdrop_content").animate({
						right: "-300"
					}, 300, function () {
						backdrop.destroy()
					})
			}
		},
		destroy: function () {
			switch (void 0 !== $(".backdrop_content").data("type") ? $(".backdrop_content").data("type") : "clone") {
				case "self":
					$(".backdrop_content_inner").children().insertAfter(".backdrop_placeholder"), $(".backdrop_placeholder").remove(), $("body").removeClass("backdroped").find(".backdrop, .backdrop_content").remove();
					break;
				case "clone":
				default:
					$("body").removeClass("backdroped").find(".backdrop, .backdrop_content").remove()
			}
			$('[data-backdrop="click"]').removeClass("active backdrop_close")
		}
	};

function spotdrop_init() {
	$("body").on("click", '[data-spotdrop="click"]', function (t) {
		t.preventDefault(), parent = $(this).data("parent"), $parent = "undefined" != typeof parent ? $(this).parents(parent) : $(this).parent(), $parent.addClass("spotdrop")
	}), $("body").on("click", '[data-spotdrop="focus"]', function (t) {
		t.preventDefault(), parent = $(this).data("parent"), $parent = "undefined" != typeof parent ? $(this).parents(parent) : $(this).parent(), $parent.addClass("spotdrop")
	})
}

function toggle_class_upd() {
	$("[data-toggle]").each(function (t, e) {
		let i = $(this),
			o = i.data(),
			a = void 0 !== o.toggleTarget ? $(o.toggleTarget) : i.next(),
			n = void 0 !== o.toggleActivate ? o.toggleActivate : 0,
			s = void 0 !== o.toggleClass ? o.toggleClass : "active",
			l = void 0 !== o.toggleTargetClass ? o.toggleTargetClass : "";
		1 == n && (a.is(":visible") ? i.addClass(s) : i.removeClass(s), a.is(":visible") && "" != l && a.addClass(l))
	})
}

function custom_height_fix(t, e) {
	$(t).height($(e).outerHeight())
}
$("body").on("click", "[data-toggle]", function (t) {
	t.preventDefault();
	let e = $(this),
		i = e.data(),
		o = void 0 !== i.toggleTarget ? $(i.toggleTarget) : e.next(),
		a = void 0 !== i.toggleActivate ? i.toggleActivate : 0,
		n = void 0 !== i.toggleClass ? i.toggleClass : "active",
		s = void 0 !== i.toggleTargetClass ? i.toggleTargetClass : "",
		l = i.toggleEffect;
	if ("off" == i.toggle) return !1;
	switch (l) {
		case "accord":
			e.parents(i.toggleParent).find('[data-toggle-effect="accord"]:visible').not(e).each(function (t, e) {
				let i = $(this).data("toggle-target"),
					o = void 0 !== i ? $(i) : $(this).next();
				$(this).removeClass(n), "" != s && o.removeClass(s), o.is(":visible") && o.stop(!0, !1).slideUp(300)
			}), o.stop(!0, !1).slideToggle(300);
			break;
		case "slide":
			o.stop(!0, !1).slideToggle("fast");
			break;
		case "fade":
			o.stop(!0, !1).fadeToggle("fast");
			break;
		default:
			o.toggle()
	}
	1 == a && (e.toggleClass(n), "" != s && o.toggleClass(s)), "function" == typeof toggleClickCallback && toggleClickCallback(e, o)
});
var url = document.location.href; - 1 == url.indexOf("contacts") && (document.oncopy = acl), toggle_class_upd(), menu_toggle_upd(), backdrop.init(), table_responsive_init(), $("body").on("click", ".spotdrop > *", function (t) {
	t.stopPropagation()
}), $("body").on("click", function (t) {
	$(".spotdrop").removeClass("spotdrop")
}), $(window).resize(function () {
	toggle_class_upd(), menu_toggle_upd()
});

$('.carousel').slick({
 autoHeight     : true,
 infinite       : true,
 accessibility  : false,
 fade           : false,
 autoplay       : false,
 autoplaySpeed  : 15000,
 speed          : 500,
 slidesToShow   : 1,
 slidesToScroll : 1,
 cssEase        : 'ease-out',
 dots           : false,

 arrows         : true,

 zIndex         : 500,
 useTransform   : true,
 draggable      : false,
 mobileFirst    : true,
 responsive: [
   {
	 breakpoint: 0,
	 settings: {
	   slidesToShow : 1,
	   slidesToScroll : 1,
	 }
   },
   {
	 breakpoint: 479,
	 settings: {
	   slidesToShow : 2,
	   slidesToScroll : 1,
	 }
   },
   {
	 breakpoint: 767,
	 settings: {
	   slidesToShow   : 2,
	   slidesToScroll : 1,
	 }
   },
   {
	 breakpoint: 1023,
	 settings: {
	   slidesToShow: 5,
	   slidesToScroll : 1,
	 }
   },
   {
	 breakpoint: 1279,
	 settings: {
	   slidesToShow: 6,
	   slidesToScroll : 1,
	 }
   },
   {
	 breakpoint: 1535,
	 settings: {
	   slidesToShow: 8,
	   slidesToScroll : 1,
	 }
   }
 ]
});
$('.article-carousel').slick({
 autoHeight     : true,
 infinite       : true,
 accessibility  : false,
 fade           : false,
 autoplay       : false,
 autoplaySpeed  : 15000,
 speed          : 500,
 slidesToShow   : 1,
 slidesToScroll : 1,
 cssEase        : 'ease-out',
 dots           : false, 
 arrows         : true,
 appendArrows   :'.statii-carousel-arrows',
 zIndex         : 500,
 useTransform   : true,
 draggable      : false,
 mobileFirst    : true,
 responsive: [
   {
	 breakpoint: 0,
	 settings: {
	   slidesToShow : 1,
	   slidesToScroll : 1,
	 }
   },
   {
	 breakpoint: 480,
	 settings: {
	   slidesToShow   : 2,
	   slidesToScroll : 1,
	 }
   },
   {
	 breakpoint: 768,
	 settings: {
	   slidesToShow   : 2,
	   slidesToScroll : 1,
	 }
   },
   {
	 breakpoint: 1279,
	 settings: {
	   slidesToShow   : 3,
	   slidesToScroll : 1,
	 }
   }
 ]
});
$('.commando-carousel').slick({
 autoHeight     : true,
 infinite       : false,
 accessibility  : false,
 fade           : false,
 autoplay       : false,
 autoplaySpeed  : 15000,
 speed          : 500,
 slidesToShow   : 1,
 slidesToScroll : 1,
 cssEase        : 'ease-out',
 dots           : false, 
 arrows         : true,
 appendArrows   :'.commando-carousel-arrows',
 zIndex         : 500,
 useTransform   : true,
 draggable      : false,
 mobileFirst    : true,
 responsive: [
   {
	 breakpoint: 0,
	 settings: {
	   slidesToShow : 1,
	   slidesToScroll : 1,
	 }
   },
   {
	 breakpoint: 575,
	 settings: {
	   slidesToShow   : 2,
	   slidesToScroll : 1,
	 }
   },
   {
	 breakpoint: 767,
	 settings: {
	   slidesToShow   : 3,
	   slidesToScroll : 1,
	 }
   },
   {
	 breakpoint: 1280,
	 settings: {
	   slidesToShow   : 3,
	   slidesToScroll : 1
	 }
   },
   {
	 breakpoint: 1536,
	 settings: {
	   slidesToShow   : 4,
	   slidesToScroll : 1
	 }
   }
 ]
});$('.portfolio-inner-carousel').slick({
 autoHeight     : true,
 infinite       : false,
 accessibility  : false,
 fade           : false,
 autoplay       : false,
 autoplaySpeed  : 15000,
 speed          : 500,
 slidesToShow   : 1,
 slidesToScroll : 1,
 cssEase        : 'ease-out',
 dots           : false, 
 arrows         : true,
 appendArrows   :'.portfolio-inner-carousel-arrows',
 zIndex         : 500,
 useTransform   : true,
 draggable      : false,
 mobileFirst    : true,
 responsive: [
   {
	 breakpoint: 0,
	 settings: {
	   slidesToShow : 1,
	   slidesToScroll : 1,
	 }
   },
   {
	 breakpoint: 575,
	 settings: {
	   slidesToShow   : 2,
	   slidesToScroll : 1,
	 }
   },
   {
	 breakpoint: 768,
	 settings: {
	   slidesToShow   : 2,
	   slidesToScroll : 1
	 }
   },
   {
	 breakpoint: 1024,
	 settings: {
	   slidesToShow   : 2,
	   slidesToScroll : 1
	 }
   }
 ]
});
$('.sertifikaty-carousel').slick({
 autoHeight     : true,
 infinite       : false,
 accessibility  : false,
 fade           : false,
 autoplay       : false,
 autoplaySpeed  : 15000,
 speed          : 500,
 slidesToShow   : 1,
 slidesToScroll : 1,
 cssEase        : 'ease-out',
 dots           : false, 
 arrows         : true,
 appendArrows   :'.sertifikaty-carousel-arrows',
 zIndex         : 500,
 useTransform   : true,
 draggable      : false,
 mobileFirst    : true,
 responsive: [
   {
	 breakpoint: 0,
	 settings: {
	   slidesToShow : 1,
	   slidesToScroll : 1,
	 }
   },
   {
	 breakpoint: 575,
	 settings: {
	   slidesToShow   : 2,
	   slidesToScroll : 1,
	 }
   },
   {
	 breakpoint: 768,
	 settings: {
	   slidesToShow   : 3,
	   slidesToScroll : 1
	 }
   },
   {
	 breakpoint: 1024,
	 settings: {
	   slidesToShow   : 4,
	   slidesToScroll : 1
	 }
   }
 ]
}); 
$('.fotogalereya-carousel').slick({
 autoHeight     : true,
 infinite       : true,
 accessibility  : false,
 fade           : true,
 autoplay       : false,
 autoplaySpeed  : 15000,
 speed          : 500,
 slidesToShow   : 1,
 slidesToScroll : 1,
 cssEase        : 'ease-out',
 dots           : false, 
 arrows         : true,
 appendArrows   :'.fotogalereya-carousel-arrows',
 zIndex         : 500,
 useTransform   : true,
 draggable      : false,
 mobileFirst    : true,
});
$('.portfolio-carousel').slick({
 autoHeight     : true,
 infinite       : true,
 accessibility  : false,
 fade           : false,
 autoplay       : true,
 autoplaySpeed  : 15000,
 speed          : 500,
 slidesToShow   : 1,
 slidesToScroll : 1,
 cssEase        : 'ease-out',
 dots           : false, 

 arrows         : true,
 zIndex         : 500,
 useTransform   : true,
 draggable      : false,
 mobileFirst    : true,
 responsive: [
   {
	 breakpoint: 0,
	 settings: {
	   slidesToShow : 1,
	   slidesToScroll : 1,
	 }
   },
   {
	 breakpoint: 480,
	 settings: {
	   slidesToShow   : 2,
	   slidesToScroll : 1,
	 }
   },
   {
	 breakpoint: 768,
	 settings: {
	   slidesToShow   : 2,
	   slidesToScroll : 1,
	 }
   }
 ]
});
$('.categories-carousel').slick({
 autoHeight     : true,
 infinite       : true,
 accessibility  : false,
 fade           : false,
 autoplay       : false,
 autoplaySpeed  : 15000,
 speed          : 500,
 slidesToShow   : 1,
 slidesToScroll : 1,
 cssEase        : 'ease-out',
 dots           : false,
 arrows         : true,
 appendArrows   :'.categories-carousel-arrows',
 zIndex         : 500,
 useTransform   : true,
 draggable      : false,
 mobileFirst    : true,
 responsive: [
   {
	 breakpoint: 0,
	 settings: {
	   slidesToShow : 1,
	   slidesToScroll : 1,
	 }
   },
   {
	 breakpoint: 480,
	 settings: {
	   slidesToShow   : 2,
	   slidesToScroll : 1,
	 }
   },
   {
	 breakpoint: 768,
	 settings: {
	   slidesToShow   : 2,
	   slidesToScroll : 1,
	 }
   },
   {
	 breakpoint: 1024,
	 settings: {
	   slidesToShow   : 3,
	   slidesToScroll : 1,
	 }
   }
 ]
});

$('.slider-for').slick({
	infinite        : true,
	slidesToShow    : 1,
	slidesToScroll  : 1,
	fade            : true,
	dots            : false,
	appendArrows    : '.slider-arrow', 
	asNavFor        : '.slider-nav' 
});
$('.slider-nav').slick({
	infinite        : true,
	slidesToShow    : 2,
	slidesToScroll  : 1,
	focusOnSelect   : true,
	dots            : false,
	arrows          : false,
	asNavFor        : '.slider-for',
});

document.addEventListener('DOMContentLoaded', () => {

const forms = document.querySelectorAll('form:not(.form-search)');
const inputFile = document.querySelectorAll('.upload-file__input');

/////////// Кнопка «Прикрепить файл» ///////////
inputFile.forEach(function(el) {
	let textSelector = document.querySelector('.upload-file__text');
	let fileList;

	// Событие выбора файла(ов)
	el.addEventListener('change', function (e) {

		// создаём массив файлов
		fileList = [];
		for (let i = 0; i < el.files.length; i++) {
			fileList.push(el.files[i]);
		}

		// вызов функции для каждого файла
		fileList.forEach(file => {
			uploadFile(file);
		});
	});

	// Проверяем размер файлов и выводим название
	const uploadFile = (file) => {

		// файла <5 Мб
		if (file.size > 5 * 1024 * 1024) {
			alert('Файл должен быть не более 5 МБ.');
			return;
		}

		// Показ загружаемых файлов
		if (file && file.length > 1) {
			if ( file.length <= 4 ) {
				textSelector.textContent = `Выбрано ${file.length} файла`;
			}
			if ( file.length > 4 ) {
				textSelector.textContent = `Выбрано ${file.length} файлов`;
			}
		} else {
			textSelector.textContent = file.name;
		}
	}

});

// Отправка формы на сервер
const postData = async (url, fData) => { // имеет асинхронные операции

	// начало отправки
	// здесь можно оповестить пользователя о начале отправки

	// ждём ответ, только тогда наш код пойдёт дальше
	let fetchResponse = await fetch(url, {
		method: 'POST',
		body: fData
	});

	// ждём окончания операции
	return await fetchResponse.text();
};

if (forms) {
	forms.forEach(el => {
		el.addEventListener('submit', function (e) {
		    console.log(el);
			e.preventDefault();

			// создание объекта FormData
			let fData = new FormData();

			// Добавление всех input, кроме type="file"
			el.querySelectorAll('input:not([type="file"])').forEach(input => {
				fData.append(input.name, input.value);
			});

			// Добавление файлов input type file
			let file = el.querySelector('.upload-file__input');
			for (let i = 0; i < (file.files.length); i++) {
				fData.append('files[]', file.files[i]); // добавляем файлы в объект FormData()
			}

			// Отправка на сервер
			postData('./mail.php', fData)
				.then(fetchResponse => {
					console.log('Данные успешно отправлены!');
					console.log(fetchResponse);
				})
				.catch(function (error) {
					console.log('Ошибка!');
					console.log(error);
				});
		});
	});
};

});

function initEqualHeight(line, block){
	jQuery(line).find(block).height('auto');
	jQuery(line).each(function(){
		var maxH = 0;
		jQuery(this).find(block).each(function(){
			if (jQuery(this).outerHeight()>maxH) {
				maxH = jQuery(this).outerHeight();
				return;
			}
		});   
		jQuery(this).find(block).height(maxH);
	});
}
jQuery(window).on('load',function($){
	initEqualHeight('.container-footer','.ftr-item');
});
jQuery(window).on('resize',function($){
	initEqualHeight('.container-footer','.ftr-item');
});

if (document.documentElement.clientWidth > 1023) {
	$('.navbar .dropdown').hover(function () {
		$(this).find('.dropdown-menu').first().stop(true, true).delay(250).slideDown();
	}, function () {
		$(this).find('.dropdown-menu').first().stop(true, true).delay(100).slideUp();
	});
	$('.navbar .dropdown > a').click(function () {
		location.href = this.href;
	});
};
$('.tags').html($('.tags').html().split(', ').map(function (el) {
	return '<span>' + el + '</span>'
}));
$('.diskmaker').html($('.diskmaker').html().split('~ ').map(function (el) {
	return '<span>' + el + '</span>'
}));

$('a.go2top').scrollToTop();
$('[type="tel"]').mask('+7(999)999-99-99',{ placeholder: '_' });

function page_resize() {
  if ($(document).width() < 768) {
    //
  } else {
    //
  }
}
page_resize();
$(window).resize(function(e) {
  page_resize();
});
  
$('.faq_item_quest').click(function(event) {
	$(this).toggleClass('active');
	$(this).next().slideToggle(300);
	$(this).parent().siblings().find('.faq_item_answer:visible').slideUp(300); 
});

$(document).ready(function(){
  $('[data-toggle="tooltip"]').tooltip();   
});

var objToStick = $("#product_navigation"); //Получаем нужный объект
var topOfObjToStick = $(objToStick).offset().top; //Получаем начальное расположение нашего блока

$(window).scroll(function () {
	var windowScroll = $(window).scrollTop(); //Получаем величину, показывающую на сколько прокручено окно
	if (windowScroll > topOfObjToStick) { // Если прокрутили больше, чем расстояние до блока, то приклеиваем его
		$(objToStick).addClass("product_navigation_fixed");
	} else {
		$(objToStick).removeClass("product_navigation_fixed");
	};
});

$(document).ready(function() {
	$(".product_navigation a").click(function() {
		var elementClick = $(this).attr("href")
		var destination = $(elementClick).offset().top - 270;
		jQuery("html:not(:animated),body:not(:animated)").animate({
		scrollTop: destination
		}, 400);
		return false;   
	});
});

var $page = $('html, body');
$('a[href*="#"]').click(function () {
	$page.animate({
		scrollTop: $($.attr(this, 'href')).offset().top
	}, 400); // плавная прокрутка до якоря
	$('.backdrop_close').trigger('click');
	return false; // закрываем меню на мобилке
});

//tabs.init(1, '.service_tabs');