var fes_carousel = null;

var fes_items = new Array();

function fes_itemVisibleInCallback( carousel, item, i, state, evt )
{
  // The index() method calculates the index from a
  // given index who is out of the actual item range.
  var idx = carousel.index( i, fes_items.length );
  carousel.add( i, fes_getItemHTML( fes_items [ idx - 1 ] ) );
}

function fes_itemVisibleOutCallback( carousel, item, i, state, evt )
{


  //carousel.remove( i );
 
  // sonst flackerts im FF
  my_carousel = carousel;
  window.setTimeout( 'removeItem( ' + i + ' )' , 50 );
}

function removeItem( i )
{
  fes_carousel.remove( i );
}

function fes_getItemHTML(item)
{
  return '<a href="' + item.href + '"><h2>' + item.subject + '</h2><img src="' + item.src + '" alt="' + item.alt + '" /></a>';
}