function SlideShow(container, width, height){
if(!document.getElementById || !document.createElement)return;
	
this.delay = 4000;
this.frameDelay = 50;
this.step = 5;
this.repeatFirstImage = true;
this.current = 0;
this.imgs = new Array();
this.step = this.step/100;

var cont = document.getElementById(container);
cont.style.position = 'relative';
cont.style.width = width+'px';
cont.style.height = height+'px';

this.imgs = cont.getElementsByTagName("img");

var imgs_num = this.imgs.length;
for(i=0; i<imgs_num; 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;}
	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.KhtmlOpacity = obj.xOpacity;
	obj.style.filter = "alpha(opacity=" + (obj.xOpacity*100) + ")";
}
}

function opacity(id, opacStart, opacEnd, millisec) {
var speed = Math.round(millisec / 100);
var timer = 0;

if(opacStart > opacEnd) {
for(i = opacStart; i >= opacEnd; i--) {
	setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
	timer++;
	}
} else if(opacStart < opacEnd) {
for(i = opacStart; i <= opacEnd; i++){
	setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
	timer++;
	}
}
}

function changeOpac(opacity, id) {
var object = document.getElementById(id).style;
object.opacity = (opacity / 100);
object.MozOpacity = (opacity / 100);
object.KhtmlOpacity = (opacity / 100);
object.filter = "alpha(opacity=" + opacity + ")";
}

