//Begin JScript

function objSlideshow(strThisObj, strImgId, intIntrvl)
{
	//public properties
	this.strThisObject	= strThisObj;
	this.strSlideshowId	= strImgId;
	this.intInterval	= intIntrvl;
	this.arrSlides		= new Array();
	this.intSlideIndex	= -1;
	this.theTimer;

	//public method prototypes
	this.add	= fnAdd;
	this.showNext	= fnShowNextSlide;
	this.start	= fnStartSlideshow;
	this.pause	= fnPauseSlideshow;
	this.stop	= fnStopSlideshow;


	//Construction
	//alert(this.strSlideshowId);
	//alert(document.getElementById(this.strSlideshowId));
	document.getElementById(this.strSlideshowId).style.visibility = "hidden";
}


function fnAdd(strImagePath)
{
	var intNewIndex		= this.arrSlides.length;

	for(var index = 0; index < intNewIndex; index++)
	{
		if((this.arrSlides[index].src).toLowerCase() == strImagePath.toLowerCase())
		{
			return;
		}
	}

	this.arrSlides[intNewIndex]		= new Image();
	this.arrSlides[intNewIndex].src		= strImagePath;

}


function fnShowNextSlide()
{
	var len		= this.arrSlides.length;

	this.intSlideIndex	= (len + this.intSlideIndex + 1) % len;
	
	document.getElementById(this.strSlideshowId).src		= this.arrSlides[this.intSlideIndex].src;
	document.getElementById(this.strSlideshowId).style.visibility	= "visible";
}

function fnStartSlideshow()
{
	var strEval = 'this.timer = setInterval("' +this.strThisObject+ '.showNext()", ' +this.intInterval+ ')';
	//alert(strEval);
	
	eval(strEval);
}

function fnPauseSlideshow()
{
	var strEval = 'clearInterval(' +this.strThisObject+ '.timer)';
	//alert(strEval);

	eval(strEval);
}

function fnStopSlideshow()
{
	var strEval = 'clearInterval(' +this.strThisObject+ '.timer)';
	//alert(strEval);

	eval(strEval);
	this.intSlideIndex = -1;
}

//End JScript