captions = new Array();
captions[0] = 'Caption 1';
captions[1] = 'Caption 2';
captions[2] = 'Caption 3';
captions[3] = 'Caption 4';
captions[4] = 'Caption 5';
captions[5] = 'Caption 6';
captions[6] = 'Caption 7';
captions[7] = 'Caption 8';
captions[8] = 'Caption 9';
captions[9] = 'Caption 10';
captions[10] = 'Caption 11';
captions[11] = 'Caption 12';
captions[12] = 'Caption 13';
captions[13] = 'Caption 14';
captions[14] = 'Caption 15';
captions[15] = 'Caption 16';
captions[16] = 'Caption 17';
captions[17] = 'Caption 18';
captions[18] = 'Caption 19';
captions[19] = 'Caption 20';
captions[20] = 'Caption 21';
captions[21] = 'Caption 22';
captions[22] = 'Caption 23';
captions[23] = 'Caption 24';
captions[24] = 'Caption 25';
captions[25] = 'Caption 26';

function getPhoto(val)
{
	var total = 26; //document.galleryForm.photos.value;
	var current = val + 1;
	
	if (current == total) {
		var content_photo = '<a href="javascript: closePhoto()"><img src="photos/photo-' + current + '.jpg" alt="Photo"/></a>';
		var next = 'Next';
		var previous = '<a href="javascript: getPhoto(' + (val - 1) + ')">Previous</a>';
	}
	else if (current == 1) {
		var content_photo = '<a href="javascript: getPhoto(1)"><img src="photos/photo-' + current + '.jpg" alt="Photo"/></a>';
		var next = '<a href="javascript: getPhoto(1)">Next</a>';
		var previous = 'Previous';
	}
	else {
		var content_photo = '<a href="javascript: getPhoto(' + current + ')"><img src="photos/photo-' + current + '.jpg" alt="Photo"/></a>';
		var next = '<a href="javascript: getPhoto(' + current + ')">Next</a>';
		var previous = '<a href="javascript: getPhoto(' + (val - 1) + ')">Previous</a>';
	}
	
	var content_controls = previous + ' <span class="gray">|</span> ' + next + ' <span class="gray">|</span> <span class="photo-number">' + current + '</span> of <span class="photo-number">' + total + '</span> <span class="gray">|</span> <a href="javascript: closePhoto()">Close</a>';
	var content_caption_text = captions[val];
	var content_thumbs = '';
	
	for (i=1;i<=total;i++) {
		if (i == current) {
			content_thumbs += '<img src="smallthumbs/photo-' + i + '.jpg" alt="Photo" width="40" height="40"/>';
		} else {
			content_thumbs += '<a href="javascript: getPhoto(' + (i -1) + ')"><img src="smallthumbs/photo-' + i + '.jpg" alt="Photo" width="40" height="40"/></a>';
		}
		if (i == 13) {
			content_thumbs += '<br />';
		}
	}
	
	document.getElementById('photo').innerHTML = content_photo;
	document.getElementById('controls').innerHTML = content_controls;
	document.getElementById('caption_text').innerHTML = content_caption_text;
	document.getElementById('thumbs').innerHTML = content_thumbs;
	document.getElementById('flash').style.display='none';
	document.getElementById('gallery').style.display='block';
}
function closePhoto() {
	document.getElementById('gallery').style.display='none';
	document.getElementById('flash').style.display='block';
}