function ImageSlideShow( stage, thumbs, ovrImgs, viwImgs, extraInfo, srcDir ) {

	this.imgViwr = document.getElementById( stage );
	this.thumbs  = thumbs;
	this.ovrImgs = ovrImgs;
	this.viwImgs = viwImgs;
	this.srcDir  = srcDir; 
	if( extraInfo ) this.extraInfo = extraInfo;
	this.nowShowing = null;
	var myObj  = this;
	this.thumbNails = new Array( );

	preloadImages( ovrImgs, srcDir );
	preloadImages( viwImgs, srcDir );

	for( var i = 0; i < this.thumbs.length; i++ ) {
		if( document.getElementById( this.thumbs[ i ] ) ) {
			this.thumbNails[ i ] = document.getElementById( this.thumbs[ i ] );
			this.thumbNails[ i ].offImg = this.thumbNails[ i ].src;
			this.thumbNails[ i ].ovrImg = this.srcDir + this.ovrImgs[ i ];
			this.thumbNails[ i ].viwImg = this.srcDir + this.viwImgs[ i ];
			this.thumbNails[ i ].myID = i;
			if( this.extraInfo != null ) this.thumbNails[ i ].extraInfo = this.extraInfo[ i ];

			this.thumbNails[ i ].onmouseover = function( ) {
				this.style.cursor = 'pointer';
				this.src = this.ovrImg;
			};
			this.thumbNails[ i ].onmouseout = function( ) {
				this.src = ( this.myID == myObj.nowShowing ) ? this.ovrImg : this.offImg;
			}
			this.thumbNails[ i ].onclick = function( ) {
				myObj.setCurrentImage( this.myID );
			};
		}
	}
	this.init( );
}

ImageSlideShow.prototype.getMaxImage = function( ) {
	return this.viwImgs.length;
};

ImageSlideShow.prototype.getCurrentImage = function( ) {
	return this.nowShowing;
};

ImageSlideShow.prototype.setCurrentImage = function( myID ) {
	this.nowShowing = myID;
	this.thumbNails[ myID ].src = this.thumbNails[ myID ].ovrImg;
	this.imgViwr.src = this.thumbNails[ myID ].viwImg;
	if( this.thumbNails[ myID ].extraInfo ) {
		document.getElementById( this.thumbNails[ myID ].extraInfo ).style.display = 'block';
	}
	for( var i = 0; i < this.thumbs.length; i++ ) {
		if( this.thumbNails[ i ].myID != this.nowShowing ) {

			this.thumbNails[ i ].src = this.thumbNails[ i ].offImg;
			if( this.thumbNails[ i ].extraInfo ) {
				document.getElementById( this.thumbNails[ i ].extraInfo ).style.display = 'none';
			}

		}
	}
};

ImageSlideShow.prototype.init = function( ) {
	this.setCurrentImage( 0 );
};
