	//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] = new Image();
    this._imageArray[this._totalCount].src = 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 self = this;
    self.showSlide(this._currentCount);
		this._slideTimer = window.setTimeout(function(){self.nextSlide(true);},this._rotateSpeed,this._rotateSpeed);
	}

	//stopShow
	//This will stop the SlideShow of which it was called from
	slideShow.prototype.stopShow = function() {
		clearTimeout(this._slideTimer);
	}

  slideShow.prototype.showSlide = function(idx) {
    var slideOutput;
    var imgTag = document.getElementById(this._targetDiv + 'img');
    
    if (document.all){
      imgTag.style.filter="blendTrans(duration=1)";
      imgTag.style.filter="blendTrans(duration=1)";
      imgTag.filters.blendTrans.Apply();
    }
    
    imgTag.src = this._imageArray[idx].src;

    if (document.all) {imgTag.filters.blendTrans.Play();}

    if (this._captionArray[idx]) 
    { 
      slideOutput = "<br/>" + this._captionArray[idx]; 
    }

    if (this._linkArray[idx]) 
    { 
      document.getElementById(this._targetDiv + 'link').href = this._linkArray[idx];
      slideOutput = "<a href=\"" + this._linkArray[idx] + "\">" + slideOutput + "</a>"; 
    }
    
    if (this._captionArray[idx]) 
    {
      document.getElementById(this._targetDiv + 'div').innerHTML = slideOutput;        
    }
    

//    document.getElementById(this._targetDiv).innerHTML = slideOutput;

  }  

	//nextSlide function
	//This handles the changeover of slide to slide
	slideShow.prototype.nextSlide = function(continueShow) {
		this._currentCount++;

		if (this._currentCount == this._totalCount)
		{
			this._currentCount = 0;
		}
    
    var self = this;
    self.showSlide(this._currentCount);
    if(continueShow==true)
      this._slideTimer = window.setTimeout(function(){self.nextSlide(continueShow);},this._rotateSpeed,this._rotateSpeed);
    else
      self.stopShow();
      
	}

    //nextSlide function
  //This handles the changeover of slide to slide
  slideShow.prototype.prevSlide = function(continueShow) {
    this._currentCount--;

    if (this._currentCount < 0)
    {
      this._currentCount = this._totalCount-1;
    }
    
    var self = this;
    self.showSlide(this._currentCount);
    
    if(continueShow==true)
      this._slideTimer = window.setTimeout(function(){self.nextSlide(continueShow);},this._rotateSpeed,this._rotateSpeed);
    else
      self.stopShow();
  }
