// JavaScript Document
// title eofe.js
// Author C J Curtis


 //Initialise a new Array and populate it with image paths.



	var  theShow=["images/slideshow/19.jpg","images/slideshow/35.jpg","images/slideshow/36.jpg","images/slideshow/37.jpg","images/slideshow/38.jpg","images/slideshow/01.jpg","images/slideshow/02.jpg","images/slideshow/04.jpg","images/slideshow/05.jpg","images/slideshow/06.jpg","images/slideshow/07.jpg","images/slideshow/08.jpg","images/slideshow/09.jpg","images/slideshow/10.jpg","images/slideshow/11.jpg","images/slideshow/12.jpg","images/slideshow/13.jpg","images/slideshow/14.jpg","images/slideshow/15.jpg","images/slideshow/16.jpg","images/slideshow/17.jpg","images/slideshow/18.jpg","images/slideshow/20.jpg","images/slideshow/21.jpg","images/slideshow/22.jpg","images/slideshow/23.jpg","images/slideshow/24.jpg","images/slideshow/25.jpg","images/slideshow/26.jpg","images/slideshow/27.jpg","images/slideshow/28.jpg","images/slideshow/29.jpg","images/slideshow/30.jpg","images/slideshow/31.jpg","images/slideshow/32.jpg","images/slideshow/33.jpg","images/slideshow/34.jpg","images/slideshow/transparent.gif"];
	  
	  //Preload the images.
	  
	 var imgs = [];									//Declare an empty array
	  for(var i=0; i<theShow.length; i++)	{		//Loop through theShow array, populate with image spaces and then fill with images.
		  imgs[i]= new Image(600,400);
		  imgs[i].src = theShow[i];
	  }
	  	 
/******************************************************************************************
		*Function:  changeShow(direction)	Accessed from gallery.html
		*Purpose:	Drives the wraparound slide show.
		*Input:		+1 or -1 for direction of show.
		*Output:	Displays a new image in the "viewport" area. The image index is incremented up or down.
		*Author:	C J Curtis.
		*Date:		18-4-07.
		*Notes:		The structure of the coding was taken from Negrino and Smith pp92 
					"Javascript: 5th edition." PeachPit Press 2004.
					The coding was adapted by me to include variable names that are
					more meaningful. Images are loaded into an array.
		
 *****************************************************************************************/
 
var currentpic=0;	//this index will be used to access the array content.
var picCt=imgs.length-1;	//sets counter to true number of items in array.
						//Length is 1 relative, whilst arrays are zero relative. 	
						
function changeShow(direction)	{ //receives parameter of either 1 or -1 from function calls.


	if(document.images) {		//Test to check browser can handle images.
		
		currentpic=currentpic+direction;//change the index (increase or decrease).
		
		if(currentpic>picCt) { //start from beginning if end passed.
			currentpic=0;
		}
		
		if(currentpic<0) { //start from end if beginning passed.
			currentpic=picCt;
		}
		
		document.nowShowing.src=imgs[currentpic].src;	//show the image..."nowShowing" is the name of the image space... gallery.html
	}
}

/******************************************************************************************
		*Function:  noImage()	Accessed from gallery.html
		*Purpose:	Restores the slideshow to no image displayed.
		*Input:		
		*Output:	
		*Author:	C J Curtis.
		*Date:		10.3.09
		*Notes:		References the Array address that containe the
					transparent gif file (false image). Allows the
					background to show through.
		
 *****************************************************************************************/

function noImage()	{
	
	if(document.images)	{
		
		document.nowShowing.src = "images/slideshow/transparent.gif";	//Display the transparent gif.
	}
}

