<script type="lazyload2" defer="defer">
  $(function() {
    var slider = new Swiper ('.swiper-gallery', {
      slidesPerView: 1,
      loop: true,
      autoplay: {"delay": 2000},
      speed: 600,
      navigation: {
        nextEl: '.trending-button-next',
        prevEl: '.trending-button-prev',
      },
    });

    var thumbs = new Swiper ('.swiper-text', {
      slidesPerView: 'auto',
      loop: true,
      autoplay: {"delay": 2000},
      speed: 600,
      effect: 'fade',
      slideToClickedSlide: true,
    });

    slider.controller.control = thumbs;
    thumbs.controller.control = slider;
  });


</script>


<!-- <script type="lazyload2">
 $(function () {
    if($('body').find(".item_slider").length > 0){
      $('.item_slider').each(function() {
        var $sliderID =  $(this).attr('id');
        $("#"+$sliderID).slick();
      });
    }
  });

   $(function () {
    if($('body').find(".center_item_slider").length > 0){
      $('.center_item_slider').each(function() {
        var $sliderID =  $(this).attr('id');
        $("#"+$sliderID).slick({
          centerMode: true,
          centerPadding: '250px'
        });
      });
    }
  });
</script> -->

<script type="lazyload2" defer="defer">
  /* Swiper slider */

  $(function() {
    var sliderSelector = '.swiper-container',
        defaultOptions = { };
    var nSlider = document.querySelectorAll(sliderSelector);
    [].forEach.call(nSlider, function( slider, index, arr )
	{
		var $data = slider.getAttribute('data-swiper') || {};
		if ($data)
		{
			var dataOptions = JSON.parse($data);
		}

		slider.options = Object.assign({}, defaultOptions, dataOptions);
		var swiper = new Swiper(slider, slider.options);
		//console.log(slider.options.autoplay)

		/* stop on hover */
		if ( typeof slider.options.autoplay !== 'undefined' && slider.options.autoplay !== false )
		{
			slider.addEventListener('mouseenter', function(e) {
				swiper.autoplay.stop();
			});

			slider.addEventListener('mouseleave', function(e) {
				swiper.autoplay.start();
			});
		}
	});
  });
</script>

<script type="lazyload2" defer="defer">
  $(function () {
    $("body").delegate(".site-header .mobile-nav-wrapper .close-menu-mm", "click", function(e) {
    	e.preventDefault();
      $('.mobile-nav-wrapper').removeClass('js-menu--is-open');
      $('.site-header__menu').removeClass('mobile-nav--close').addClass('mobile-nav--open');
    });
  });
</script>


<script type="lazyload2" defer="defer">
  {% capture content %}{% render 'quickview' %}{% endcapture %}
  var content = {{ content | json }};
</script>
<script type="lazyload2" defer="defer">
  $(function() {
    $("body").delegate(".color-swatch", "mouseover", function() {
      var $orgimg = $(this).attr("data-pro-org-img");
      var $proid = $(this).attr("data-color-pro-id");
      if($('.product-card__image-wrapper').find('.second_img').length > 0) {
        $(".image2-"+$proid).attr("src",$orgimg);
      } else {
        $(".image-"+$proid).attr("srcset",$orgimg);
      }
    });
  });
</script>



