var latestGallery = "main";
var curPhoto = "1";
var curPhotoSet;
function initializePhotos()
{
	curPhotoSet = new Array("photo_lg_1.jpg", "photo_lg_2.jpg", "photo_lg_3.jpg", "photo_lg_4.jpg", "photo_lg_5.jpg", "photo_lg_6.jpg", "photo_lg_7.jpg", "photo_lg_8.jpg", "photo_lg_9.jpg", "photo_lg_10.jpg", "photo_lg_11.jpg", "photo_lg_12.jpg");
	
	loadThumbnails();

}

function loadThumbnails()
{
	var thumbContainer = "divThumbnails";
	var objContainer = (document.layers)?document[thumbContainer]:document.all?document.all[thumbContainer]:document.getElementById(thumbContainer);

	var objImg, prevID;
	for (var i=1; i<= curPhotoSet.length; i++)
	{
		// adding a bubble
		objImg = document.createElement("img");
		objImg.setAttribute("id", "th" + i);
		objImg.setAttribute("src", "images/photos/thumb_" + i + ".jpg");
		objImg.className = "off";
			
		objImg.onclick = function(){
			showPhoto(this.id.substring(2));
		}
		
		objContainer.appendChild(objImg);
		
		if (i % 3 == 0)
			objContainer.appendChild(document.createElement("br"));

	}
}

function showPhoto(pid)
{
	var idImg = "imgMainPhoto";
	var objImg = (document.layers)?document[idImg]:document.all?document.all[idImg]:document.getElementById(idImg);
	objImg.src = "/images/photos/" + curPhotoSet[pid-1];
	
	// update thumbnail statuses
	var idThumb = "th" + curPhoto;
	var objThumb = (document.layers)?document[idThumb]:document.all?document.all[idThumb]:document.getElementById(idThumb);
	objThumb.className = "off";
	
	idThumb = "th" + pid;
	objThumb = (document.layers)?document[idThumb]:document.all?document.all[idThumb]:document.getElementById(idThumb);
	objThumb.className = "on";
	
	curPhoto = pid;

	var idPhotoText = "divPhotoText";
	var objPhotoText = (document.layers)?document[idPhotoText]:document.all?document.all[idPhotoText]:document.getElementById(idPhotoText);
	objPhotoText.style.display = "none";
}

