window.onload = initAll;

var currImg = 0;
var captionText = new Array(
	"Crates Leather",
	"Leather storage and grading area",
	"Saddle Cutting room",
	"Tooling, Stamping, processing room",
	"Sub-assembly, skirts, housings",
	"Material storage and warehousing",
	"Sub-assembly, padded seats",
	"Sub-assembly, sewing room",
	"Saddle assembly, production area",
	"Saddle assembly, position one, horn caps",
	"Sub-assembly, fenders, stirrup leathers, riggings",
	"Saddle assembly, position two, ground work",
	"Saddle assembly, seat installation",
	"Saddle assembly, cantle binder installation",
	"Finishing, oiling",
	"Final assembly, pre-packaging",
	"Inspection and boxing for shipping",
	"Shipping room"
)

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;

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

						