<script type="lazyload2" defer="defer">
  $(function() {

    $('.swatch_item span').each(function() {
      var lazy = $(this);
      var src = lazy.attr('data-bg');
      lazy.css('background-image', 'url("'+src+'")');
    });

    $('.language_switcher_selected').on("click",function() {
      $(this).next("ul").slideToggle();
    })

    $(document).on("mouseup",function(e) {
      var container = $("#translation");
      // if the target of the click isn't the container nor a descendant of the container
      if (!container.is(e.target) && container.has(e.target).length === 0)
      {
        container.hide();
      }
    });

    $('#translation li').on("click",function() {

      var lang = $(this).attr('class');
      var $frame = $('.goog-te-menu-frame:first');
      if (!$frame.length) {
        alert("Error: Could not find Google translate frame.");
        return false;
      }
      $frame.contents().find('.goog-te-menu2-item span.text:contains('+lang+')').get(0).click();

      $("#translation").slideUp();

      return false;
    });

    setInterval(function(){
      var checkarabic =  $("html").attr("lang");
      if(checkarabic == "ar"){
        if($('body').hasClass('rtl')){
        }else{
          $("body").addClass("rtl");
        }
      }else{
        $("body").removeClass("rtl");
      }


      if($(".language_switcher_selected").find("img").length == 0){
        var htmllan =  $("html").attr("lang");
        $('#translation li').each(function(){
          if($(this).find("img").attr("alt") == htmllan){
            $(".language_switcher_selected").html($(this).html());
          }
        })
      }else{
        if($(".language_switcher_selected").find("img").attr("alt") != $("html").attr("lang")){
          $('#translation li').each(function(){
            if($(this).find("img").attr("alt") == $("html").attr("lang")){
              $(".language_switcher_selected").html($(this).html());
            }
          })
        }
      }
    },10)

  });
</script>

<script type="lazyload2" defer="defer">
  $(function() {
    var btn = $('.backtotop');
    $(window).scroll(function() {
      if ($(window).scrollTop() > 800) {
        btn.addClass('show');
      } else {
        btn.removeClass('show');
      }
    });

    btn.on('click', function(e) {
      e.preventDefault();
      $('html, body').animate({scrollTop:0}, '300');
    });
  });
</script>


{% if template contains "index" %}

<script type="lazyload2" data-src="{{ 'jquery-cookie.js' | asset_url }}" async></script>

<!--  ====================== newsletter popup ============================== -->

{% if settings.enable_newsletter_popup %}
<script type="lazyload2" defer="defer">
   $(function() {
     var delay = 2000;
     function createCookie(name,value,days) {
       if (days) {
         var date = new Date();
         date.setTime(date.getTime()+(days*24*60*60*1000));
         var expires = "; expires="+date.toGMTString();
       }
       else var expires = "";
       document.cookie = name+"="+value+expires+"; path=/";
     }
     function readCookie(name) {
       var nameEQ = name + "=";
       var ca = document.cookie.split(';');
       for(var i=0;i < ca.length;i++) {
         var c = ca[i];
         while (c.charAt(0)==' ') c = c.substring(1,c.length);
         if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
       }
       return null;
     }
     function eraseCookie(name) {
       createCookie(name,"",-1);
     }


       var covalue = "no";
       if (readCookie('astron-popup') !== null && readCookie('astron-popup') !== undefined) {
         //console.log("innn");
         covalue = readCookie('astron-popup');
          $(".astron_popup").hide();
       }
       if (covalue == "no"){
         setTimeout(function(){
           $(".astron_popup").show();
           $('body').addClass('popup-active');
         }, 5000);
       }
     $(".close_popup").click(function(){
       $(this).parent(".astron_popup").hide();
       $.cookie('astron-popup', 'yes', {expires: 1, path:"/" });
       $('body').removeClass('popup-active');
     });
   });
 </script>
{% endif %}


<!-- <<<<<<<<<<<<<<<< home product same height title >>>>>>>>>>>>>>>>>> -->


<script type="lazyload2" defer="defer">
  $(function() {

    setTimeout(function () {
      $('.homepage_tab').each(function(){
        var highestBox = 0;
        $(this).find('.pro_tabs ul li .item .grid-view-item .product-card__title a').each(function(){
          if($(this).height() > highestBox) {
            highestBox = $(this).height();
          }
        });
        $(this).find('.pro_tabs ul li .item .grid-view-item .product-card__title a').height(highestBox);
      });
    },500);

  });
</script>


<!-- <<<<<<<<<<<<<<<<<<<<< new arrival tab >>>>>>>>>>>>>>>>>>>> -->

