function Slideshow()
{
	this.counter = 0;
	this.currentItemIndex = -1;
	this.fadeDuration = 0.5;
	this.items = new Array();
	this.timer = null;
	this.timerInterval = 2000;
}

// shows a specific slide and stops the slideshow
Slideshow.prototype.show = function(index)
{
	var instance = this;
	
	instance.currentItemIndex = index - 1;
	instance.swap();
	instance.stop();
}

// starts the slideshow
Slideshow.prototype.start = function()
{
	this.startTimer();
}

// sets a timeout to show the next slide
Slideshow.prototype.startTimer = function()
{
	var instance = this;

	instance.timer = window.setTimeout(function(){instance.swap()}, instance.timerInterval);
}

// stops the slideshow
Slideshow.prototype.stop = function()
{
	var instance = this;

	window.clearTimeout(instance.timer);
	instance.timer = null;
}

// swaps slides
Slideshow.prototype.swap = function()
{
	var i1 = this.currentItemIndex;
	var i2 = this.currentItemIndex + 1;
	var instance = this;
	
	window.clearTimeout(instance.timer);
	
	i2 = i2 % this.items.length;
	
	var item1 = this.items[i1];
	var item2 = this.items[i2];
	
	if (item2)
	{
		item2.style.display = "block";
		item2.style.filter = "alpha(opacity=0)";	
		item2.style.opacity = 0;
		item2.style.zIndex = this.counter + 1;

		new FadeAnimation(item2, 0, 1, this.fadeDuration).execute();
	}
	
	if (item1 != null && item1.service != null) item1.service.className = "";
	if (item2 != null && item2.service != null) item2.service.className = "lit";

	this.counter++;
	this.currentItemIndex = i2;
	this.startTimer();
}
