// set the speed of transition here
var ispeed = 3000;

// global scope of which image we're on
var mynext = 1;

// morph properties of element #fo
$('fo').set('morph', {
  link: 'chain',
  duration: ispeed,
  // after the curtain pulls, switch it all up!
  onComplete: function() {
    $('fosure').fade('in');
    $('fosure').set('src',images[mynext]);
    mynext = (++mynext>=images.length) ? 0 : mynext; 
    //setTimeout('changeImage()',ispeed);
    change_image.delay(ispeed);
  }
});

// utility function to fade in the "curtain"
var change_image = function() {
  $('fo').fade(
    'hide'
  ).setStyle(
    'background',
    'transparent url('+images[mynext]+') no-repeat 0 0'
  ).morph({'opacity':1});
}

// get the ball rolling
window.addEvent('load',function() {
  var fosure = new Element('img',{
    'id': 'fosure',
    'src': images[1],
    'style': 'position:absolute;'
  }).inject('logos','top').fade('hide');
  change_image.delay(ispeed);
  //setTimeout('changeImage()',ispeed);
});


