/*  Slideshow.js:  Javascript function to display a single picture in a slideshow

	Copyright 2003 David J. Greer
*/

function writeTrailer()
{
	document.write('<p>');
	document.write('<div class="copyright">Copyright David J. Greer</div>');
	document.write('<p>');
	document.write('<hr>');
	document.write('<div class="navbar">');
	document.write('<a href="../../contact.html">');
	document.write('Contact</a>&nbsp;');
	document.write('<a href="http://www.flickr.com/djgreer">');
	document.write('Flickr</a>&nbsp;');
	document.write('<a href="../">');
	document.write('Gallery</a>&nbsp;');
	document.write('<a href="../../">');
	document.write('Home</a>&nbsp;');
	document.write('<a href="../../profile.html">');
	document.write('Profile');
	document.write('</div>');
}

function fmtNumAsString(aNumber)
{
	var result = "";
	
	if (aNumber < 10)
	{
		result = "0" + aNumber;
	}
	else
	{
		result = aNumber;
	}

	return result;
}

function writeButtons(galleryName, pictureNumber, pictureCount)
{
	if (pictureNumber == 1) { // Previous is the last one
		document.write('<a href="' + galleryName + fmtNumAsString(pictureCount) + '.html"><img src="../buttons/prev.gif" width="18"></a>')
	}
	else {
		document.write('<a href="' + galleryName + fmtNumAsString(pictureNumber - 1) + '.html"><img src="../buttons/prev.gif" width="18"></a>')
	}
	if (pictureNumber == pictureCount)     //  Next is first of the set
	{
		document.write('<a href="' + galleryName + "01" + '.html"><img src="../buttons/next.gif" width="18"></a>')
	}
	else
	{
		document.write('<a href="' + galleryName + fmtNumAsString(pictureNumber + 1) + '.html"><img src="../buttons/next.gif" width="18"></a>')
	}
}

function showOne(fileName, pictureCaption, galleryName, pictureNumber, pictureCount)
{
	document.write('<p align=center>');
	document.write('Picture ' + pictureNumber + ' of ' + pictureCount);
	document.write('<br>');
	writeButtons(galleryName, pictureNumber, pictureCount);
	document.write('<p align=center>');   
	document.write('<img src="' + fileName + '"><br>');
	document.write(pictureCaption);
	document.write('<p align=center>');
	document.write('Picture ' + pictureNumber + ' of ' + pictureCount);
	document.write('<br>');   
	writeButtons(galleryName, pictureNumber, pictureCount);

}

