// JavaScript Document

/*****************************************************************************/
// FOR THE SLIDESHOW.

<!-- Begin
var slideShowSpeed = 6000; // Slideshow speed (milliseconds)
var crossFadeDuration = 3; // Duration of crossfade (seconds)

// The photos.
var pic = new Array();

pic[0] = 'images/about_event_slideshow/img1.jpg'
pic[1] = 'images/about_event_slideshow/img2.jpg'
pic[2] = 'images/about_event_slideshow/img3.jpg'
pic[3] = 'images/about_event_slideshow/img4.jpg'
pic[4] = 'images/about_event_slideshow/img5.jpg' // The final image. The slideshow then stops, ready to go again. Make sure this is always the last image.

// The photo captions.
var captions = new Array();

captions[0] = "Runners on the Marina wall"
captions[1] = "River Board Walk"
captions[2] = "River Crossing"
captions[3] = "Marina Village"
captions[4] = "Finish Area" // The last caption should always be left blank!

var t;
var	j = 0;
var p = pic.length;
var preLoad_pic = new Array();
var photoCaption = "";

for (i = 0; i < p; i++)
{
	preLoad_pic[i] = new Image();
	preLoad_pic[i].src = pic[i];
}

function runSlideShow()
{
	if (document.all)
	{
		document.images.SlideShow.style.filter="blendTrans(duration=2)";
		document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
		document.images.SlideShow.filters.blendTrans.Apply();

		document.forms[0].photoCaption.style.filter="blendTrans(duration=2)";
		document.forms[0].photoCaption.style.filter="blendTrans(duration=crossFadeDuration)";
		document.forms[0].photoCaption.filters.blendTrans.Apply();
	}
	
	document.images.SlideShow.src = preLoad_pic[j].src;
	document.forms[0].photoCaption.value = captions[j];
	
	if (document.all)
	{
		document.images.SlideShow.filters.blendTrans.Play();
		document.forms[0].photoCaption.filters.blendTrans.Play();
	}
	j = j + 1;
	
	// This will run the slideshow only once and finish on the last image, which is the slideshow title. 
	// It sets 'j' to zero so if the image is clicked again, it will start the slideshow back over.
	if (j < p)
	{
	  t = setTimeout('runSlideShow()', slideShowSpeed);
	}
	else
	{
		j = 0;
		t = setTimeout('runSlideShow()', slideShowSpeed);
	}
	
}

//  End -->


/******************************************************************************/
// UNUSED FUNCTIONS.

// Function for image rollovers.
function swapImage(img, pathToImage)
{
	img.src = pathToImage;
}

// This function accepts an image and its size and opens a new correctly sized window with that image in it.
function showLargeImage(img, width, height)
{	
	// Set new dimensions which allows for window margin.
	newWidth = width + 20;
	newHeight = height + 20;
	features = 'width=' + newWidth + ', height=' + newHeight + ', scrollbars=no, resizable=no, top=10, left=10';
	
	// Open the new window.
	newwindow = window.open(img, 'name', features);
	if (window.focus) {newwindow.focus()}
}


