﻿//<SCRIPT language="JavaScript" src="popimgwindow_twoneo.js"></SCRIPT>
//
function PopImgWindow_twoneo($IMG, $IMG_W, $IMG_H) {
    //
    //【ここから設定】
    $HEIGHT_MOVE = 650; //画像の『縦サイズ』がこの値を超えると、ウィンドウが最上部に移動する
    $HEIGHT_SCROLLBAR = 750; //ウィンドウの縦の最大サイズ
    $WIDTH_MOVE = 800; //画像の『横サイズ』がこの値を超えると、ウィンドウが左端に移動する
    $WIDTH_SCROLLBAR = 1000; //ウィンドウの横の最大サイズ
    //【設定ここまで】

    $WIN_TOP = "";
    $WIN_LEFT = "";
    $WIN_BAR = "";
    $WIN_W = $IMG_W;
    $WIN_H = $IMG_H;
    if ($WIN_H >= $HEIGHT_MOVE) {
        $WIN_TOP = ',top=0';
        if ($WIN_H >= $HEIGHT_SCROLLBAR) {
            $WIN_W = $WIN_W + 16;
            $WIN_H = $HEIGHT_SCROLLBAR;
            $WIN_BAR = 'scrollbars=yes,';
        }
    }
    if ($WIN_W >= $WIDTH_MOVE) {
        $WIN_LEFT = ',left=0';
        if ($IMG_W >= $WIDTH_SCROLLBAR) {
            $WIN_H = $WIN_H + 16;
            $WIN_W = $WIDTH_SCROLLBAR;
            $WIN_BAR = 'scrollbars=yes,';
        }
    }
    ResultWin = window.open('', 'Result', '' + $WIN_BAR + 'resizable=yes,WIDTH=' + $WIN_W + ',HEIGHT=' + $WIN_H + '' + $WIN_TOP + '' + $WIN_LEFT + '');
    ResultWin.focus();
    if (navigator.userAgent.indexOf('MSIE') != -1) {
        ResultWin.resizeTo($WIN_W + 12, $WIN_H + 31);
    }
    else {
        ResultWin.resizeTo($WIN_W, $WIN_H);
    }
    ResultWin.document.write('<html><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=x-sjis">');
    ResultWin.document.write('<SCRIPT language="JavaScript">');
    ResultWin.document.write('function ResultClose(){window.close()}');
    ResultWin.document.write('</SCRIPT></head>');

    ResultWin.document.write('<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">');
    ResultWin.document.write('<!--<center><font color="#cc0000">▼画像をクリックするとウィンドウを閉じます▼</font></center><br/>--><!--<A href="#" onClick="ResultClose()">--><img src="' + $IMG + '" width="' + $IMG_W + '" height="' + $IMG_H + '" border="0"><!--</A>-->');

    ResultWin.document.write('</body></html>');
    ResultWin.document.close();

}