// fixedGalleryMgr JavaScript Document

// set the following in each html file based on directory showing for this html file 
// var galleryPath = ".\/photos\/";		// where photos reside
// var pics = new Array(
//			"achilles2.jpg",
//			...
//			"lastpic.jpg );		

var numPics = 0;
var pNums;			//array of picture numbers
var stdBrowser;
var currentPic = 0;

window.onload = function() { init(); }
//addEvent(window, "load", init);

function init() {
	// load thumb nail images into frames
	if (document.images) {		
		pNums = document.getElementsByName("pnum");
		numPics = pNums.length;
		for (var i=0;i<numPics;i++) {
				pNums[i].onmousedown= function() {showPic(this);}
		}
		arrows = document.getElementsByName("arrow");
		arrows[0].onmousedown= function() {prevPic();}
		arrows[1].onmousedown= function() {nextPic();}
	} else {
		alert("No document.images supported");
	}
}

function showPic(obj) {
	for (var i = 0; i <= numPics; i++) {
		if (obj == pNums[i]) break;
	}	
	if (i <= numPics) {
		document.bigPic.src = galleryPath + pics[i];
		currentPic = i;
	}
}

function prevPic() {
	if (currentPic != 0) {
		currentPic--;
		document.bigPic.src = galleryPath + pics[currentPic];
	}
}

function nextPic() {
	if (currentPic < numPics -1) {
		currentPic++;
		document.bigPic.src = galleryPath + pics[currentPic];
	}
}

