//when the dom is ready...
var theUrl;

var preloadImage = function(img) 
{
  window.addEvent('load', function() {
    var bgImage = new Image();
    bgImage.src = img;
  });
}

window.addEvent('domready', function() {
  $('description').fade('hide');
  $('main').fade('hide');

  var showBackground = new Fx.Tween('main', {
    onComplete: function() {
      showDescription.start('opacity', 1);
    }
  });

  var showDescription = new Fx.Tween('description');

  var fadeBackground = new Fx.Tween('main', {
    onComplete: function() {
      document.location = theUrl;
    }
  });

  var fadeDescription = new Fx.Tween($('description'), {
    onComplete: function() { 
      fadeBackground.start('opacity', 0);
    }
  });
    
  $each($$('#arrownav a'), function(el) {
    el.addEvent('click', function(event) {
      event.stop();
      theUrl = el.href;
      fadeDescription.start('opacity', 0);
    });
  });
  
  showBackground.start('opacity', 1);
});

