Animated header

/**
 * cbpAnimatedHeader.js v1.0.0

 * Copyright 2013, Codrops
 * http://www.codrops.com
 
 * This is a Greyhound edit, which doesn't use the classie.js lib
*/
var cbpAnimatedHeader = (function() {

  var header = document.querySelector('.cbp-af-header'),
    didScroll = false,
    changeHeaderOn = 300;

  function init() {
    window.addEventListener('scroll', function(event) {
      if (!didScroll) { // if didScroll is not equal to true, in other words didScroll is equal to false
        didScroll = true;
        setTimeout(scrollPage, 250);
      }
    }, false);
  }

  function scrollPage() {
    var sy = scrollY();
    if (sy >= changeHeaderOn) {
      //classie.add( header, 'cbp-af-header-shrink' );
      header.classList.add("cbp-af-header-shrink");
    } else {
      //classie.remove( header, 'cbp-af-header-shrink' );
      header.classList.remove("cbp-af-header-shrink");
    }
    didScroll = false;
  }

  function scrollY() {
    return window.pageYOffset || document.documentElement.scrollTop;
  }

  init();

})();