// Enlarge Photo

var overlayShown = false;

function enlargePhoto (thumbID, src, caption){
	
	var thumb = document.getElementById(thumbID);
	var overlay = document.getElementById('overlay');
	
	var imageHolder = document.getElementById('imageOverlay');
	var captionHolder = document.getElementById('caption');

	
	imageHolder.innerHTML = '<img id="tempImage" src="'+src+'" alt="'+caption+'" />';
	captionHolder.innerHTML = caption;
	
	captionHolder.style.display = 'block';	
	overlay.style.display = 'block';
	
	if (navigator.appName == 'Microsoft Internet Explorer'){
		var winHeight = document.body.clientHeight;
		var winWidth = document.body.clientWidth;
	}else{
		var winHeight = window.innerHeight;
		var winWidth = window.innerWidth;
	}
	var imageHeight = document.getElementById('tempImage').height;
	var imageWidth = document.getElementById('tempImage').width;
	
	if (navigator.appName == 'Microsoft Internet Explorer'){
		var imageTop = (winHeight / 2) - (imageHeight / 2) + document.body.scrollTop;	
		var imageLeft = (winWidth / 2) - ((imageWidth+20) / 2) + document.body.scrollLeft;			
	}else{
		var imageTop = (winHeight / 2) - (imageHeight / 2) + window.scrollY;	
		var imageLeft = (winWidth / 2) - ((imageWidth+20) / 2) + window.scrollX;		
	}	
		
	overlay.style.top = imageTop+'px';
	overlay.style.left = imageLeft+'px';
	overlay.style.width = imageWidth + 10 + 'px';
	
	overlayShown = true;
	
}

function killOverlay(){
	if (overlayShown){
		document.getElementById('overlay').style.display = 'none';
		overlayShown = false;
	}
}