/* memoblog javascript function */

// 変数初期化
var objWin = "";
var timerID;

var maxWidth = 1000;
var maxHeight = 720;

function ImageView(url){

	if (window.winImgPv) {
		window.winImgPv.close();
	}

	objWin=window.open("", "winImgPv", "width=320,height=240,scrollbars=no,resizable=yes");

	objWin.document.open();
	objWin.document.write("<html><head><title>画像プレビュー</title></head>");
	objWin.document.write("<body style='margin:0px;padding:0px;background-color:#CCC;'>");
	objWin.document.write("<table border=0 width=100% height=100% cellpadding=0 cellspacing=0>");
	objWin.document.write("<tr><td style='text-align:center; vertical-align:middle;'>");
	objWin.document.write("<img src='"+url+"' id='myImage'>");
	objWin.document.write("</td></tr></table>");
	objWin.document.write("</body></html>");
	objWin.focus();
	timerID=setInterval('resizeWin()', 100);
}

function resizeWin() {
	myImage = objWin.document.getElementById('myImage');

	if (myImage.complete == undefined || myImage.complete) { 
		clearInterval(timerID); 

		w = myImage.width;
		h = myImage.height;

		if (h>maxHeight) {
			h = maxHeight;
		}
		if (w>maxWidth) {
			w = maxWidth;
		}

		objWin.resizeTo(w+12, h+31);
		objWin.document.close();
	}
}


