	
	var Slideshow = Class.create();

	Slideshow.prototype = {
		initialize: function() {
			this.transitionDelay = 1.5;
			this.slideDelay      = 2500;
			this.transitionFps   = 20;
		},
		
		start: function() {
			var allImages = new Array();
			var counter = 0;
			$('slideshowImages').descendants().each(function(e) {
				allImages[counter] = e.src;
				counter++;
				e.remove();
			});
			this.allImages = allImages;
			this.currentImageIndex = 0;

			var self = this;
			window.setTimeout(self.changeImage.bindAsEventListener(this), this.slideDelay);
		},
		
		changeImage: function() {
			if((this.currentImageIndex+1) >= this.allImages.size())
				nextImageIndex = 0;
			else
				nextImageIndex = this.currentImageIndex+1;

			if(!$('nextSlideshowImage').visible())
			{
				$('nextSlideshowImage').update('<img src="' + this.allImages[nextImageIndex] + '" />');
				new Effect.Fade('currentSlideshowImage', {duration:this.transitionDelay, fps:this.transitionFps});
				new Effect.Appear('nextSlideshowImage', {duration:this.transitionDelay, fps:this.transitionFps});
			}
			else
			{
				$('currentSlideshowImage').update('<img src="' + this.allImages[nextImageIndex] + '" />');
				new Effect.Appear('currentSlideshowImage', {duration:this.transitionDelay, fps:this.transitionFps});
				new Effect.Fade('nextSlideshowImage', {duration:this.transitionDelay, fps:this.transitionFps});
			}
			
			this.currentImageIndex = nextImageIndex;			
			var self = this;
			window.setTimeout(self.changeImage.bindAsEventListener(this), this.slideDelay);
		}
		
	};

	var slideshow = new Slideshow();
	
