var iSlideshowWait = 5000;
var iSlideshowFadeDuration = 3;
var aSlideshowPictures = new Array();
var aSlideshowPreload = new Array();
var fSlideshowStarted = false;
var iSlideshowPicture = 0;

function SlideshowAddPicture( sPicture )
{
    aSlideshowPictures.push( sPicture );
}

function SlideshowInit()
{
    var i;

	for ( i = 0; i < aSlideshowPictures.length; i++ )
	{
	    aSlideshowPreload[ i ] = new Image();
	    aSlideshowPreload[ i ].src = aSlideshowPictures[ i ];
	}
}

function SlideshowRun()
{
	if ( fSlideshowStarted != false )
	{
		if ( document.all )
		{
			document.images.Slideshow.style.filter = 'blendTrans( duration = 2 )';
			document.images.Slideshow.style.filter = 'blendTrans( duration = iSlideshowFadeDuration )';
			document.images.Slideshow.filters.blendTrans.Apply();
		}
		document.images.Slideshow.src = aSlideshowPreload[ iSlideshowPicture ].src
		if ( document.all )
			document.images.Slideshow.filters.blendTrans.Play();

		iSlideshowPicture = iSlideshowPicture + 1;
		if ( iSlideshowPicture > aSlideshowPictures.length - 1 )
		    iSlideshowPicture = 0;

		setTimeout( 'SlideshowRun()', iSlideshowWait )
	}
}

function SlideshowStart()
{
	fSlideshowStarted = true;
	SlideshowRun();
}

function SlideshowStop()
{
	fSlideshowStarted = false;
}
