
CurrentPhotoID = ""
CurrentProject = ""
CurrentThumbnailSection = ""

function IM_ShowPhoto(PhotoID,Image,Project,Position,ThumbnailSection,NextThumb,PrevThumb) {

if (CurrentPhotoID != PhotoID) {

	// ADJUST THUMBNAIL DISPLAY

	// switch highlighted thumbnail
	if (CurrentPhotoID != "") {
		eval("document.getElementById('T_" + CurrentPhotoID + "').className = 'ThumbnailInactive';")
	}
	eval("document.getElementById('T_" + PhotoID + "').className = 'ThumbnailActive';")

	// update next/previous links (arrows)
	if (NextThumb == "") {
		document.getElementById('PG_NextPhoto').innerHTML = '';
	}
	else {
		nexturl = eval("document.getElementById('A_" + NextThumb + "').href")
		htmlprefix = '<a href="'
		htmlsuffix = '"><img src="images/PG_next.gif"></a>'
		document.getElementById('PG_NextPhoto').innerHTML = htmlprefix + nexturl +  htmlsuffix
	}
	if (PrevThumb == "") {
		document.getElementById('PG_PrevPhoto').innerHTML = '';
	}
	else {
		prevurl = eval("document.getElementById('A_" + PrevThumb + "').href")
		htmlprefix = '<a href="'
		htmlsuffix = '"><img src="images/PG_prev.gif"></a>'
		document.getElementById('PG_PrevPhoto').innerHTML = htmlprefix + prevurl +  htmlsuffix
	}

	// switch thumbnail divs if necessary
	if (CurrentThumbnailSection != ThumbnailSection) {
		if (CurrentThumbnailSection != "") {
			eval("document.getElementById('TS_" + CurrentThumbnailSection + "').style.display = 'none';")
		}
	}
	eval("document.getElementById('TS_" + ThumbnailSection + "').style.display = 'block';")



	// SHOW DETAIL FOR THIS PHOTO

	// replace large photo with new Image
	eval("document.getElementById('PG_FeaturedPhoto').src = 'photos/L/" + Image + "';")

	// replace description with new Project div
	if (CurrentProject != "") {
		eval("document.getElementById('P_" + CurrentProject + "').style.display = 'none';")
	}
	eval("document.getElementById('P_" + Project + "').style.display = 'block';")

	// replace old position with new Position
	eval("document.getElementById('PhotoPosition').innerHTML = Position;")


	//RESET CURRENT PHOTO

	CurrentPhotoID = PhotoID
	CurrentProject = Project
	CurrentThumbnailSection = ThumbnailSection 
	}

}