var currentPicture = 1;
var totalPictures = 22;

var pictureDescription = new Array(23); 
pictureDescription[0] = ""; 
pictureDescription[1] = "Eaton Lake cabin.  Home for 7 days."; 
pictureDescription[2] = "Trees and bugs surround the cabin.";
pictureDescription[3] = "No blue berries in the area. :(";
pictureDescription[4] = "The dock.";
pictureDescription[5] = "The dock and a boat. WOW!";
pictureDescription[6] = "The beach.  Blood suckers await you!";
pictureDescription[7] = "The crapper.  Chez Crapper we like to call it.";
pictureDescription[8] = "The trash incinerator and viewing area.";
pictureDescription[9] = "Inside the cabin. Wood stove we never use.";
pictureDescription[10] = "The most uncomfortable beds on earth.";
pictureDescription[11] = "Kitchen area.  Note the broken water pump.";
pictureDescription[12] = "Another shot of the kitchen.";
pictureDescription[13] = "Front door and the view outside.";
pictureDescription[14] = "Dumbasses!";
pictureDescription[15] = "Lake view #1";
pictureDescription[16] = "Lake view #2";
pictureDescription[17] = "Lake view #3";
pictureDescription[18] = "Lake view #4";
pictureDescription[19] = "Lake view #5";
pictureDescription[20] = "Lake view #6";
pictureDescription[21] = "Lake view #7";
pictureDescription[22] = "Lake view #8";

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/ThePlace2003/" + 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/ThePlace2003/" + 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/ThePlace2003/" + 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/ThePlace2003/" + imageNumber + ".jpg";
		changeCounter(imageNumber);
		changeMessage(pictureDescription[document.FishingPhotos.jumpTo.value]);
		changeAlert("&nbsp;");
		document.FishingPhotos.jumpTo.value = "";
	}
}