(function() {
  var onHamburger = function(e) {
    e.preventDefault();
    var open = hamburger.className == 'open';
    hamburger.className = open ? '' : 'open';
    nav.className = open ? '' : 'open';
  };

  var nav = document.querySelector('header nav');
  var hamburger = document.createElement('div');
  hamburger.id = 'hamburger';
  hamburger.innerHTML = '<div class="top"></div><div class="middle"></div><div class="bottom"></div>';
  hamburger.onclick = onHamburger;
  document.querySelector('header').appendChild(hamburger);
})();