// Photo javascript

// FUNCTION change_photo - Page needs to set these var:
//	1) photo_number - the array element to get the specific photo from the array
//	2) photos[] the array of all the photo URLs
//	3) captions[] a corresponding array of captions for each photo.

function change_photo(label,set) {

	// This function works for one photo per page. 
	// UNLESS a different label is used for the div IDs suffix
	// "photo{suffix}" and "caption{suffix}" and fixed array names photos[] and captions[]

	//lert("function change_photo set:" + set + " photos:" + photos);

	photo_number++;
	// Don't step past the last photo in the array

	if(set=='') {
		photo_set=photos;
	} else {
		photo_set=photos[set];	
	}

	if(label=='') {
		caption_set=captions;
	} else {
		caption_set=captions[set];
	}


	if (photo_number>=photo_set.length) {photo_number=0;}
	main_photo=photo_set[photo_number];
	main_caption="<H2>"+caption_set[photo_number]+"</H2>";

	$('#caption'+label).html(main_caption);
	$("#photo"+label).attr("src",main_photo);

	//lert("Changing the photo on the page to " + main_photo + " and the caption to " + main_caption);

}


