





function prepareGallery()	{
	/* check the browser is capable of recognising the DOM objects
	   we need to implement the script - otherwise return false and allow the normal link to be executed */
	if(!document.getElementsByTagName) return false;
	if(!document.getElementById) return false;
	if(!document.getElementById("galleryThumbnails")) return false;

	
	/* get the reference to the menuSlide object and then create an array 
	   of all the <a> tags found in the array. To each tag assign a function to
	   the onclick method - which calls the showPic function. */
	   
	var gallery = document.getElementById("galleryThumbnails");
	var links = gallery.getElementsByTagName("img");

	for(i = 0; i < links.length; i++) {
		
		links[i].onclick = function() {
			
			//alert(this)

			return showPic(this);

		}
		

		
	}
	
	


	
	
}



function showPic(whichPic)  {

	/* If we don't find an image with the unique id then exit the function */
	if(!document.getElementById("galleryImage")) return true;	
	
	
	/* get the id attribute which contains the actual image filename we want to display,
	   and then get the reference to the actual image object itself */
	   
	var imageSource = whichPic.getAttribute("id");
	var displayImage = document.getElementById("galleryImage")

	/* finally go get the new image and change the src attribute, together with the corresponding caption */
	   
	displayImage.setAttribute("src", "dynamic/largeImages/" + Slides[imageSource] + ".jpg");
	document.getElementById("galleryCaption").firstChild.nodeValue = Captions[imageSource]
	
	return true;
	
}
