function Slideshow(img, timeout, duration) {
	this.imgA = $(img);
	this.timeout = (timeout) ? timeout : 5000;
	this.duration = (duration) ? duration : 1000;
	this.images = new Array();
	this.index = 0;

	if(!window._slideshow) window._slideshow = new Array();
	this.id = window._slideshow.length;
	window._slideshow[this.id] = this;

	this.timer;

	this.addImage = function(src) {
		var i = new Image();
		i.src = src;
		this.images.push(i);
	}



	this.go = function() {

		clearTimeout(this.timer);
		this.timer = setTimeout("window._slideshow["+this.id+"]._rotate();", this.timeout);
	}
	this._rotate = function() {
		if(this.imgB) document.body.removeChild(this.imgB);

		this.imgB = document.createElement('img');
		this.imgB.setAttribute('width', this.imgA.getAttribute('width'));
		this.imgB.setAttribute('height', this.imgA.getAttribute('height'));
		this.imgB.style.position = 'absolute';
		this.imgB.style.display = '';
		this.imgB.style.top = this.imgA.getTop() + 'px';
		this.imgB.style.left = this.imgA.getLeft() + 'px';
		this.imgB.src = this.imgA.src;
		document.body.appendChild(this.imgB);
		this.imgB = $(this.imgB);

		var nextimg = this.images[this.index];
		if(++this.index >= this.images.length) this.index = 0;

		this.imgA.src = nextimg.src;

		this.imgB.effect('opacity', 
			{
				duration: this.duration,
				onComplete: function() {
					this.element.style.display = 'none';
				}
			}
		).custom(1, 0.01);

		this.go();

	}


}