

function getClientWidth() {
	if (self.innerWidth) {
		return self.innerWidth;
	}
	else if (d.documentElement && d.documentElement.clientWidth) {
		return d.documentElement.clientWidth;
	}
	else if (d.body){
		return d.body.clientWidth;
	}
}

function getClientHeight(){
	if (self.innerHeight) {
		return self.innerHeight;
	}
	else if (d.documentElement && d.documentElement.clientHeight) {
		return d.documentElement.clientHeight;
	}
	else if (d.body) {
		return d.body.clientHeight;
	}
}

function getScrollY(){
	if(d.body && typeof d.body.scrollTop != "undefined") {
		return d.body.scrollTop;
	}
	else if (d.documentElement && typeof d.documentElement.scrollTop != "undefined") {
		return d.documentElement.scrollTop;
	}
	else if(typeof window.pageYOffset != "undefined") {
		return window.pageYOffset;
	}
	return 0;
}

var d = document;
var imgPop = null;

imagePop = function (e, path, w, h) {
	if(imgPop==null) {
		imgPop = d.createElement("IMG");
		imgPop.src = path;
		with (imgPop.style) {
			position = "absolute";
			left = Math.round((getClientWidth()-w) / 2) + "px";
			top = Math.round((getClientHeight()-h) / 2 + getScrollY()) + "px";
			margin = "0";
			zIndex = 0;
			border = "4px groove green";
			display = "none";
		}
		d.body.appendChild(imgPop);
		if (imgPop.complete) {
			imgPop.style.display = "block";
		}
		else window.status = "画像読み込み中…";
		imgPop.onload = function(){imgPop.style.display="block"; window.status="";}
		imgPop.onclick = function(){d.body.removeChild(imgPop);imgPop=null;}
		imgPop.title = "マウスクリックで閉じます";
	}
}