<!-- <script type="lazyload2" defer="defer">
 $(function() {

     $('ul.tabs').each(function(){
       var active, content, links = $(this).find('a');
       active = links.first().addClass('active');
       content = $(active.attr('href'));
       links.not(':first').each(function () {
         $($(this).attr('href')).hide();
       });
       $(this).find('a').click(function(e){
         active.removeClass('active');
         content.hide();
         active = $(this);
         content = $($(this).attr('href'));
         active.addClass('active');
         content.show();
         //content.find(".product_grid_items").slick('setPosition');
         return false;
       });
     });

 });
</script> -->


{% endif %}

<!-- <<<<<<<<<<<<<<< footer >>>>>>>>>>>>>>>>>>> -->

<script type="lazyload2" defer="defer">
  $(function() {
    if($(window).width() < 990){
      $('.site-footer__content .site-footer__item .site-footer__item-inner .h4').click(function (){
        if($(this).parent().hasClass('active')) {
          $(this).parent().removeClass('active');
          $(this).next(".site-footer__linklist").slideUp();
        } else {
          $('.site-footer__content .site-footer__item .site-footer__item-inner').removeClass('active');
          $(this).parent().addClass('active');
          $(".site-footer__content .site-footer__item .site-footer__item-inner .site-footer__linklist").slideUp();
          //$(".site-footer__content .site-footer__item .site-footer__item-inner--text .site-footer__rte").slideUp();
          $(this).parent(".site-footer__item-inner").find(".site-footer__linklist").slideDown();
        }
      });
    }
  });
</script>

{% if template contains "collection" %}

<!-- >>>>>>>>>>>>>>>>>>>>>>>>> collection page column change <<<<<<<<<<<<<<<<<<<<<<< -->

<script type="lazyload2" defer="defer">
  $(function() {
    $(".product_layout .two_product").click (function (){
    	$(".collection_content .inner_wrapper .grid").addClass("two_columns");
        $(".collection_content .inner_wrapper .grid").removeClass("three_columns");
        $(".collection_content .inner_wrapper .grid").removeClass("for_columns");
        $(".collection_content .inner_wrapper .grid").removeClass("five_columns");
      	$(this).addClass('active');
      	$(".product_layout .for_product").removeClass('active');
      	$(".product_layout .three_product").removeClass('active');
        $(".product_layout .five_product").removeClass('active');
    });

    $(".product_layout .three_product").click (function (){
    	$(".collection_content .inner_wrapper .grid").removeClass("two_columns");
        $(".collection_content .inner_wrapper .grid").addClass("three_columns");
        $(".collection_content .inner_wrapper .grid").removeClass("for_columns");
        $(".collection_content .inner_wrapper .grid").removeClass("five_columns");
        $(this).addClass('active');
      	$(".product_layout .two_product").removeClass('active');
      	$(".product_layout .for_product").removeClass('active');
      	$(".product_layout .five_product").removeClass('active');
    });

    $(".product_layout .for_product").click (function (){
    	$(".collection_content .inner_wrapper .grid").removeClass("two_columns");
        $(".collection_content .inner_wrapper .grid").removeClass("three_columns");
        $(".collection_content .inner_wrapper .grid").addClass("for_columns");
      	$(".collection_content .inner_wrapper .grid").removeClass("five_columns");
        $(this).addClass('active');
      	$(".product_layout .two_product").removeClass('active');
      	$(".product_layout .three_product").removeClass('active');
      	$(".product_layout .five_product").removeClass('active');
    });

    $(".product_layout .five_product").click (function (){
    	$(".collection_content .inner_wrapper .grid").removeClass("two_columns");
        $(".collection_content .inner_wrapper .grid").removeClass("three_columns");
        $(".collection_content .inner_wrapper .grid").removeClass("for_columns");
      	$(".collection_content .inner_wrapper .grid").addClass("five_columns");
        $(this).addClass('active');
      	$(".product_layout .two_product").removeClass('active');
      	$(".product_layout .three_product").removeClass('active');
      	$(".product_layout .for_product").removeClass('active');
    });
  });
</script>

<script type="lazyload2" defer="defer">
    $(function() {
      $('.main-content .mobile_filter .filter').click(function (){
          $('.main-content .sidebar').toggleClass('active');
      });
       $('.main-content .sidebar .mobile-results-nav__top-nav').click(function (){
          $('.main-content .sidebar').removeClass('active');
      });
    });
