<!--
function Slideshow( imgArray, elmID, delay )
{
	// member variables
	this._delay = delay;		// how long (in miliseconds) between each slide
	this._index = 0;			// the index of the slide currently being shown
	this._timer = null;			// timer object
	this._images = imgArray;	// image array, contains urls to the images
	this._elementID = elmID;	// element id, string of the IMG element to change
	this._maxSlides = -1;		// max number of slides to transition through
}

// start slideshow
Slideshow.prototype.start = function()
{
	startSlideTimer( this );
}

// stop slideshow
Slideshow.prototype.stop = function()
{
	clearTimeout(this._timer);	
}

function startSlideTimer( slideobj )
{
	if(slideobj._timer != null)
		clearTimeout(slideobj._timer);	
		
	slideobj._timer = setTimeout( function() { updateSlide(slideobj); } , slideobj._delay );
}

function updateSlide( slideobj )
{
	if( slideobj._index++ >= slideobj._images.length-1 )
		slideobj._index = 0;
	
	document.getElementById(slideobj._elementID).src = slideobj._images[slideobj._index];
	
	if( slideobj._maxSlides > 0 ) {
		if( slideobj._index < slideobj._maxSlides ) {
			slideobj._maxSlides--;
			slideobj.start();
		} else {
			clearTimeout(this._timer);
		}
	} else {
		slideobj.start();
	}
}
//-->
