

	//Prototype for the slideShow class. Initialise variables.
	function slideShow(targetDiv, rotateSpeed) {
		this._targetDiv = targetDiv;
		this._imageArray = new Array();
		this._captionArray = new Array();
		this._linkArray = new Array();
		this._currentCount = 0;
		this._totalCount = 0;
		this._rotateSpeed = rotateSpeed;
	}

	//addImage function
	//Sytax: addImage(imageUrl, opt:imageCaption, opt:imageLink)
	//
	//imageUrl - the relative or absolute URL of the image to be used
	//imageCaption - the optional caption to be displayed under the image
	//imageLink - the optional link that the image and caption will direct to
	slideShow.prototype.addImage = function(imageUrl, imageCaption, imageLink) {
		this._imageArray[this._totalCount] = imageUrl;
		this._captionArray[this._totalCount] = imageCaption;
		this._linkArray[this._totalCount] = imageLink;

		this._totalCount = this._totalCount + 1;
	}

	//startShow function
	//This will start the SlideShow of which it was called from
	slideShow.prototype.startShow = function() {
		var slideOutput;

		slideOutput = "&nbsp;"+this._imageArray[this._currentCount] +"&nbsp;";
		if (this._captionArray[this._currentCount]) { slideOutput = slideOutput + "<br/>" + this._captionArray[this._currentCount]; }
		if (this._linkArray[this._currentCount]) { slideOutput = "<a href=\"" + this._linkArray[this._currentCount] + "\">" + slideOutput + "</a>"; }

		document.getElementById(this._targetDiv).innerHTML = slideOutput;
		var self = this;
		this._slideTimer = window.setTimeout(function(){self.nextSlide();},this._rotateSpeed,this._rotateSpeed);
	}

	//stopShow
	//This will stop the SlideShow of which it was called from
	slideShow.prototype.stopShow = function() {
		clearTimeout(this._slideTimer);
	}

	//nextSlide function
	//This handles the changeover of slide to slide
	slideShow.prototype.nextSlide = function() {
		this._currentCount = this._currentCount + 1;

		if (this._currentCount == this._totalCount)
		{
			this._currentCount = 0;
		}

		var slideOutput;

		slideOutput = "&nbsp;"+this._imageArray[this._currentCount] +"&nbsp;";
		if (this._captionArray[this._currentCount]) { slideOutput = slideOutput + "<br/>" + this._captionArray[this._currentCount]; }
		if (this._linkArray[this._currentCount]) { slideOutput = "<a href=\"" + this._linkArray[this._currentCount] + "\">" + slideOutput + "</a>"; }

		document.getElementById(this._targetDiv).innerHTML = slideOutput;

		var self = this;
		this._slideTimer = window.setTimeout(function(){self.nextSlide();},this._rotateSpeed,this._rotateSpeed);
	}
	
	

