function getPageH() {
	var viewportH;
	var pageH;
	if (typeof window.innerWidth != 'undefined') {
		viewportH = window.innerHeight;
	} else {
		viewportH = document.documentElement.clientHeight;
	}
	if ((viewportH > document.body.parentNode.scrollHeight) && (viewportH > document.body.parentNode.clientHeight)) {
		pageH = viewportH;
	} else {
		if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) {
			pageH = document.body.parentNode.clientHeight;
		} else {
			pageH = document.body.parentNode.scrollHeight;
		}
		if (document.body.scrollHeight > pageH) {
			pageH = document.body.scrollHeight;
		}
	}
	return pageH;
}
function getWindowWH() {
	var w = 0, h = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		w = window.innerWidth;
		h = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		w = document.documentElement.clientWidth;
		h = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		w = document.body.clientWidth;
		h = document.body.clientHeight;
	}
	return [w,h];
}
function getScrollXY() {
	var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	}
	return [ scrOfX, scrOfY ];
}
function setBlanketH(blanket) {
	var blanketH = getPageH();
	blanket.style.height = blanketH + 'px';
}
function getPopupXY(popup) {
	var windowWH = getWindowWH();
	var scrollXY = getScrollXY();
	var l = (windowWH[0] - parseInt(popup.style.width)) / 2;
	var t = (windowWH[1] - parseInt(popup.style.height)) / 2;
	if (l < 0)
		l = 0;
	if (t < 0)
		t = 0;
	l += scrollXY[0];
	t += scrollXY[1];
	return [l, t];
}
function showPopup(popupId) {
	var blanket = document.getElementById('blanket');
	setBlanketH(blanket);
	var popup = document.getElementById(popupId);
	popupXY = getPopupXY(popup);
	popup.style.top = popupXY[1] + 'px';
	popup.style.left = popupXY[0] + 'px';
	popup.style.display = 'block';
	blanket.style.display = 'block';
	return false;
}
function hidePopup(id) {
	var blanket = document.getElementById('blanket');
	var popup = document.getElementById(id);
	popup.style.display = 'none';
	blanket.style.display = 'none';
}
function showImg(filename, str) {
	var enlarged = document.getElementById('enlarged');
	enlarged.src = filename;
	var blanket = document.getElementById('blanket');
	setBlanketH(blanket);
	var popup = document.getElementById('imgPopup');
	popupXY = getPopupXY(popup);
	popup.style.top = popupXY[1] + 'px';
	popup.style.left = popupXY[0] + 'px';
	var caption = document.getElementById('imgCaption');
	caption.innerHTML = str;
	popup.style.display = 'block';
	blanket.style.display = 'block';
	return false;
}
function hideImg() {
	var enlarged = document.getElementById('enlarged');
	enlarged.src = '_.gif';
	hidePopup('imgPopup');
}

