;(function ($, root, undefined) {
	$(function () {
		'use strict'
		$(document).ready(function () {
			let windowH = $(window).outerHeight()
			// console.log(windowH)
			const mainSlider = () => {
				var revapi225, tpj
				;(function () {
					if (!/loaded|interactive|complete/.test(document.readyState))
						document.addEventListener('DOMContentLoaded', onLoad)
					else onLoad()

					function onLoad() {
						if (tpj === undefined) {
							tpj = jQuery
							if ('off' == 'on') tpj.noConflict()
						}

						if (tpj('#rev_slider_225_1').revolution == undefined) {
							revslider_showDoubleJqueryError('#rev_slider_225_1')
						} else {
							revapi225 = tpj('#rev_slider_225_1')
								.show()
								.revolution({
									sliderType: 'standard',
									jsFileLocation: '/include/rs-plugin/js/',
									sliderLayout: 'fullwidth',
									dottedOverlay: 'none',
									delay: 9000,
									navigation: {
										keyboardNavigation: 'off',
										keyboard_direction: 'horizontal',
										mouseScrollNavigation: 'off',
										mouseScrollReverse: 'default',
										onHoverStop: 'off',
										arrows: {
											style: 'uranus',
											enable: true,
											hide_onmobile: false,
											hide_onleave: false,
											tmp: '',
											left: {
												h_align: 'left',
												v_align: 'center',
												h_offset: 20,
												v_offset: 0,
											},
											right: {
												h_align: 'right',
												v_align: 'center',
												h_offset: 20,
												v_offset: 0,
											},
										},
										bullets: {
											enable: true,
											hide_onmobile: false,
											style: 'light-bars',
											hide_onleave: false,
											direction: 'horizontal',
											h_align: 'center',
											v_align: 'bottom',
											h_offset: 0,
											v_offset: 30,
											space: 10,
											tmp: '',
										},
									},
									responsiveLevels: [1240, 1024, 778, 480],
									visibilityLevels: [1240, 1024, 778, 480],
									gridwidth: [1240, 1024, 778, 480],
									gridheight: [650, 650, windowH + 100, windowH + 100],
									lazyType: 'none',
									parallax: {
										type: 'scroll',
										origo: 'slidercenter',
										speed: 1000,
										speedbg: 0,
										speedls: 0,
										levels: [
											2, 4, 6, 8, 10, 12, 14, 40, 45, -5, -10, -15, -20, 50, 51,
											55,
										],
									},
									shadow: 0,
									spinner: 'spinner3',
									stopLoop: 'off',
									stopAfterLoops: -1,
									stopAtSlide: -1,
									shuffle: 'off',
									autoHeight: 'off',
									hideThumbsOnMobile: 'off',
									hideSliderAtLimit: 0,
									hideCaptionAtLimit: 0,
									hideAllCaptionAtLilmit: 0,
									debugMode: false,
									fallbacks: {
										simplifyAll: 'off',
										nextSlideOnWindowFocus: 'off',
										disableFocusListener: false,
									},
								})
						}

						BubbleMorphAddOn(jQuery, revapi225, false)

						if (typeof ExplodingLayersAddOn !== 'undefined')
							ExplodingLayersAddOn(tpj, revapi225)
					}
				})()
			}

			$('#mobile-menu-trigger a svg').on('click', function () {
				$('.mobile-menu-area').addClass('active')
				$('body').addClass('menu-shadow')
			})
			$('.close-mobile-menu').on('click', function () {
				$('.menu-top-search').removeClass('active')
				$('body').removeClass('menu-shadow')
			})

			if ($(window).width() < 992) {
				$('.vid-bg-section a').attr('target', '_blank')
			}

			$('.close-cart-mobile a').on('click', function () {
				$('#top-cart').removeClass('top-cart-open')
			})

			const FooterFix = () => {
				if ($(window).width() > 991) {
					$('#footer li.nav-item').addClass('wide-footer-link')
					$('#footer li.nav-item .dropdown-menu').addClass('show')
					$('.nav-item .nav-link').hide()
					$('.nav-item .big-footer-nav-title').show()
				} else {
					$('#footer li.nav-item').removeClass('wide-footer-link')
					$('#footer li.nav-item .dropdown-menu').removeClass('show')
					$('.nav-item .big-footer-nav-title').hide()
					$('.nav-item .nav-link').show()
				}
			}

			$(window).resize(function () {
				FooterFix()
			})

			const mobileMneu = () => {
				if ($(window).width() < 992) {
					$('#menu-top-search-trigger').on('click', function () {
						$('.menu-top-search').addClass('active')
					})

					$('#slider').on('click', function () {
						$('.menu-top-search').removeClass('active')
					})

					$('.mobile-menu-box, .sub-menu-area').css({
						'padding-top': $('#header').outerHeight() + 20,
					})

					$('.sub-menu-back-title').on('click', function () {
						$(this).closest('.sub-menu-area').removeClass('active')
					})

					$('.sub-item > a').on('click', function (e) {
						$(this)
							.closest('.sub-item')
							.find('.sub-menu-area')
							.addClass('active')
						$('.svg-trigger').addClass('active').attr('data-state', 'close')
					})

					$('#mobile-menu-trigger-small').on('click', function () {
						$('.mobile-menu-box').toggleClass('active')
						$('.svg-trigger').addClass('active').attr('data-state', 'close')
					})

					$('.mobile-menu-box .close-button').on('click', function () {
						$('.sub-menu-area').removeClass('active')
						$('.svg-trigger').removeClass('active').attr('data-state', 'open')
					})

					$('.sub-menu-area .close-button').on('click', function () {
						$(this).closest('.sub-menu-area').removeClass('active')
						$('.svg-trigger').removeClass('active').attr('data-state', 'open')
					})

					$('.svg-trigger').on('click', function () {
						var state = $(this).attr('data-state')
						if (state === 'open') {
							$(this).addClass('active').attr('data-state', 'close')
						} else {
							$(this).removeClass('active').attr('data-state', 'open')
							$('.sub-menu-area').removeClass('active')
						}
					})

					$(document).on('click', function (e) {
						if ($('.mobile-menu-box').hasClass('active')) {
							$('#mobile-menu-trigger-small a').addClass('times-trigger')
						} else {
							$('#mobile-menu-trigger-small a').removeClass('times-trigger')
						}
					})
				}
			}
			mobileMneu()
			$(window).resize(function () {
				mobileMneu()
			})

			mainSlider()
			FooterFix()
		})
	})
})(jQuery, this)

$(document).ready(function () {
	var ticker = $('.ticker')
	var container = $('.ticker-container')
	function animateTicker() {
		var tickerWidth = ticker.outerWidth()
		var containerWidth = container.width()

		ticker.css({ left: containerWidth })

		ticker.animate(
			{ left: -tickerWidth },
			tickerWidth * 20,
			'linear',
			function () {
				animateTicker()
			}
		)
	}
	setTimeout(animateTicker, 100)
})
