$(function() {
  Cufon
    .replace('h1')
    .replace('#home a.title span', { hover: true });
  $('.presenter').each(function(){
     var $p = $(this);
     var $f = $p.find(".presenter-front");
     var images = this.images;
     var i = 0;
     var N = images.length;
     var img = new Image(1,1);
     img.src = images[i];
     var step = function() {
        $p.css({backgroundImage:'url(\''+ images[i] +'\')'});
        $f.css({opacity:0});
        $f.css({backgroundImage:'url(\''+ images[i = (i + 1) % N] +'\')'});
     }
     var loop = function() {
        step();
        setTimeout(function(){
            $f.animate({opacity:1},2000);
            setTimeout(loop,4000+Math.random());
        }, Math.random()*10000+1000);
     }
     loop();
  });
});

