//var iPath	=	"images/large/";							// path to folder with IMAGES *** moved to each gallery js file
var count 	= 	0;											// zero out the slideShow			

// counting which image to show. 
// => YOU HAVE TO add the total number of images minus 2 in the first IF statement
function slideShow(direction) {
	
	var total	=	image.length-2;							// calculate the total items in the image array -2.
	
	if (direction == 'next' && count <= total) {
 		count++
 		}
	if (direction == 'back' && count >= 1) {
 		count --;
 		}
	}   


// this is for the PREVIOUS and NEXT buttons
// you need the jquery.js already loaded for the following functions to work.
$(document).ready(function(){
	
	$("#photo").attr("src", iPath + image[count]);			// this is the first image SOURCE
	$("#photo").attr("alt", image[count]);			// this is the first image ALT TEXT

	
	$("#gallery a")
	
	.filter("#back")
		.click(function(){
			// alert("you need to load the former image.");
			$("#photo").attr("src", iPath + image[count]);	// result of the above slideShow function SOURCE
			$("#photo").attr("alt", image[count]);	// result of the above slideShow function ALT TEXT

		})
	.end()
	
	.filter("#next")
		.click(function(){
			// alert("you need to load the next image.");
			$("#photo").attr("src", iPath + image[count]);	// result of the above slideShow function SOURCE
			$("#photo").attr("alt", image[count]);	// result of the above slideShow function ALT TEXT
		})
	.end();
});