var imgTimerID;
var img2;

function ImageWindow(img){
	img2 = new Image();
	img2.src = img;
	clearInterval(imgTimerID);
	imgTimerID = setInterval("loadImage()", 100);
}

function loadImage(){
	if (img2.complete){
		clearInterval(imgTimerID);
		popupwindow();
	}
}


function popupwindow(){
	width = img2.width+20;
	height = img2.height+70;

	x = (screen.width - width) / 2;
	y = (screen.height - height) / 2;

	var opt = "";
	opt+='directories=0,toolbar=0,menubar=0,scrollbars=yes,status=0,resizable=0';
	opt+=',width='+width+',height='+height+',';
	opt+='top='+y+',left='+x;

	jsw = window.open('','imgpop',opt);
	jsw.focus();
	jsw.document.open();
	htm = '<?xml version="1.0" encoding="utf-8"?>\n';
	htm+='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n';
	htm+='<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">\n';
	htm+='<head>\n';
	htm+='<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />\n';
	htm+='<title>拡大画像<\/title>\n';
	htm+='<\/head>\n';
	htm+='<body style="margin:0; padding:0;">\n';
	htm+='<a href="javascript:window.close();">\n';
	width = width-20;
	height = height-70;
	htm+='<img src="'+img2.src+'" width="'+width+'" height="'+height+'" border="0" alt="画像をクリックするとウィンドウを閉じます" />\n';
	htm+='<\/a>\n';
	htm+='<p align="center"><input type="button" value="閉じる" onClick="window.close()" /></p>\n';
	htm+='<\/body>\n<\/html>\n';
	jsw.document.write(htm);
	jsw.document.close();
}
