(function () {
    var doc = document.documentElement;
    var w = window;
    var prevScroll = w.scrollY || doc.scrollTop;
    var curScroll;
    var direction = 0;
    var prevDirection = 0;
    var header = document.getElementById("myHeader");
    var checkScroll = function () {
        curScroll = w.scrollY || doc.scrollTop;
        if (curScroll > prevScroll) {
            direction = 2;
        } else if (curScroll < prevScroll) {
            direction = 1;
        }
        if (direction !== prevDirection) {
            toggleHeader(direction, curScroll);
        }
        prevScroll = curScroll;
    };
    var toggleHeader = function (direction, curScroll) {
        if (direction === 2 && curScroll > 52) {
            header.classList.add("hide");
            prevDirection = direction;
        } else if (direction === 1) {
            header.classList.remove("hide");
            prevDirection = direction;
        }
    };
    window.addEventListener("scroll", checkScroll);
})();
$(window).scroll(function () {
    console.log($(window).scrollTop());
    if ($(window).scrollTop() > 63) {
        $(".site-header").addClass("navbar-fixed");
    }
    if ($(window).scrollTop() < 64) {
        $(".site-header").removeClass("navbar-fixed");
    }
});
document.addEventListener("DOMContentLoaded", function () {
    window.addEventListener("scroll", function () {
        if (window.scrollY > 52) {
            document.getElementById("navbar_top").classList.add("fixed-top");
            navbar_height = document.querySelector(".navbar").offsetHeight;
            document.body.style.paddingTop = navbar_height + "px";
        } else {
            document.getElementById("navbar_top").classList.remove("fixed-top");
            document.body.style.paddingTop = "0";
        }
    });
});
function openNav() {
    document.getElementById("Sidenav").style.width = "100%";
}
function closeNav() {
    document.getElementById("Sidenav").style.width = "0";
}
$(document).ready(function () {
    var e = $(".count"),
        s = e.length,
        a = [];
    for (i = 0; i < s; i++) a[i] = parseInt(e[i].innerHTML);
    var n = function (s, a, n) {
        var l = s;
        setInterval(function () {
            l < a && (l++, (e[n].innerHTML = l));
        }, 40);
    };
    for (j = 0; j < s; j++) n(0, a[j], j);
});
(function () {
    "use strict";
    var items = document.querySelectorAll(".timeline li");
    function isElementInViewport(el) {
        var rect = el.getBoundingClientRect();
        return rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth);
    }
    function callbackFunc() {
        for (var i = 0; i < items.length; i++) {
            if (isElementInViewport(items[i])) {
                items[i].classList.add("in-view");
            }
        }
    }
    window.addEventListener("load", callbackFunc);
    window.addEventListener("resize", callbackFunc);
    window.addEventListener("scroll", callbackFunc);
})();
$(function () {
    var url = window.location.href; 
    $("#myHeader a").each(function () {
        if (url == this.href) {
            $(this).closest("li").addClass("active");
        }
    });
});
var swiper = new Swiper(".career-Slider", {
    spaceBetween: 0,
    centeredSlides: !0,
    autoplay: { delay: 2500, disableOnInteraction: !1 },
    pagination: { el: ".swiper-pagination", clickable: !0 },
    navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev" },
});
var swiper = new Swiper(".relatedProdSlider", {
    slidesPerView: 1,
    speed: 1000,
    spaceBetween: 0,
    loop: !0,
    pagination: { el: ".swiper-pagination", clickable: !0 },
    navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev" },
    breakpoints: { 300: { slidesPerView: 1, spaceBetween: 24, resistanceRatio: 0.85 }, 768: { slidesPerView: 3, spaceBetween: 15 }, 1300: { slidesPerView: 5, spaceBetween: 35 } },
});
var swiper = new Swiper(".hmbannerSlider", {
    slidesPerView: 1,
    speed: 1000,
    spaceBetween: 0,
    loop: !0,
    pagination: { el: ".swiper-pagination", clickable: !0 },
    autoplay: {
          delay: 2500,
          disableOnInteraction: false,
        },
    navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev" },
    breakpoints: { 300: { slidesPerView: 1, spaceBetween: 0, resistanceRatio: 0.85 }, 768: { slidesPerView: 1, spaceBetween: 0 }, 1300: { slidesPerView: 1, spaceBetween: 0 } },
});

var swiper = new Swiper(".recyclingSlider", {
    slidesPerView: 1,
    speed: 1000,
    spaceBetween: 0,
    loop: !0,
    pagination: { el: ".swiper-pagination", clickable: !0 },
    navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev" },
    breakpoints: { 300: { slidesPerView: 1, spaceBetween: 0, resistanceRatio: 0.85 }, 768: { slidesPerView: 1, spaceBetween: 0 }, 1300: { slidesPerView: 1, spaceBetween: 0 } },
});

Fancybox.bind("[data-fancybox]", { Thumbs: !1 });

$("input[type=file]").change(function (e) {
    $(this).parents(".uploadFile").find(".filename").text(e.target.files[0].name);
});
const progress = document.querySelector(".progress");
progress.addEventListener("input", function () {
    const value = this.value;
    this.style.background = `linear-gradient(to right, #82CFD0 0%, #82CFD0 ${value}%, #fff ${value}%, white 100%)`;
});
