function SlideShow(container, width, height, options)

{

	if(!document.getElementById || !document.createElement)return;

	

	if (!options){options={};}

	this.delay = (options.delay || 2400);

	this.frameDelay = (options.frameDelay || 25);

	this.step = (options.step || 3);

	this.repeatFirstImage = (options.repeatFirstImage || true);

	this.current = 0;

	this.imgs = new Array();

	this.step = this.step/100;

	

	document.getElementById(container).style.position = 'relative';

	document.getElementById(container).style.width = width+'px';

	document.getElementById(container).style.height = height+'px';



	this.imgs = document.getElementById(container).getElementsByTagName("img");

	for(i=0;i<this.imgs.length;i++) {

		if (i!=0) {this.imgs[i].xOpacity = 0;}

		this.imgs[i].style.position = 'absolute';

		this.imgs[i].style.top = 0;

		this.imgs[i].style.left = 0;

	}

	this.imgs[0].style.display = "block";

	this.imgs[0].xOpacity = .99;

	var self = this;

	setTimeout(function(){self.xfade()},this.delay);

}



SlideShow.prototype =

{

	xfade: function ()

	{

		cOpacity = this.imgs[this.current].xOpacity;

		nIndex = this.imgs[this.current+1]?this.current+1:0;

		if (!this.repeatFirstImage && nIndex == 0) { nIndex=1;	}

		//if (nIndex == 0 && this.imgs.length > 1) window.location.href = "http://www.tcradmin.com/tcresidential.com/construction/index.php?project="+ project + "&carray="+ carray +"&idx=" + idx;

		nOpacity = this.imgs[nIndex].xOpacity;

		

		cOpacity-=this.step; 

		nOpacity+=this.step;

		

		this.imgs[nIndex].style.display = "block";

		this.imgs[this.current].xOpacity = cOpacity;

		this.imgs[nIndex].xOpacity = nOpacity;

		

		this.setOpacity(this.imgs[this.current]); 

		this.setOpacity(this.imgs[nIndex]);

		var self = this;

		if(cOpacity<=0) {

			this.imgs[this.current].style.display = "none";

			this.current = nIndex;

			

			setTimeout(function(){self.xfade()},this.delay);

		} else {

			

			setTimeout(function(){self.xfade()},this.frameDelay);

		}

	},



	setOpacity: function (obj)

	{

		if(obj.xOpacity>.99) {

			obj.xOpacity = .99;

			return;

		}

		obj.style.opacity = obj.xOpacity;

		obj.style.MozOpacity = obj.xOpacity;

		obj.style.filter = "alpha(opacity=" + (obj.xOpacity*100) + ")";

	}

}