function grocery_supermarket_chain_mobile_menu_open() {
  jQuery(".side_nav").addClass('show');
}
function grocery_supermarket_chain_mobile_menu_close() {
  jQuery(".side_nav").removeClass('show');
}

jQuery(function($){
  $('.toggle').click(function () {
    grocery_supermarket_chain_Keyboard_loop($('.side_nav'));
  });
});

var grocery_supermarket_chain_Keyboard_loop = function (elem) {
  var grocery_supermarket_chain_tabbable = elem.find('select, input, textarea, button, a').filter(':visible');
  var grocery_supermarket_chain_firstTabbable = grocery_supermarket_chain_tabbable.first();
  var grocery_supermarket_chain_lastTabbable = grocery_supermarket_chain_tabbable.last();
  grocery_supermarket_chain_firstTabbable.focus();

  grocery_supermarket_chain_lastTabbable.on('keydown', function (e) {
    if ((e.which === 9 && !e.shiftKey)) {
      e.preventDefault();
      grocery_supermarket_chain_firstTabbable.focus();
    }
  });

  grocery_supermarket_chain_firstTabbable.on('keydown', function (e) {
    if ((e.which === 9 && e.shiftKey)) {
      e.preventDefault();
      grocery_supermarket_chain_lastTabbable.focus();
    }
  });

  elem.on('keyup', function (e) {
    if (e.keyCode === 27) {
      elem.hide();
    };
  });
};

jQuery(document).ready(function($) {
  var isRtl = $('html').attr('dir') === 'rtl'; // Check if the site is RTL

  $('#banner-area .owl-carousel').owlCarousel({
      loop: true,
      margin: 0,
      nav: false,
      dots: false,
      rtl: isRtl,
      responsive: {
          0: {
              items: 1,
          },
          600: {
              items: 1,
          },
          1000: {
              items: 1,
          }
      }
  });
});

jQuery(window).scroll(function () {
    if (jQuery(this).scrollTop() >= 200) {
        jQuery("#return-to-top").fadeIn();
    } else {
        jQuery("#return-to-top").fadeOut();
    }
});

jQuery("#return-to-top").click(function () {
    jQuery("html, body").animate({ scrollTop: 0 }, 600);
});

jQuery(document).ready(function() {
  jQuery(".main-banner-content-box h3").each(function() {
    var t = jQuery(this).text();
    var splitT = t.split(" ");
    
    if (splitT.length > 1) {
      var lastIndex = splitT.length - 1;
      var secondLastIndex = splitT.length - 2;
      var newText = "";

      for (var i = 0; i < splitT.length; i++) {
        if (i < 3) {
          // First three words with 100 font weight
          newText += "<span style='font-weight: 100;'>" + splitT[i] + " </span>";
        } else if (i === secondLastIndex || i === lastIndex) {
          // Last two words without any color styling
          newText += "<span>" + splitT[i] + " </span>";
        } else {
          newText += splitT[i] + " ";
        }
      }

      jQuery(this).html(newText.trim());
    }
  });
});

jQuery(document).ready(function($) {
  $(window).scroll(function() {
      if ($('.sticky-header').length) {
          if ($(this).scrollTop() > 50) {
              $('.header-main-area.sticky-header').addClass('sticky-active');
          } else {
              $('.header-main-area.sticky-header').removeClass('sticky-active');
          }
      }
  });
});