$(function() {
  var $body = $('body');

  var cookie_name = 'last_notification_update';
  var last_notification = getCookie(cookie_name);

  var $header_button_notification = $('.header__button--notification');
  var current_notification = $header_button_notification.attr('data-updated');

  if (last_notification !== current_notification) {
    $header_button_notification.addClass('new');
  }

  $body.on('click', '.header__button--notification', function(event) {
    event.preventDefault();
    setCookie(cookie_name, current_notification, 90);
    $(this).removeClass('new');
    $body.toggleClass('notification_open');
  });

  $body.on('click', '.notification__close', function(event) {
    event.preventDefault();
    $body.removeClass('notification_open');
  });
});