
function openWelcomeMessage(){
    window.open("welCome.html","main");
}

function openInstall(){
    window.open("install.html","Help","width=450,height=700,scrollbars=yes,resizable=yes");
}

function openRegister(){
    window.open("register.php","main");
}

function openChangeTable(){
    window.open("changeTable.php","main");
}

function openRemoveTable(){
    window.open("removeTable.php","main");
}

function openFileClear(){
    window.open("fileCleaner.php","main");
}

function openPliceList(){
    window.open("priceList.php","main");
}

function openGlobalMaster(){
    window.open("globalMaster.php","main");
}

function openNOAProject(){
    window.open("https://sites.google.com/site/noawebspace/home","_blank");
}

function openMenuTable(){
    window.open("menuTable.php","main");
}

function openFieldTable(){
    window.open("fieldTable.php","main");
}

function openFGroupMenu(){
    window.open("groupMenu.php","main");
}

function checkKey(){
    // クリックされた時にシフトキーが押されていたらオプション・メニューを表示
    // 以下を間違えて使うとデータを壊すおそれあり一般的使用は好ましくないのでトラップ・ドアとする
    if (event.shiftKey){
        var elm = document.getElementById("optionArea");
        if (elm.innerHTML.length > 0){
            elm.innerHTML = "";
            return;
        }
        elm.innerHTML = "";
        var div = newDIV(elm, "/frame");
        var dv = newDIV(div, "/comment");
        dv.innerHTML = "以下は通常 NOA の中で編集されるものです。あくまで緊急避難的利用にとどめてください。";
        var dv = newDIV(div, "/anchor");
        dv.style.margin = "0 0";
        var sp = newSPAN(dv, "");
        sp.innerHTML = "MenuTable";
        sp.setAttribute("onclick", "openMenuTable()");
        
        var dv = newDIV(div, "/anchor");
        dv.style.margin = "0 0";
        var sp = newSPAN(dv, "");
        sp.innerHTML = "FieldTable";
        sp.setAttribute("onclick", "openFieldTable()");
        
        var dv = newDIV(div, "/anchor");
        dv.style.margin = "0 0";
        var sp = newSPAN(dv, "");
        sp.innerHTML = "GroupMenu";
        sp.setAttribute("onclick", "openFGroupMenu()");
    }
}

function initNOAManager(){
    var elm = document.getElementById("base");
    elm.innerHTML = "";
    elm.style.padding = "5px 0 0 5px";
    
    // HEADER ========================================
    var div = newDIV(elm, "/yellow-bar");
    div.style.padding = "3px 10px";
    var a = newA(div, "NOAManager", "#", "");
    a.setAttribute("onclick", "openWelcomeMessage()");

    // CONTENTS ======================================
    var base = newDIV(elm, "/menuBase");
    
    // はじめに -------------------------------------
    var dv = newDIV(base, "/subTitle");
    var sp = newSPAN(dv, "");
    sp.innerHTML = "はじめに";
    
    var dv = newDIV(base, "/anchor");
    dv.setAttribute("onclick", "openInstall()");
    var sp = newSPAN(dv, "");
    sp.innerHTML = "インストール";

    var dv = newDIV(base, "/anchor");
    dv.setAttribute("onclick", "openRegister()");
    var sp = newSPAN(dv, "");
    sp.innerHTML = "施設・ユーザ登録";
    
    // メンテナンス -------------------------------------
    var dv = newDIV(base, "/subTitle");
    var sp = newSPAN(dv, "");
    sp.innerHTML = "メンテナンス";

    var dv = newDIV(base, "/anchor");
    dv.setAttribute("onclick", "openChangeTable()");
    var sp = newSPAN(dv, "");
    sp.innerHTML = "カルテID修正";
    
    var dv = newDIV(base, "/anchor");
    dv.setAttribute("onclick", "openRemoveTable()");
    var sp = newSPAN(dv, "");
    sp.innerHTML = "カルテ削除";
    
    var dv = newDIV(base, "/anchor");
    dv.setAttribute("onclick", "openFileClear()");
    var sp = newSPAN(dv, "");
    sp.innerHTML = "保険証画像削除";

    // 辞書関連 -------------------------------------
    var dv = newDIV(base, "/subTitle");
    var sp = newSPAN(dv, "");
    sp.innerHTML = "辞書関連";

    var dv = newDIV(base, "/anchor");
    dv.setAttribute("onclick", "openPliceList()");
    var sp = newSPAN(dv, "");
    sp.innerHTML = "PriceList";
    
    var dv = newDIV(base, "/anchor");
    dv.setAttribute("onclick", "openGlobalMaster()");
    var sp = newSPAN(dv, "");
    sp.innerHTML = "グローバル辞書";

    // オブション -----------------------------------
    var div = newDIV(base, "optionArea");

    // 関連情報 -------------------------------------
    var dv = newDIV(base, "/subTitle");
    var sp = newSPAN(dv, "");
    sp.innerHTML = "関連情報";
    
    var dv = newDIV(base, "/anchor");
    dv.setAttribute("onclick", "openNOAProject()");
    var sp = newSPAN(dv, "");
    sp.innerHTML = "NOA プロジェクト";
    
    // FOOTER ========================================
    var div = newDIV(elm, "/yellow-bar");
    div.style.padding = "3px 10px";
    var sp = newSPAN(div, "/responce");
    sp.innerHTML = version();
    sp.setAttribute("onclick", "checkKey()");
}

function version(){
    return "Ver.140612";
}