//SCRIPT LANGUAGE="JavaScript"

// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5000; 
var slideShowSpeedLgt; 

// Duration of crossfade (seconds)
var crossFadeDuration = 1.8;

// Load Image File and Setup SHow
var TimeoutId;
var ShowStatus = "RUN";
var CurPic = 0;
var CurPic2 = 0; // Added on 12th March
var p = Pic.length;
var preLoad = new Array();
for (i = 0; i < p; i++) 
{
	preLoad[i] = new Image();
	preLoad[i].src = Pic[i];
}


function runSlideShow() 
{
	clearTimeout(TimeoutId);
	
	if ( ShowStatus == "RUN" ) 
	{
		if (document.all) 
		{
			document.images.SlideShow.style.filter = "blendTrans";
			document.images.SlideShow.filters.blendTrans.duration = crossFadeDuration;
			document.images.SlideShow.filters.blendTrans.Apply();
		}
		
		document.images.SlideShow.src = preLoad[CurPic].src;
		
		if (document.all) 
			document.images.SlideShow.filters.blendTrans.Play();
		
		CurPic = CurPic + 1;
		
		if (CurPic > (p - 1)) 
			CurPic = 0;
	}
	else
	{
		ShowStatus = "RUN";
	}
	TimeoutId = setTimeout('runSlideShow()', slideShowSpeed);
}
// Added on 12th March 2004
function runSlideShowForLighting() 
{
	clearTimeout(TimeoutId);
	
	if ( ShowStatus == "RUN" ) 
	{
		if (document.all) 
		{
			document.images.SlideShow.style.filter = "blendTrans";
			document.images.SlideShow.filters.blendTrans.duration = crossFadeDuration;
			document.images.SlideShow.filters.blendTrans.Apply();
		}
		
		document.images.SlideShow.src = preLoad[CurPic].src;
		
		if (document.all) 
			document.images.SlideShow.filters.blendTrans.Play();
		
		if (CurPic == 1)
		{
			slideShowSpeedLgt = 15000
		}
		else
		{
			slideShowSpeedLgt = 5000
		}	
		
		CurPic = CurPic + 1;
		
		if (CurPic > (p - 1)) 
			CurPic = 0;
	}
	else
	{
		ShowStatus = "RUN";
	}
	
	TimeoutId = setTimeout('runSlideShowForLighting()', slideShowSpeedLgt);
}

function DisplayImage(i)
{
	StopShow();
		if (document.all) 
		{
			document.images.SlideShow.style.filter = "blendTrans";
			document.images.SlideShow.filters.blendTrans.duration = crossFadeDuration;
			document.images.SlideShow.filters.blendTrans.Apply();
		}
	CurPic = i;
	document.images.SlideShow.src = preLoad[CurPic].src;
	if (document.all) 
		document.images.SlideShow.filters.blendTrans.Play();
	CurPic = CurPic + 1;
	if (CurPic > (p - 1)) 
		CurPic = 0;
}


function ShowHideIndex()
{
	IndexDiv = document.getElementById("indexdiv");
	if ( IndexDiv.style.top == "-200px" )
	{
		document.images.BtnIndex.src = "images/BtnIndexOn.gif";
		IndexDiv.style.top = "40px";
	}
	else
	{
		document.images.BtnIndex.src = "images/BtnIndexOff.gif";
		IndexDiv.style.top = "-200px";
	}
}


function PlayShow()
{
	ShowStatus = "RUN";
	document.images.BtnPlay.src = "images/BtnPlayOn.gif";
	document.images.BtnStop.src = "images/BtnStopOff.gif";
	runSlideShow();
}


function StopShow()
{
	clearTimeout(TimeoutId);
	ShowStatus = "STOP";
	document.images.BtnPlay.src = "images/BtnPlayOff.gif";
	document.images.BtnStop.src = "images/BtnStopOn.gif";
}


function ToggleShow()
{
	if ( ShowStatus == "RUN" ) 
		StopShow();
	else
		PlayShow();
}
