        
$(document).ready(function() {

    $('.counter').each(function () {
$(this).prop('Counter',0).animate({
    Counter: $(this).text()
}, {
    duration: 4000,
    easing: 'swing',
    step: function (now) {
        $(this).text(Math.ceil(now));
    }
});
});

});  
 
$(function () {
    function stickyHeader() {
        if ($('.menubar').length) {
            var strickyScrollPos = 100;
            if ($(window).scrollTop() > strickyScrollPos) {
                $('.menubar').addClass('stricky-fixed');
            } else if ($(this).scrollTop() <= strickyScrollPos) {
                $('.menubar').removeClass('stricky-fixed');
            }
        };
    }

    jQuery(window).on('scroll', function () {
        (function ($) {
            stickyHeader();
        })(jQuery);
    });


    if ($(".navigation").length) {
        $(".navigation .navbar button").on("click", function () {
            $(".navigation .menu").slideToggle();
            $(this).toggleClass('open');
            return false;
        });
        $(".navigation .cs-submenu").children("a").append(function () {
            return '<button class="dropdown-expander" title="dropdown"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"/></svg></button>';
        });

    }

    if (document.documentElement.clientWidth < 1023) {
        $(".navigation .menu .dropdown-expander").on("click", function () {
            $(this).parent().parent().children(".cs-dropdown").slideToggle();
            console.log($(this).parents("li"));
            console.log($(this).parents().children(".dropdown-expander").toggleClass("rotated"));
            return false
        })
        $(document).click(function (e) {
            if (!$(e.target).closest('.navigation .navbar button').length) {
                $('.navigation .menu').stop(true).slideUp();
                $(".navigation .navbar button").removeClass('open');

            }
        });
    }
// owl
// owl
const navIcons = [
  '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 16 16"><path d="M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z"/></svg>',
  '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 16 16"><path d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"/></svg>'
];

function initCarousel(sel, opt) {
  $(sel).owlCarousel($.extend({
    loop: true,
    margin: 0,
    nav: true,
    navText: navIcons,
    navSpeed: 500,
    autoplay: true,
    dots: false,
    responsiveClass: true
  }, opt)).on("initialized.owl.carousel", e => {
    const $c = $(e.target);

    // Prev button + span
    $c.find(".owl-prev")
      .attr({ "title": "Previous", "aria-label": "Previous" })
      .find("span").attr({ "title": "Previous", "aria-label": "Previous" });

    // Next button + span
    $c.find(".owl-next")
      .attr({ "title": "Next", "aria-label": "Next" })
      .find("span").attr({ "title": "Next", "aria-label": "Next" });

    // Dots
    $c.find(".owl-dot").each((i, el) => {
      $(el).attr({
        "title": "Go to Slide " + (i + 1),
        "aria-label": "Go to Slide " + (i + 1)
      });
    });
  });
}

// Carousels Init
initCarousel(".featuredProducts", {
  margin: 20,
  items: 4,
  responsive: {
    0: { items: 1 },
    768: { items: 2 },
    1024: { items: 3 }
  }
});
initCarousel("#testimonials", { nav: false, autoplay: false, dots: true, items: 1 });
initCarousel("#clients", {
  nav: false,
  items: 1,
  responsive: {
    0: { items: 2 },
    768: { items: 3 },
    1024: { items: 6 }
  }
});


    $(window).on('scroll', function () {
        if ($(this).scrollTop() > 100) {
            $('#web-pulse-scroll-up').fadeIn();
        } else {
            $('#web-pulse-scroll-up').fadeOut();
        }
    });
    $('#web-pulse-scroll-up').on('click', function () {
        $("html, body").animate({
            scrollTop: 0
        }, 600);
        return false;
    });
 
    $('#thumbs img').click(function () {
        $('#largeImage').attr('src', $(this).attr('src').replace('thumb', 'large'));
        if ($(this).hasClass("active")) {
            $("#thumbs img").removeClass("active");
        } else {
            $("#thumbs img").removeClass("active");
            $(this).addClass("active");
        }
    });

    
});

 