var current_img = 0;
var fade_time = 10000;
      
function fade_start() {
  for (var i=2; i <= number_of_images; i++) {
    $('div'+i).fade('hide');
  }
  setTimeout('fade_to_next()', fade_time);
}

function fade_to_next()
{
  if (current_img == 0) current_img = 1;
  
  $('div'+current_img).set('tween', {duration: 'long'}).fade('out');
  if (current_img == number_of_images) current_img = 1
  else                                 current_img += 1
  $('div'+current_img).set('tween', {duration: 'long'}).fade('in');
  
  setTimeout('fade_to_next()', fade_time);
}

window.addEvent('domready', function() {
  fade_start();
});