</script>


<!---<<<<<<<<<<<<<<<<<<<<<< Infinity scroll >>>>>>>>>>>>>>>>>>>>> -->

<script type="lazyload2" defer="defer">
  function ScrollExecute() {
    if($(document).height() - 700 < ($(document).scrollTop() + $(window).height())) {
      var  scrollNode = $('#more').last();
      var  scrollURL = $('#more p a').last().attr("href");
      if(scrollNode.length > 0 && scrollNode.css('display') != 'none') {
        $.ajax({
          type: 'GET',
          url: scrollURL,
          beforeSend: function() {
            scrollNode.clone().empty().insertAfter(scrollNode).append('<img src=\"{{ "ajax-loader.gif" | asset_img_url : '40x40'}}\" />');
            scrollNode.hide();
          },
          success: function(data) {
            // remove loading feedback
            scrollNode.next().remove();
            var filteredData = $(data).find("#append-data-here").html(),
                nexturl =$(data).find('#more').html();
            $("#append-data-here").append(filteredData);
            //console.log(nexturl);
            if(nexturl !== undefined)
              $("#more").html(nexturl).show();
            //filteredData.insertBefore( $("#product-list-foot") );
          },
          dataType: "html"
        });
      }
    }
  }

  $(function() {
    $(window).scroll(function(){
      setTimeout(function(){
        ScrollExecute();
      },2000);
    });
  });
</script>

<!-- <<<<<<<<<<<<<<<< product same height title >>>>>>>>>>>>>>>>>> -->


<script type="lazyload2" defer="defer">
  $(function() {

    setTimeout(function () {
      $('.collection_content').each(function(){
        var highestBox = 0;
        $(this).find('ul li .item .grid-view-item .product-card__title a').each(function(){
          if($(this).height() > highestBox) {
            highestBox = $(this).height();
          }
        });
        $(this).find('.ul li .item .grid-view-item .product-card__title a').height(highestBox);
      });
    },500);

  });
</script>

{% endif %}



{% if template contains "product" %}

<!-- <<<<<<<<<<<<<<<<<<<<<<<<< quantity plus minus >>>>>>>>>>>>>>>>>>>>>>>> -->

<script type="lazyload2" defer="defer">
    $(function() {
        $('.qtyplus').click(function(e){
          fieldName = $(this).attr('field');
          var currentVal = parseInt($('input[id='+fieldName+']').val());
          if (!isNaN(currentVal)) {
            $('input[id='+fieldName+']').val(currentVal + 1);
          } else {
            $('input[id='+fieldName+']').val(0);
          }
        });

        $(".qtyminus").click(function(e) {
          fieldName = $(this).attr('field');
          var currentVal = parseInt($('input[id='+fieldName+']').val());
          if (!isNaN(currentVal) && currentVal > 1) {
            $('input[id='+fieldName+']').val(currentVal - 1);
          } else {
            $('input[id='+fieldName+']').val(1);
          }
        });
    });
</script>

<!-- <script type="lazyload2" defer="defer">
  $(function() {
    var proSlider = setInterval(proSliderTimer, 100);
    function proSliderTimer() {
      if($(window).width() < 768) {
        if($('body').find(".diff_layout").length > 0){
          $('.main_right_img').slick({
            slidesToShow: 1,
            slidesToScroll: 1,
            arrows: true,
            autoplay: false,
            infinite: true
          });
        }
      }
      clearInterval(proSlider);
    }
  });
</script> -->

<!-- <<<<<<<<<<<<<<<<<<<<<<<< Size Guide Popup >>>>>>>>>>>>>>>>>>>>>>>>>> -->

<script type="lazyload2" defer="defer">
  $(function() {


    $('.ask_question').click(function() {
      $.fancybox({ href: "#askqqquestion" });
    });

    $('.size_guide_option .sizeguide').click(function() {
      $("body").addClass("activePopup");
      $("body").find('.opacity_div').addClass('active');
      $("body").find('.sizeguide_popup').addClass('active').show();
    });
  });

  $(document).delegate(".sizeguide_popup .close_btn","click", function() {
    $("body").removeClass("activePopup");
    $("body").find('.opacity_div').removeClass('active');
    $("body").find('.sizeguide_popup').removeClass('active').hide();
  });
