var slideShowSpeed = 3500;
var crossFadeDuration = 10;

var t;

function MultiSlideShow(theImgName) {
	this['current'] = 0;
	this['imgName'] = theImgName;
	this['preLoad'] = new Array();
	MultiSlideShow.prototype.addImage = function(imgSrc) {
	var img = new Image();
		img.src = imgSrc;
		this.preLoad[this.preLoad.length] = img;  
 	}
	MultiSlideShow.prototype.next = function() {
		this.current = this.current + 1;
		if (this.current > (this.preLoad.length - 1)) {
			this.current = 0;
		}
		return this.current;	
	}
	MultiSlideShow.prototype.changeImages = function() {
		if (document.all) {
			document.images[this.imgName].style.filter="blendTrans(duration=2)";
			document.images[this.imgName].style.filter="blendTrans(duration=crossFadeDuration)";
			document.images[this.imgName].filters.blendTrans.Apply();
		}
		document.images[this.imgName].src = this.preLoad[this.current].src;
		if (document.all) {
			document.images[this.imgName].filters.blendTrans.Play();
		}
		this.next();	
	}
}

function SlideShowManager() {
	this['shows'] = new Array();
	SlideShowManager.prototype.createSlideShow = function(imgName) {
		var show = new MultiSlideShow(imgName);
		this.shows[this.shows.length] = show;
		return show;
	}
	SlideShowManager.prototype.run = function(imgName) {
		for (i = 0; i < this.shows.length; i++) {
			this.shows[i].changeImages();
		}
	}
}

