
function SlideShow(slideList, image, speed, name) {
	this.slideList = slideList;
	this.image = image;
	this.speed = speed;
	this.name = name;
	this.current = 0;
	this.timer = 0;
}

SlideShow.prototype.play = function() {
		
		if(this.current++ == (this.slideList.length - 1)) {
			this.current = 0;
		}
		this.switchImage(this.image, this.slideList[this.current]);
		clearTimeout(this.timer);
		this.timer = setTimeout(this.name+'.play()', this.speed);
} 

SlideShow.prototype.switchImage = function (id, nImg) {

	var obj = document.getElementById(id);
	if (obj) 
			obj.src = nImg;
} 