</script>


<!-- <<<<<<<<<<<<<<<<<<<< product page tab >>>>>>>>>>>>>>>>>>> -->

<script type="lazyload2" defer="defer">
  $(function() {
    if ( $(window).width() > 990 ) {
      $('ul.tabs').each(function(){
        var active, content, links = $(this).find('a');
        active = links.first().addClass('active');
        content = $(active.attr('href'));
        links.not(':first').each(function () {
          $($(this).attr('href')).hide();
        });
        $(this).find('a').click(function(e){
          active.removeClass('active');
          content.hide();
          active = $(this);
          content = $($(this).attr('href'));
          active.addClass('active');
          content.show();
          return false;
        });
      });
    }
    if ( $(window).width() < 990 ) {
      $('ul.tabs-content').each(function(){
        var active, content, links = $(this).find('.mobile-title a');
        active = links.first().addClass('active');
        content = $(active.attr('href'));
        links.not(':first').each(function () {
          $($(this).attr('href')).hide();
        });
        $(this).find('a').click(function(e){
          active.removeClass('active');
          content.hide();
          active = $(this);
          content = $($(this).attr('href'));
          active.addClass('active');
          content.show();
          return false;
        });
      });
    }
  });
</script>


<!-- >>>>>>>>>>>>>>>>>>>>>> Sticky Add To Cart  <<<<<<<<<<<<<<<<<<<<<<<  -->

<script type="lazyload2" defer="defer">
  $(function() {
    $(window).scroll(function(){
      if ($(this).scrollTop() > 700) {
        $('.custom_buy_button').addClass('sticky');
      } else {
        $('.custom_buy_button').removeClass('sticky');
      }
    });
  });
</script>

<script type="lazyload2" defer="defer">
  $(function() {

      $('.qtyplus_custom').click(function(e){
        //e.preventDefault();
        fieldName = $(this).attr('field');
        var currentVal = parseInt($('input[id='+fieldName+']').val());
        if (!isNaN(currentVal)) {
          $('input[id='+fieldName+']').val(currentVal + 1);
        } else {
          $('input[id='+fieldName+']').val(0);
        }
      });

      $(".qtyminus_custom").click(function(e) {
        //e.preventDefault();
        fieldName = $(this).attr('field');
        var currentVal = parseInt($('input[id='+fieldName+']').val());
        if (!isNaN(currentVal) && currentVal > 1) {
          $('input[id='+fieldName+']').val(currentVal - 1);
        } else {
          $('input[id='+fieldName+']').val(1);
        }
      });


      $(".custom_addtocart").click(function() {
        var $id = $(this).attr("data-pro-form-id");
        $($id).find("button.buttonBuyNow").click();
        $($id).find("button.buttonBuyNow").trigger("click");
      });


  });
</script>

<!-- >>>>>>>>>>>>>>>>>>>>>> Review click and scroll  <<<<<<<<<<<<<<<<<<<<<<<  -->


<script type="lazyload2" defer="defer">
 $(function() {
   var $clickcount = 0;
   $('.review_content a').on('click touchstart',function(event){
     event.preventDefault();
     var anchor = $(this);

     var myVar = setInterval(myTimer, 500);
     function myTimer(){
       var $scroll = $(window).scrollTop();
       var $scrollfromtop = $(anchor.attr('href')).offset().top - 100;
       if($scroll <= $scrollfromtop){
         var $minus = $scrollfromtop - $scroll;
         if($minus > 40){
           $('html, body').stop().animate({
             scrollTop: $scrollfromtop
           }, 600);
         }else{
           clearInterval(myVar);
         }
       }else{
         clearInterval(myVar);
       }
     }

   });
 });
</script>

{% endif %}







<!-- <<<<<<<<<<<<<<<<<<<< Mini cart >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -->

