<!--

var currentPic = 0;

function prevPic() {
	if (currentPic>1){
		currentPic--;
	} else {
		currentPic = totalPics;
	}
	targPic = picPrefix+currentPic+".jpg";
	loadImage(targPic);
}

function nextPic() {
	if (currentPic<totalPics){
		currentPic++;
	} else {
		currentPic = 1;
	}
	targPic = picPrefix+currentPic+".jpg";
	loadImage(targPic);
}
		
function loadImage(targPic){
	if (document.getElementById) {
		// define an onload handler to perform after image load completes
		document.getElementById('placeholderimage').onload=function(){
		 	// hide loader
		 	document.getElementById('galleryloader').style.display = "none";
		 	// reset height of image to correct size, show image
			document.getElementById('placeholderimage').style.height = picHeights[currentPic-1]+"px";
			document.getElementById('placeholder').style.visibility = "visible";
		};
	 	// setup load indicator
		document.getElementById('galleryloader').style.width = picWidths[currentPic-1]+"px";
		document.getElementById('galleryloader').style.height = picHeights[currentPic-1]+"px";
		document.getElementById('galleryloader').style.display = "block";
		// position load indicator animation/message vertically
		document.getElementById('galleryloadindicator').style.paddingTop = Math.round(picHeights[currentPic-1]/2)-25+"px";
		// Hide image
		// We use visibility:hidden, not block:none, as Safari 1.2 will not load image into block:none <img> tag
		// Also for safari 1.2, we can't move image off page (ie: margin-top: -9999), as for some reason it won't put it back!
		// So instead we will just give it a height of 0 to visually remove it from the page
		document.getElementById('placeholderimage').style.height = "0px";
		document.getElementById('placeholder').style.visibility = "hidden";
		// start loading of new image into placeholder
		document.getElementById('placeholderimage').src = targPic;
		// define overall look of image gallery
		document.getElementById('imagegallery').style.width = picWidths[currentPic-1]+"px";	
		document.getElementById('imagegallery').style.display = "block";
		// set description
		document.getElementById('desc').style.width = (picWidths[currentPic-1]-204)+"px";
		document.getElementById('desc').childNodes[0].nodeValue = "Image "+currentPic+" of "+totalPics;	
		return false;
	} else {
		return true;
	}
	
}

// refers to function included in addEventHandlers.js
addLoadEvent(nextPic);


-->
