function SlideShow(divPrefix, linkPrefix, delay, total) 
{
    this.divPrefix			= divPrefix;
    this.linkPrefix			= linkPrefix;
 	this.delay 				= delay;
	this.current 			= 1;
	this.totalSlides 		= total;
	this.inDIV				= "";
	this.rate 				= 0.1;
	this.outDIV				= "";
	this.curtimer			= null;
	this.curBox 			= null;
	this.inLink 			= null;
	this.outLink 			= null;
	
	this.currentIN = function () {
		curBox = document.getElementById(this.inDIV);
		curBox.style.opacity = parseFloat(curBox.style.opacity)+this.rate;
		if (parseFloat(curBox.style.opacity) > 1) {
		 	curBox.style.opacity = 1.0;
			this.startcurrent();	
		} else {
		  	this.curtimer 		= setTimeout(eval(divPrefix + "in"),20); // call fadein 20msec
		}
	}
	
	this.startcurrent = function () {  
		this.curtimer = setTimeout(eval(divPrefix + "nextFunction"),this.delay);
	}  
	
	this.nextCurrent = function () 
	{ 
		this.outDIV 	= this.divPrefix + this.current; 
		this.outLink 	= this.linkPrefix + this.current;
		this.current ++;
		if (this.current > this.totalSlides)  
			this.current = 1;
		this.inDIV 		= this.divPrefix + this.current;
		this.inLink 	= this.linkPrefix + this.current;
		this.currentOUT();
	}
	
	this.currentOUT = function() 
	{           
		// alert("[currentOUT] " + this.outDIV);
		var curBox = document.getElementById(this.outDIV);
		var str = curBox.className;
		curBox.style.opacity = parseFloat(curBox.style.opacity)-this.rate;
		if (parseFloat(curBox.style.opacity) <= 0) {
			curBox.style.opacity = 0.0;
			curBox.className = str.replace('show', 'hide');
			// link boxes 
			var linkBox 		= document.getElementById(this.outLink);
			linkBox.className 	= "";
			var nxtBox 			= document.getElementById(this.inDIV);
			str 				= nxtBox.className;
			nxtBox.className 	= str.replace('hide', 'show');
			// link boxes 
			linkBox 			= document.getElementById(this.inLink);
			linkBox.className 	= "on";
			this.curtimer 		= setTimeout(eval(divPrefix + "in"),20); 
		} else {
			this.curtimer 		= setTimeout(eval(divPrefix + "out"),20) // call fadeout 20msec
		}

	}

   

	
	
	this.showSlide = function (n) {
		clearTimeout(this.curtimer);
		// hide prev
		this.outDIV 	= this.divPrefix + this.current;
		this.outLink 	= this.linkPrefix + this.current;
		var curBox 		= document.getElementById(this.outDIV);
		curBox.style.opacity = 0.0;
		var str 		= curBox.className;
		curBox.className = str.replace('show', 'hide');
		// show new one
		this.current 	= n;
		this.inDIV 		= this.divPrefix + this.current;
		this.inLink 	= this.linkPrefix + this.current;
		var nxtBox 		= document.getElementById(this.inDIV);
		str 			= nxtBox.className;
		nxtBox.className = str.replace('hide', 'show');
		this.currentIN();
	}
	
   
}