var visited = $.cookie('hscpm');

function preload() {
  if (!visited) {
    var preload = document.createElement('div');
    preload.id = 'preload';
    preload.appendChild(document.createTextNode(''));
    var scr = document.getElementById('cover');
    scr.parentNode.insertBefore(preload, scr);
  }
}

function splash() {
  if (!visited) {
    $('#header').append('<a id="splashAnchor" href="#"><img id="splash" src="images/splash.jpg" /></a>');
    $('#splash').load(function() {
      $('#preload').fadeOut(1000, function() {
        $(this).remove();
      })
    });
    $('#splash').click(function() {
      $(this).fadeOut(2000, function() {
        $('#splashAnchor').remove();
        $.cookie('hscpm', 'visited', {
          expires: 7,
          path: '/'
        });
      });
      return false;
    });
  }
}