function popupImage(filepath, width, height){
	var y = 0;
	var x = 0;
	if (!popupImage.imgNode) {
		if (document.all) {
//			y = document.body.scrollTop + 32;
//			x = document.body.scrollLeft + 32;
			popupImage.imgNode = document.createElement('img');
			popupImage.imgNode.attachEvent('onclick', closeImage);
			
		} else if (document.implementation) {
//			y = window.pageYOffset + 32;
//			x = window.pageXOffset + 32;
			popupImage.imgNode = document.createElement('img');
			popupImage.imgNode.addEventListener('click' ,closeImage , true);

		} else {
			return;
		}
	}

	with(popupImage){
		imgNode.setAttribute('src', filepath );
		if (width && height) {
			imgNode.setAttribute('width', width );
			imgNode.setAttribute('height', height );
		}
		imgNode.style.position = 'absolute';
//		imgNode.style.left = '620px';
//		imgNode.style.top = y + '360px';
		imgNode.style.left = '100px';
		imgNode.style.top = y + '240px';
		imgNode.style.borderColor = '#0099FF';
		imgNode.style.borderWidth = '0px';
		imgNode.style.borderStyle = 'solid';
		imgNode.style.margin = '0';
		imgNode.style.outlineWidth = '0px';
		imgNode.style.cursor = 'pointer';
//		document.body.appendChild(imgNode);
		document.getElementById('top-right').appendChild(imgNode);
	}
	
	function closeImage(){
		if (popupImage.imgNode) {
//			document.body.removeChild(popupImage.imgNode);
			document.getElementById('top-right').removeChild(popupImage.imgNode);
			delete popupImage.imgNode;
		}
	}
}

// イメージマップクリック時の線を消す
window.onload=function(){
	area=document.getElementsByTagName('area');
	for(i=0;i<area.length;i++){
		area[i].style.cursor = 'pointer';
		area[i].onfocus=function(){this.blur();}
	}
}

// 20091019
// body を起点するとウィンドウサイズによって位置がずれてしまうので id="top-right" を起点にする
// それに合わせて position: absolute; の位置も調整
// また ×Close をクリックできることが分かるように cursor: pointer; を追加