function slideshow(img_path, imgs) {
	this.img_path = img_path;
	this.imgs = imgs;
	this.holders = new Array();
	this.width = 200;
	this.height = 200;
	this.fade_speed = 1;
	this.img_duration = 4000;

	this.initialize = function(w, h, f, d) {
		var i_reform = this.imgs.replace(" ", "");
		this.imgs = i_reform.split(",");
		this.preload_images();
		if (w) {
			this.width = w;
		} // end if
		if (h) {
			this.height = h;
		} // end if
		if (f) {
			this.fade_speed = f;
		} // end if
		if (d) {
			this.img_duration = d;
		} // end if
		document.write("<style>\n");
		document.write(".shown { position: absolute; visibility: visibilty; z-index: 5; }\n");
		document.write(".notshown { position: absolute; visibility: visible; z-index: 2; }\n");
		document.write("</style>\n");
		this.show_slideshow();
	} // end initialize

	this.preload_images = function() {
		for (i=0;i<this.imgs.length;i++) {
			// alert(this.imgs[i]);
			this.holders[i] = new Image();
			this.holders[i].src = this.img_path+this.imgs[i];
		} // end for
	} // end preload_images

	this.show_slideshow = function() {
		document.write("<img src='"+this.img_path+this.imgs[0]+"' id='slides_back' width='"+this.width+"' height='"+this.height+"' class='notshown' border='0'>\n");
		document.write("<img src='"+this.img_path+this.imgs[0]+"' id='slides' width='"+this.width+"' height='"+this.height+"' class='shown' border='0'>\n");
		this.start_show("slides", "slides_back", 0);
 	} // end show_slideshow

	this.start_show = function(objId, obj2Id, idx) {
		var ms = this.img_duration;
		var _self = this;
		if (idx == (this.imgs.length-1)) {
			idx = 0;
		} else {
			idx++; 
		} // end if

		var front = document.getElementById(objId);
		var back = document.getElementById(obj2Id);
		back.src = this.img_path+this.imgs[idx];

		this.fade_in(obj2Id, 0);
		this.fade_out(objId, 100);
		
		setTimeout(function(ms) { _self.start_show(obj2Id, objId, idx);}, ms);
	} // end start_show

	this.fade_in = function(objId, o) {
		// alert(o);
		var ms = this.fade_speed;
		var _self = this;
		if (o>=100) { 
			if (navigator.appName.indexOf("Internet Explorer") != -1) {
				document.getElementById(objId).style.filter="alpha(opacity="+o+")";
			} else {
				document.getElementById(objId).style.opacity = (o/100);
			} // end if
		} else {
			if (navigator.appName.indexOf("Internet Explorer") != -1) {
				document.getElementById(objId).style.filter="alpha(opacity="+o+")";
			} else {
				document.getElementById(objId).style.opacity = o/100;
			} // end if
			// setTimeout("this.fade_in('"+objId+"', "+(o+1)+")", this.fade_speed);
			setTimeout(function(ms) { _self.fade_in(objId, (o+1)); }, ms);
		} // end if		
	} // end fade_in

	this.fade_out = function(objId, o) {
		// alert(o);
		var ms = this.fade_speed;
		var _self = this;
		if (o<=0) {
			if (navigator.appName.indexOf("Internet Explorer") != -1) {
				document.getElementById(objId).style.filter="alpha(opacity="+o+")";
			} else {
				document.getElementById(objId).style.opacity = o/100;
			} // end if
		} else {
			if (navigator.appName.indexOf("Internet Explorer") != -1) {
				document.getElementById(objId).style.filter="alpha(opacity="+o+")";
			} else {
				document.getElementById(objId).style.opacity = o/100;
			} // end if
			// setTimeout("this.fade_out('"+objId+"', "+(o-1)+")", this.fade_speed);
			setTimeout(function(ms) { _self.fade_out(objId, (o-1));}, ms);
		} // end if
	} // end fade_out

} // end slideshow