<script type="lazyload2" defer="defer">
  $(function() {
    function addToCartSuccess() {
      $.get( "/cart?view=mini", function( data ) {
        $('#crt').html(data);
        $('#crt').removeClass('loading');
      });
    }
    function refreshCart(cart) {
      $('.cart-count').text(cart.item_count);
    }

    $('body').on('click','.buttonAddtoCart',function(e){
      //e.preventDefault();
      var btn = $(this);
      var form = $(this).closest('form');
      btn.attr('disabled', 'disabled');
      btn.text('adicionando...');
      form.find('.error').remove();

      $.ajax({
        type: 'POST',
        url: '/cart/add.js',
        data: form.serialize(),
        dataType: 'json',
        error: function(jqXHR, textStatus, errorThrown){
          var response = $.parseJSON(jqXHR.responseText);
          form.append('<p class="error">'+response.description+'</p>').find('.error').fadeIn().delay(4000).fadeOut();
          btn.text('adicionar ao carrinho');
          btn.removeAttr('disabled');
        }
      }).done(function( data ) {
        addToCartSuccess();
        btn.text('adicionar ao carrinho');
        btn.removeAttr('disabled');
        $.getJSON('/cart.js', function(cart){
          refreshCart(cart);
        });

        setTimeout(function(){
          $('body').addClass('cartOpen');
          $('.fullPage').addClass('witmenu');
          $('.close-cart-body').addClass("active");
        },1000)

        $('.productGrid .productItem').removeClass('qvopen');

      });

    });

    $('body').on('click','.fullPage.witmenu, .closemenu, .closecart', function(e){
      //e.preventDefault();
      $('body').removeClass('menuOpen');
      $('.fullPage').removeClass('witmenu');
      $('body').removeClass('cartOpen');
      $('.close-cart-body').removeClass("active");
    });
    $('.cart_button').on('click',function(e){
      //e.preventDefault();
      setTimeout(function(){
        $('body').addClass('cartOpen');
        $('.fullPage').addClass('witmenu');
        $('.close-cart-body').addClass("active");
      }, 50);
    });
    $('body').on('click', '.adjust',function(){
      var input = $(this).parent().find('input');
      var ip = parseInt(input.val());
      if($(this).hasClass('plus')) {
        ip = ip + 1;
      } else {
        ip = ip - 1;
      }

      if(ip==0) {
        //return false;
      }
      input.val(ip);

      $('#crt').addClass('loading');
      var id = parseInt(input.attr('data-id'));
      $.ajax({
        type: 'POST',
        url: '/cart/update.js',
        data: 'updates['+id+']='+ip,
        dataType: 'json',
        error: function(jqXHR, textStatus, errorThrown){
          var response = $.parseJSON(jqXHR.responseText);
          alert(response.description);
          $('#crt').removeClass('loading');
        }
      }).done(function( data ) {
        addToCartSuccess();
        $.getJSON("/cart.js", function(cart) {
          refreshCart(cart);
        });
        $('#crt').removeClass('loading');
      });

    });
    $("#crt").on('click', "a.remove_item", function(r){
      $('#crt').addClass('loading');
      //r.preventDefault();
      var id = $(this).data("id");
      Shopify.changeItem(id,0, function(c){
        $('.itemCount').text(c.item_count);
        if(!c.item_count) {
          $('#crt').empty();
          $('#crt').append('<div class="empty_cart"><img class="lazyload" data-src="{{ "minicart_close.png" | asset_url }}" alt="" /><p class="emptyCart text-center">Seu carrinho está vazio.</p><a href="/" class="closecart btn emptyClose">Voltar para a loja</a></div>');
          $('#crt').removeClass('has-item');
          $('#crt').removeClass('loading');
          $.getJSON("/cart.js", function(cart) {
            refreshCart(cart);
          });
        } else {
          addToCartSuccess();
        }
      });
      $.getJSON("/cart.js", function(cart) {
        refreshCart(cart);
      });
    });
  });
</script>


