function ImageShow(name, id, time) {
	this.name = name;
	this.showDiv = document.getElementById(id);
	this.showImg = document.createElement("img");
	this.showImg.zindex = "2";
	this.showDiv.appendChild(this.showImg);
	this.images = [];
	this.i = 0;
	this.time = time;
}

ImageShow.prototype.addImage = function(imgURL) {
	var img = new Image();
	img.src = imgURL;
	this.images.push(img);
}

ImageShow.prototype.startChange = function() {
	this.step = 0.05;
	this.opacity = 0;
	this.tdelay = 15;

	this.img2 = new Image();
	this.img2.id = "img2";
	this.img2.src = this.images[this.i].src;
	this.img2.zindex = "3";
	this.img2.style.visibility = "hidden";
	this.showDiv.appendChild(this.img2);

	this.img2.style.opacity = this.opacity;
	opactityIE = this.opacity * 100;
	this.img2.style.filter = "alpha(opacity=" + opactityIE + ")";
	this.img2.style.visibility = "visible";
	window.setTimeout(this.name + ".midChange()", this.tdelay);
}

ImageShow.prototype.midChange = function() {
	this.opacity += this.step;
	this.img2.style.opacity = this.opacity;
	opactityIE = this.opacity * 100;
	this.img2.style.filter = "alpha(opacity=" + opactityIE + ")";
	if(this.opacity < 1) {
		window.setTimeout(this.name + ".midChange()", this.tdelay);
	} else {
		this.endChange();
	}
}

ImageShow.prototype.endChange = function() {
	this.showImg.src = this.img2.src;
	this.showDiv.removeChild(this.img2);
}

ImageShow.prototype.changeImage = function() {
	this.startChange();
}

ImageShow.prototype.start = function() {
	this.showImg.src = this.images[0].src;
	window.setTimeout(this.name + ".next()", this.time);
}

ImageShow.prototype.next = function() {
	this.i++;
	if(this.i >= this.images.length) {
		this.i = 0;
	}
	this.changeImage();
	window.setTimeout(this.name + ".next()", this.time);
}

/*usage
function init() {
	s = new ImageShow("s", "show1", 3000);
	s.addImage("pic01.jpg");
	s.addImage("pic02.jpg");
	s.start();
}
*/
