function openPreview(url, width, height) {
	if (width > height) {
		w = 512;
		h = (512 / width) * height;
	} else {
		w = (512 / height) * width;
		h = 512;		
	}
	st = document.documentElement.scrollTop || document.body.scrollTop;
	ch = window.innerHeight || document.documentElement.clientHeight;
	cw = window.innerWidth || document.documentElement.clientWidth;
	t = (ch - h) / 2 + st;
	l = (cw - w) / 2;
	sw = w + 10;
	html = '<a';
	html += ' href="javascript:void(0);"';
	html += ' onclick="closePreview();"';
	html += ' title="閉じる"';
	html += '>';
	html += '<img src="' + url + '" alt="" style="padding:4px;border:1px solid #eee;background-color:#fff;" />';
	html += '</a>';
	document.getElementById("preview").style.position = 'absolute';
	document.getElementById("preview").style.top = t + 'px';
	document.getElementById("preview").style.left = l + 'px';
	document.getElementById("preview").style.width = sw + 'px';
	document.getElementById("preview").innerHTML = html;
}
function closePreview() {
	document.getElementById("preview").innerHTML = '';
}