<script type="lazyload2" defer="defer">
  $(function() {
    $("body").delegate(".mini_cart_tool .cart_note", "click", function() {
    	$('.cart-note').addClass('active');
      	$('.mini_cart_tool').hide(slow);
    });
    $("body").delegate(".cart-note .close-note", "click", function() {
    	$('.cart-note').removeClass('active');
        $('.mini_cart_tool').show(slow);
    });
    $("body").delegate(".mini_cart_tool .cart_shipping", "click", function() {
    	$('.minicart_calculator').addClass('active');
    });
    $("body").delegate(".minicart_calculator .close-calculator", "click", function() {
    	$('.minicart_calculator').removeClass('active');
    });
  });
</script>






<!-- <<<<<<<<<<<<<<<<<<<<<<<<<<< Animation js >>>>>>>>>>>>>>>>>>>>>> -->

<script type="lazyload2" defer="defer">

  $(function() {

    var doAnimations = function() {

      // Calc current offset and get all animatables
      var offset = $(window).scrollTop() + $(window).height(),
          $animatables = $('.animatable');

      // Unbind scroll handler if we have no animatables
      if ($animatables.length == 0) {
        $(window).off('scroll', doAnimations);
      }

      // Check all animatables and animate them if necessary
      $animatables.each(function(i) {
        var $animatable = $(this);
        if (($animatable.offset().top + $animatable.height() - 20) < offset) {
          $animatable.removeClass('animatable').addClass('animated');
        }
      });

    };

    // Hook doAnimations on scroll, and trigger a scroll
    $(window).on('scroll', doAnimations);
    $(window).trigger('scroll');

  });

</script>


<!-- <<<<<<<<<<<<<<<<<<<<<< Cookie Session >>>>>>>>>>>>>>>>>>>>>>> -->

{% if template contains "index" %}


  <script type="lazyload2" defer="defer">
   $(function() {

     function createCookie(name, value, days) {
       if (days) {
         var date = new Date();
         date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
         var expires = "; expires=" + date.toGMTString();
       }
       else var expires = "";

       document.cookie = name + "=" + value + expires + "; path=/";
     }

     function readCookie(name) {
       var nameEQ = name + "=";
       var ca = document.cookie.split(';');
       for (var i = 0; i < ca.length; i++) {
         var c = ca[i];
         while (c.charAt(0) == ' ') c = c.substring(1, c.length);
         if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
       }
       return null;
     }

     function eraseCookie(name) {
       createCookie(name, "", -1);
     }

     var covalue = "no";

     if (readCookie('privacy-pop-up') !== null && readCookie('privacy-pop-up') !== undefined) {
       covalue = "yes";
       $(".eucookie-pop-up").hide();
     }else{
       setTimeout(function(){
         //$(".eucookie-pop-up").show();
         //$('body').addClass('popup-active');
       }, 2000);
     }

     $(".accept").click(function(){
       //$(this).parent(".eucookie-pop-up").hide();
       //$.cookie('astron-popup', 'yes', {expires: 1, path:"/" });
       createCookie('privacy-pop-up', 'yes', 1);
       //$('body').removeClass('popup-active');
     });


     $("#Contact_newsletter-popup .input-group__btn").click(function(){
       createCookie('privacy-pop-up', 'yes', 1);
     });


   });
 </script>


{% endif %}


<script type="lazyload2" defer="defer">
  $(function () {
    $(".mega-menu__section").each(function(){
      var parentLink = $(this).attr("data-parent-menu-link");
      var sectionId = $(this).attr("id");
      var $megaMenu = $(".mega-menu__"+sectionId);

      if($(window).width() > 768){
        var $parentElement = $('.site-nav [data-navlink-handle="' + parentLink+'"]');
        $parentElement.addClass("has_megamenu")
        $("."+sectionId).appendTo($parentElement);

        setInterval(function(){
          var $headerwidth = $(window).width();
          var $offset = $parentElement.offset().left;
          $("."+sectionId).width($headerwidth);
          $("."+sectionId).css("left", "-"+$offset+"px");
        },500);
      }
    })
  });
</script>
