
var slideShowSpeed = 3000;
var crossFadeDuration = 3;
var Pic = new Array();

var ImageToShow = new Array();
var preLoad = new Array();
var valid = new Array();
var SlideShowToRun=-1;
var IMGName="LLImage";
var SlideShowName = new Array();
var indexSlideShow=-1;
var SlideShowRunning=0;
var PreLoadImageNotFound;
var ImageNotFound;
var TimerID=null;
var SummarySlideShow=0;

function AddImage(ImageName)
{
	if(ImageNotFound==null)
	{
		PreLoadImageNotFound = new Image();	
		PreLoadImageNotFound.src='/media/757/imagenotfound.jpg';
		ImageNotFound='/media/757/imagenotfound.jpg';
	}

	if(Pic[indexSlideShow]==null)
	{
		valid[indexSlideShow]=1;
		ImageToShow[indexSlideShow]=0;
		Pic[indexSlideShow] = new Array();
		preLoad[indexSlideShow] = new Array();
	}
	
	Pic[indexSlideShow].push(ImageName);
	preLoad[indexSlideShow][Pic[indexSlideShow].length-1]= new Image();
	preLoad[indexSlideShow][Pic[indexSlideShow].length-1].src=ImageName;
}

function AddLift(Lift)
{
	index=0;
	indexSlideShow++;	
	SlideShowName[indexSlideShow]=Lift;
}


function FadeImage(PicLoad)
{
	UseImage=PicLoad;


	if (document.all) 
	{
		document.images[IMGName].style.filter="blendTrans(duration=2)";
		document.images[IMGName].style.filter="blendTrans(duration=crossFadeDuration)";
		document.images[IMGName].filters.blendTrans.Apply();

	}
	document.images[IMGName].src = preLoad[SlideShowToRun][UseImage].src;
	if (document.all) 
	{
		document.images[IMGName].filters.blendTrans.Play();
	}
}

function StartSlideShow()
{
	if(TimerID!=null)
	{
		clearTimeout(TimerID);
		TimerID=null;
	}	

	runSlideShow();
}

function ChooseSlideShow(Index)
{
	if(Index=="SummarySlideShow")
	{
		SummarySlideShow=1;
		SlideShowToRun=0;
		ImageToShow[SlideShowToRun]=0;
		
		StartSlideShow();
	}
	else
	{
		for(i=0; i<=indexSlideShow; i++)
		{
			if(Index==SlideShowName[i])
			{
				if(i!=SlideShowToRun)
				{
	
					SummarySlideShow=0;
					SlideShowToRun=i;
					ImageToShow[SlideShowToRun] = 0;

					StartSlideShow();
		
					document.getElementById('LLTitle').innerHTML = Index;
	
					i=indexSlideShow+1;
				}
			}
		}
	}

	if(Pic[SlideShowToRun]==null)
	{
		document.images[IMGName].src = ImageNotFound;
		document.images[IMGName].filters.blendTrans.Play();
	}	
}

function IncrementImage()
{
	if(SummarySlideShow==1)
	{
		SlideShowToRun++;
		if(SlideShowToRun>indexSlideShow)
			SlideShowToRun=0;
		ImageToShow[SlideShowToRun] = 0;

	}
	else
	{
		ImageToShow[SlideShowToRun] = ImageToShow[SlideShowToRun] + 1;
		if (ImageToShow[SlideShowToRun] > (Pic[SlideShowToRun].length-1)) 
			ImageToShow[SlideShowToRun] = 0;
	}
}


function runSlideShow() 
{

		if(valid[SlideShowToRun]==1)
		{
			FadeImage(ImageToShow[SlideShowToRun]);
			if(SummarySlideShow==1)
				document.getElementById('LLTitle').innerHTML = SlideShowName[SlideShowToRun];			
			IncrementImage();
		}

		TimerID = setTimeout('runSlideShow()', slideShowSpeed);
}

