//
// JS for Badgers Gallery
//

function showPhoto(id) {
	// get rel attribute of the calling a tag and use that as the filename
	new Effect.Fade('gallery-main', { afterFinish: function () {
		newHTML = "<a href='" + links[id] + "' rel='lightbox'>";
		newHTML = newHTML + "<img src='" + images[id] + "' alt='' border='0' id='gallery-main' />";
		if (id > 0) {
			// prev link
			previd = id - 1;
			newHTML = newHTML + "<a href='#' onclick='showPhoto(" + previd + "); return false;' class='gallery-arrow-prev'><img src='" + imagedir + "/images/gallery-arrow-prev.png' width='20' height='36' alt='Previous Image' /></a>";
		}
		if (id < (images.length - 1)) {
			nextid = id + 1;
			newHTML = newHTML + "<a href='#' onclick='showPhoto(" + nextid + "); return false;' class='gallery-arrow-next'><img src='" + imagedir + "/images/gallery-arrow-next.png' width='20' height='36' alt='Next Image' /></a>";
		}
		newHTML = newHTML + "</a>";
		$('inline').innerHTML = newHTML;
	}});
}