window.onload = initAll;

var currImg = 0;
var captionText = new Array(
	"The Colorado Rockies Experiment and Seismic Transects project--CREST, for short--is trying to find data on the state\'s geologic foundations. Above, the dramatic Black Canyon of the Gunnison River. <em>Photo courtesy of Jack Olson</em>",
	"Members of the CREST team usually work alone in the field--unless the locals show some interest, of course, as one did near Carbondale, Colo., when a CRESTer was checking the seismic data logger. <em>Photo courtesy of Ken Dueker</em>",
	"The team is trying to unlock data that could help explain the state\'s complex geology, like this folded rock site near Glenwood Springs. <em>Photo courtesy of Ken Dueker</em>",
	"Data logger, GPS clock, and power system that operate the broad-band seismometer. The equipment is borrowed from the PASSCAL instrument center when a NSF proposal is funded.",
	"Site near Kremeling in private landowner\'s backyard.",
	"Frisco site--plugging in the PDA to check the seismic signal and DAS state.",
	"South Park site.",
	"Independence pass site.")

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 = "crest" + (currImg + 1) + ".jpg";
	document.getElementById("imgText").innerHTML = captionText[currImg];
}
