jQuery(document).ready(function () {
  function checkScroll() {
      if (jQuery(window).scrollTop() > 300) {
          jQuery('#back-to-top').fadeIn();
      } else {
          jQuery('#back-to-top').fadeOut();
      }
  };
  checkScroll();
  jQuery(window).scroll(function () {
      checkScroll();
  });
  jQuery('#back-to-top').click(function () {
      jQuery('html, body').animate({ scrollTop: 0 }, 800);
      return false;
  });
});

document.addEventListener('DOMContentLoaded', function () {
    var toggleButton = document.getElementById('togglePopup');
    var boxWrapper = document.querySelector('.box_wrapper');

    if (toggleButton && boxWrapper) {
        toggleButton.addEventListener('click', function () {
            boxWrapper.classList.toggle('open');
        });
    }
});