var slideShow = new Class({
		initialize: function(delay,fxduration,location){
			this.images 	= Array();						// This is the array to store the images,titles and paths
			this.fxDuration = fxduration || 1000;			// this is the effects duration
			this.location 	= location;						// This is the area to place the images
			this.delay 		= delay;						// this is how long to show the image for
			this.index		= -1;							// The default starting point is
			this.timer		= null;							// The timer objet to manage timings
			this.newImage	= null;							// New image object
			this.current	= null;							// current image object
		},
		addImage: function(path,title,href){				// FUNCTION TO ADD AN IMAGE ON THE FLY
			var image    	= new Asset.image(path); 		// Create a cache for the image
			var newImage = Array(image,title,href);
			this.images.push(newImage);						// Push the new details into the slide show array of images
		},
		showNextImage: function(){
			this.index++;
			if(!this.images[this.index]){
				this.index = 0; // Start the loop again	
			}
			// create new element behind current image
			var imageElement = new Element("img",{			// Create the image element
				'src': this.images[this.index][0].src,
				'alt' : this.images[this.index][1]
			});
			this.newImage = new Element("a",{				// Create the anchor element
				'href' : this.images[this.index][2],
				'title' : this.images[this.index][1],
				'styles':{
						'zIndex'	: 2,
						'position' 	: 'absolute'
						//'top' 		: this.location.getPosition().y,
						//'left' 		: this.location.getPosition().x
				}
			});
			imageElement.inject(this.newImage);
			this.newImage.inject(this.location);
			if(this.current){
				var obj 	= this.current;
				var curr  	= this.newImage;
				new Fx.Tween(obj,{duration: this.fxDuration ,onComplete: function(){obj.destroy(); curr.style.zIndex = 3;}}).start('opacity',0);
			}else{
				var curr  	= this.newImage;
				new Fx.Tween(curr,{duration: this.fxDuration ,onComplete: function(){curr.style.zIndex = 3;}}).start('opacity',[0,1]);
			}
			this.current = this.newImage;
		},
		start: function(obj){
			this.showNextImage();
			var me = this.showNextImage.bind(this);
			this.timer = me.periodical(this.delay);
		}
	});