if (typeof Tran == 'undefined') {
	Tran = new Object();
}

Tran.Slideshow = function(id, imgs) {
	this.imgs = imgs;
	this.current = 0;
	this.container = id;
}

Tran.Slideshow.prototype.init = function() {
	this.imgTags = [];
	var container = document.getElementById(this.container);
	container.style.position = "relative";
	for (var i = 0; i < this.imgs.length; i++) {
		var img = document.createElement("img");
		img.src = this.imgs[i];
		img.id = this.container + "-img-" + i;
		img.style.position = "absolute";
		img.style.width = "505px";
		img.style.height = "305px";
		img.style.top = "0";
		img.style.left = "0";
		if (i != 0) {
			img.style.filter = "alpha(opacity=0)";
			img.style.opacity = "0";
		}
		this.imgTags.push(img.id);
		container.appendChild(img);
	}
	this.setupNext();
}

Tran.Slideshow.prototype.setupNext = function() {
	var _this = this;
	setTimeout(function() {_this.nextImage()}, 3000);

}

Tran.Slideshow.prototype.nextImage = function() {
	var _this = this;
	var imgOut = this.imgTags[this.current];
	var fadeOut = new YAHOO.util.Anim(imgOut,
	{ opacity: { to: 0 } }, 2, YAHOO.util.Easing.easeOut);
	fadeOut.animate();
	if ((this.current + 1) == this.imgs.length) {	
		this.current = 0;
	} else {
		this.current ++;
	}
	var imgIn = this.imgTags[this.current];
	var fadeIn = new YAHOO.util.Anim(imgIn,
		{ opacity: { to: 100} }, 2, YAHOO.util.Easing.easeIn);
	fadeIn.animate();
	this.setupNext();
	YAHOO.util.AnimMgr.fps = 15;

}

