var currentPicture = 1;
var totalPictures = 22;

var pictureDescription = new Array(23); 
pictureDescription[0] = ""; 
pictureDescription[1] = "Gilligan with the first catch of the trip!"; 
pictureDescription[2] = "The Skipper too!";
pictureDescription[3] = "Greg's big Walleye.";
pictureDescription[4] = "This one is coming home with me.";
pictureDescription[5] = "Billy Big-ass bass that also went home with Greg.";
pictureDescription[6] = "Chris demonstrates his fishmonger skills.";
pictureDescription[7] = "Chris 'The Butcher' Peres cleaning his kill.";
pictureDescription[8] = "Fillet #1.";
pictureDescription[9] = "Fillet #2.";
pictureDescription[10] = "This is what the inside of a fish looks like.";
pictureDescription[11] = "Another gore shot for the sick people out there.";
pictureDescription[12] = "Chris and Dave fishing off in the distance.";
pictureDescription[13] = "Silently fishing unaware of our approach.";
pictureDescription[14] = "We have been spotted!";
pictureDescription[15] = "They return to their barbaric hunt for fish.";
pictureDescription[16] = "Greg and Dad fishing the wrong way. This is how you get 'The Big Ones'.";
pictureDescription[17] = "Fake fishing shots.  No one accept the 'Dumbasses 09/01' still fish!";
pictureDescription[18] = "More fake fishing shots of Greg and Dad.";
pictureDescription[19] = "Results of real fishing!";
pictureDescription[20] = "More results!";
pictureDescription[21] = "Our uninvited house mate.";
pictureDescription[22] = "Mickey loves Nutella!";

function checkNumeric()
{
	var key = window.event.keyCode;
	theString = String.fromCharCode(key);
	if ( key > 47 && key < 58 ) return;
   	else
   	{
   		changeAlert("<b>'" + theString + "' is <i>NOT</i> a number. Please try again.</b>");
   		window.event.returnValue = null;
   	}
}

function getElement(id)
{
	return document.getElementById ? document.getElementById(id) : document.all ? document.all(id) : null;
}

function changeCounter(counterNumber)
{
	var anElement = getElement("theCounter");
	if (anElement && typeof anElement.innerHTML != 'undefined') 
	{
		anElement.innerHTML = "Fishing Photo #" + counterNumber + " of "+ totalPictures +".";
	}
}

function changeMessage(theMessage)
{
	var anElement = getElement("theMessage");
	if (anElement && typeof anElement.innerHTML != 'undefined') 
	{
		anElement.innerHTML = theMessage;
	}
}

function changeAlert(alertMessage)
{
	var anElement = getElement("anAlert");
	if (anElement && typeof anElement.innerHTML != 'undefined') 
	{
		anElement.innerHTML = alertMessage;
	}
}

function home()
{
	currentPicture = 1;
	document.FishingPhotos.thePicture.src = "/images/Fishing2003/TheFish2003/" + currentPicture + ".jpg";
	changeCounter(currentPicture);
	changeMessage(pictureDescription[currentPicture]);
	changeAlert("&nbsp;");
	document.FishingPhotos.jumpTo.value = "";
}

function next()
{
	currentPicture++;
	if(currentPicture > totalPictures) currentPicture = 1;
	document.FishingPhotos.thePicture.src = "/images/Fishing2003/TheFish2003/" + currentPicture + ".jpg";
	changeCounter(currentPicture);
	changeMessage(pictureDescription[currentPicture]);
	changeAlert("&nbsp;");
	document.FishingPhotos.jumpTo.value = "";
}

function previous()
{
	currentPicture--;
	if(currentPicture < 1) currentPicture = totalPictures;
	document.FishingPhotos.thePicture.src = "/images/Fishing2003/TheFish2003/" + currentPicture + ".jpg";
	changeCounter(currentPicture);
	changeMessage(pictureDescription[currentPicture]);
	changeAlert("&nbsp;");
	document.FishingPhotos.jumpTo.value = "";
}

function jumpToPicture()
{
	var imageNumber = document.FishingPhotos.jumpTo.value;
	
	// Check to make sure the image is in the correct range.
	if ((imageNumber > totalPictures) || (imageNumber < 1))
	{
		changeAlert("<b>Please enter a number between <i>1 and " + totalPictures + "</i>.</b>");
		document.FishingPhotos.jumpTo.value = "";
	}
	else
	{
		document.FishingPhotos.thePicture.src = "/images/Fishing2003/TheFish2003/" + imageNumber + ".jpg";
		changeCounter(imageNumber);
		changeMessage(pictureDescription[document.FishingPhotos.jumpTo.value]);
		changeAlert("&nbsp;");
		document.FishingPhotos.jumpTo.value = "";
	}
}
