just a brief update, today. looking ahead a little bit, we’re going to need some means of keeping track of which alternate stylesheet the visitor has chosen. and so, some basic cookie functions. there are, of course, more sophisticated libraries available for managing browser cookies, which could be used instead.

  function get_cookie (name) {
    var cookies = all_cookies();
    return cookies[name];
  }
  function all_cookies () {
    var cookies = { };

    document.cookie.split('; ').each(function (set) {
      var list = set.split('=');
      cookies[list[0]] = unescape(list[1]);
    });
    return cookies;
  }
  function set_cookie (name,value) {
    document.cookie = [
      name + '=' + value,
      'expires=Thu, 01 Jan 2037 00:00:01 GMT',
      'domain=' + window.location.hostname,
      'path=/'
    ].join('; ');
  }
  function delete_cookie (name) {
    document.cookie = [
      name + '=',
      'expires=Sat, 01 Jan 2000 00:00:01 GMT',
      'domain=' + window.location.hostname,
      'path=/'
    ].join('; ');
  }

on to part 4…