Slideshow = Class.create();
Slideshow.prototype =
{
	initialize: function()
	{
		this.items = $$(".slideshow-image");
		this.currentItem = 0;
		this.size = this.items.length;
		new PeriodicalExecuter(this.nextAccess.bind(this), 3);
	},
	
	randomAccess: function(i)
	{
		if (i == this.currentItem)
			return;
		else
		{
			new Effect.Fade(this.items[this.currentItem]);
			new Effect.Appear(this.items[i]);
			this.currentItem = i;
		}
	},
	
	nextAccess: function()
	{
		this.randomAccess((this.currentItem + 1)%this.size);
	}
};

new Slideshow();

