// -------------------------
// ウィンドウオープン
// -------------------------
function OpenWindow($_path, $_width, $_height)
{
    if ( typeof($_width) == "undefined" ) {
        $_width = screen.width;
    }
    if ( typeof($_height) == "undefined" ) {
        $_height = screen.height;
    }

    x = (screen.width  - $_width) / 2;
    y = (screen.height - $_height) / 2;

    str = navigator.appName.toUpperCase();

    if (str.indexOf("EXPLORER") >= 0) {
        subWin = window.open($_path,"filewindow","fullscreen=yes, scrollbars=yes");
    }else{ 
        subWin = window.open($_path,"filewindow","left="+x+",top="+y+",width="+$_width+",height="+$_height);
    }

}

// -------------------------
// ウィンドウクローズ
// -------------------------
function CloseWin(){
    window.close();
}

// -------------------------
// サムネール表示
// -------------------------
function viewimage($img)
{
    w = 980;
    h = 690;
    x = (screen.width  - w) / 2;
    y = (screen.height - h) / 2;

    i=0;
    imgw=0;

    imgw++;
    win1=window.open("","imgw","left="+x+",top="+y+",width="+w+",height="+h);
    i++;
    with(win1.document){
        writeln("<html><head><title>画像閲覧</title></head>");
        writeln("<body style='background:black;'>");
        writeln("<p align='center' style='margin:30px;'><img src='"+$img+"' border='0'><br /><br />");
        writeln("<a href='javascript:window.close();'>閉じる</a>");
        writeln("</p>");
        writeln("</body></html>");
    }
    win1.document.close();

    return;
}

// -------------------------
//
// -------------------------
function SetMsg( $nValue, $mode)
{
    switch ( $mode ) {
    case 1:
        window.opener.document.frmParent.image_path.value = $nValue;
        break;
    case 2:
        window.opener.document.frmParent.file_path.value = $nValue;
        break;
    default:
    } 

    //ウィンドウを閉じる
    window.close();
}

// -------------------------
// プレビュー画面表示
// -------------------------
function OpenPreview( $_path, $_mode )
{
    // ターゲットを変更
    document.frmParent.target ="preview";
    document.frmParent.action =$_path;
    document.frmParent.submit();
    // ターゲットを戻す
    document.frmParent.target = "_self";

    switch ( $_mode ) {
    case 1:
        document.frmParent.action = "edit.php";
        break;
    case 2:
        document.frmParent.action = "add.php";
        break;
    default:
    } 
}

/*
function init() {
  objCal = new Cal('objCal', 'parent', this.cal);
  objCal.setHead(head);
  objCal.setFoot(foot);
  objCal.disp();
}
*/


