/**
 * 画像サイズと合ったポップアップウィンドウを開く関数
 * @param src string ポップアップ表示する画像
 */
function openImageSizedWindow(src){
    // 画像をプリロード
    var i = new Image(); i.src = src;
    // ロード完了してから処理を開始
    i.onload = function() {
        // 画像のサイズに合った空ウィンドウを開く
        var pop_win = window.open(
                          "",
                          "_blank",
                          "width="+i.width+",height="+i.height+",scrollbars=no,resizable=yes"
                      );
        // 空ウィンドウに画像を出力するためのHTML
        pop_win.window.document.open();
        pop_win.window.document.write(
         '<html>'
        +'<head><title>'+i.alt+'</title></head>'
        +'<body style="margin:0;padding:0;border:0;">'
        +'<img src="'+i.src+'" width="100%" alt="" onClick="self.window.close()" />'
        +'</body>'
        +'</html>'
        );
        pop_win.window.document.close();
		
    }
}