// JavaScript Document
window.onload = initAll;

var currImg = 0;
var captionText = new Array(
	"Great Blue Heron",
	"Bald Eagles return to the Inn.",
	"Ahoy!",
	"Drying time",
	"Low tide at the cove",
	"View of Eastsound from hot tub",
	"More birds.",
	"Foggy morning at the hot tub.",
	"Michelle and Sandra hiking the road.",
	"Sandra's garden.",
	"Orcas \"appaloosa\" deer.",
	"Her yearling.",
	"Welcome to the Anchorage Inn.",
	"Resident rabbit.",
	"Trail to beach.",
	"Evening view from observation point",
	"East Sound observation point",
	"Flowers for lunch",
	"Bring your kayak",
	"Bring two kayaks",
	"Sunrise",
	"Captain Ahab, (the fir tree not the man, his name is Thomas)<br>stands along the short cut trail to the mail box.",
	"Visitors inspecting the Inn parking and checkin area.",
	"Relax in the hammock",
	"Or play a game of horse shoes.",
	"Swimming by the observation point."
)

function initAll() {
	document.getElementById("imgText").innerHTML = captionText[0];
	document.getElementById("prevLink").onclick = processPrevious;
	document.getElementById("nextLink").onclick = processNext;
}

function processPrevious() {
	newSlide(-1);
}

function processNext() {
	newSlide(1);
}

function newSlide(direction) {
	var imgCt = captionText.length; // based n the number of captions in ^^^  captionText array

	currImg = currImg + direction;
	if (currImg < 0) {
		currImg = imgCt-1;
	}
	if (currImg == imgCt) {
		currImg = 0;
	}
	document.getElementById("slideshow").src = "slideshowphotos/anchorageslide-" + currImg + "-01.jpg";
	document.getElementById("imgText").innerHTML = captionText[currImg];
}

						

