/*
function setHospitalTable(obj){
    // obj = userCode(all)sectionCode(23)groupCode(doctor)loginName(ohashi)kanjiName(大橋 克洋)identifier(c44f9b64052f12c4e9229fd899c7113b)hospitalId(1304000000077)memo()entryDate(2010-04-29 15:49:06)updateTime(2012-10-10 15:53:22)owner(ohashi)rowid(38)hospitalTable(大橋医院(1304000000077)SEA SIDE CLINIC(03234200))
    //console.log("setHospitalTable->"+encodeObject(obj)); //##
    
    var st = encodeObject(obj);
    window.localStorage["hospitalTable"] = encodeSTRING(st);
}
function hospitalTable(){
    var st = window.localStorage["hospitalTable"];
    st = decodeSTRING(st);
    
    return decodeObject(st);
}
 
function owner(){
    return (hospitalTable()) ? hospitalTable().loginName : "??";
}
 */

function setloginName(name){
    // LOGIN から NOA へ受け渡すため ログイン名 を一時記憶
    window.localStorage["loginName"] = name;
}
function loginName(){
    return window.localStorage["loginName"];
}

function setStoragedKey(key){
    window.localStorage["storagedSearchKey"] = key;
}
function storagedKey(){
    // 以前使われた検索キー
    var key = window.localStorage["storagedSearchKey"];
    return (key) ? key : "";
}

function setFrameStyle(elm){
    window.localStorage["frameStyle"] = elm.value;
}
function frameStyle(){
    // NOA 画面フレームの表示形式
    var style = window.localStorage["frameStyle"];
    return (style) ? style : "";
}

function setOverFlowHeight(elm){
    var height = elm.value;
    window.localStorage["noaOverFlowHeight"] = height;
}
function overFlowHeight(){
    // NOA のスクロール範囲高を設定
    var height = window.localStorage["noaOverFlowHeight"];
    return (height) ? height : 0;
}

function setNewPageTemplate(elm){
    // 新規ページのテンプレートを記憶
    window.localStorage["newPageTemplate"] = elm.value;
}
function newPageTemplate(){
    var label = window.localStorage["newPageTemplate"];
    return (label) ? label : "";
}

function setCellFontSize(elm){
    var size = elm.value;
    window.localStorage["cellFontSize"] = size;
}
function cellFontSize(){
    // カルテのフォント・サイズを設定
    var size = window.localStorage["cellFontSize"];
    return (size) ? size : 10;
}

function setOpenEachNOA(elm){
    window.localStorage["openEachNOA"] = (elm.checked) ? "1" : "0";
}
function openEachNOA(){
    // カルテを別ウインドーで開く status を返す：黄色タグから呼ばれる
    var status = window.localStorage["openEachNOA"];
    return (status) ? status * 1 : 0;
}

function setVinTouchAndGo(elm){
    // 確定保存のチェック状態を記憶
    window.localStorage["vinTouchAndGo"] = (elm.checked) ? "1" : "0";
}
function vinTouchAndGo(){
    var status = window.localStorage["vinTouchAndGo"];
    
    return (status && status * 1) ? true : false;
}

function setVinTouchAndPrint(elm){
    // 確定保存のチェック状態を記憶
    window.localStorage["vinTouchAndPrint"] = (elm.checked) ? "1" : "0";
}
function vinTouchAndPrint(){
    var status = window.localStorage["vinTouchAndPrint"];
    
    return (status && status * 1) ? true : false;
}


function setOpenEachNOA2(elm){
    window.localStorage["openEachNOA2"] = (elm.checked) ? "1" : "0";
}
function openEachNOA2(){
    // カルテを別ウインドーで開く status を返す：受診履歴から呼ばれる
    var status = window.localStorage["openEachNOA2"];
    return (status) ? status * 1 : 0;
}

/*
function setOmitStatus(elm){
    // 空欄省略モードの status を localStorage へ記憶
    window.localStorage["prefOmitStatus"] = (elm.checked) ? "1" : "0";
}
function omitStatus(){
    // 空欄省略モードの status を返す
    var status = window.localStorage["prefOmitStatus"];
    return (status) ? status * 1 : 0;
}

function setDiseaseTool(elm){
    window.localStorage["diseaseTool"] = (elm.checked) ? "1" : "0";
}
function diseaseTool(){
    // 病名ツールの status を返す
    var status = window.localStorage["diseaseTool"];
    return (status) ? status * 1 : 0;
}*/

function setCostColumnCheck(elm){
    window.localStorage["costColumnCheck"] = (elm.checked) ? "1" : "0";
}
function costColumnCheck(){
    // 金額欄を表示しない status を返す
    var status = window.localStorage["costColumnCheck"];
    return (status) ? status * 1 : 0;
}

function setInsColumnCheck(elm){
    window.localStorage["insColumnCheck"] = (elm.checked) ? "1" : "0";
}
function insColumnCheck(){
    // 保険証欄を表示しない status を返す
    var status = window.localStorage["insColumnCheck"];
    return (status) ? status * 1 : 0;
}

function setAccessLogReverse(status){
    window.localStorage["accessLogReverse"] = status;
}
function accessLogReverse(){
    // 受信履歴リストを逆ソートする status を返す
    if (window.localStorage["accessLogReverse"] == null) 
        return true; // 初期値はリバース
    
    return (window.localStorage["accessLogReverse"]) ? true : false;
}

function setThumbNailSize(size){
    window.localStorage["thumbNailSize"] = size;
}
function thumbNailSize(){
    // ### htmlForValue() に必要：無いと htmlForValue() でフリーズする ###
    // preference.js などでカスタマイズできるようにする
    var size = window.localStorage["thumbNailSize"];
    return (size) ? size : "50px";
}

function setIsAddReservedPage(elm){
    // 予約ページを追加するか否かの status を localStorage へ記憶
    window.localStorage["isAddReservedPage"] = (elm.checked) ? "1" : "0";
}
function isAddReservedPage(){
    // 予約ページを追加するか否かの status を返す
    var status = window.localStorage["isAddReservedPage"];
    return (status) ? status * 1 : 0;
}

function setInsViewerSaveAndClose(elm){
    // 画像読込ツールの保存とともにパネルを閉じる
    window.localStorage["insViewerSaveAndClose"] = (elm.checked) ? "1" : "0";
}
function insViewerSaveAndClose(){
    var status = window.localStorage["insViewerSaveAndClose"];
    return (status) ? status * 1 : 0;
}

function setShowDisaseField(status){
    window.localStorage["showDisaseField"] = (status) ? "1" : "0";
}
function showDisaseField(){
    // 病名欄の入力フィールド表示・非表示の status を返す
    var status = window.localStorage["showDisaseField"];
    return (status) ? status * 1 : 0;
}

function setAddWithReservedDate(elm){
    window.localStorage["addWithReservedDate"] = (elm.checked) ? "1" : "0";
}
function addWithReservedDate(){
    // 予約日時でページ追加するか否かの status を返す
    var status = window.localStorage["addWithReservedDate"];
    return (status) ? status * 1 : 0;
}

function setTextClick(elm){
    window.localStorage["textClick"] = (elm.checked) ? "1" : "0";
}
function textClick(){
    // カルテ本文をクリックして編集できるようにする
    var status = window.localStorage["textClick"];
    return (status) ? status * 1 : 0;
}

function setHTMLEditor(elm){
    window.localStorage["HTMLEditor"] = (elm.checked) ? "1" : "0";
}
function HTMLEditor(){
    // CELL エディター にHTML 編集ツール表示
    var status = window.localStorage["HTMLEditor"];
    return (status) ? status * 1 : 0;
}

/* function setOpenInsPage(elm){
    // 保険情報を開くか否かの status を localStorage へ記憶
    window.localStorage["openInsPage"] = (elm.checked) ? "1" : "0";
}
function openInsPage(){
    // 新患で保険情報を開くか否かの status を返す
    var status = window.localStorage["openInsPage"];
    return (status) ? status * 1 : 0;
} */

function setOpenInsViewerStatus(elm){
    // InsViewer を開くか否かの status を localStorage へ記憶
    window.localStorage["openInsViewerStatus"] = (elm.checked) ? "1" : "0";
}
function openInsViewerStatus(){
    // InsViewer を開くか否かの status を返す
    var status = window.localStorage["openInsViewerStatus"];
    return (status) ? status * 1 : 0;
}

function setNoCalendar(status){
    // カレンダー表示有無の status を localStorage へ記憶
    window.localStorage["noCalendar"] = (status) ? "1" : "0";
}
function noCalendar(){
    // カレンダー表示有無の status を返す
    var status = window.localStorage["noCalendar"];
    return (status) ? status * 1 : 0;
}

function setCalendarIsReverse(status){
    window.localStorage["calendarIsReverse"] = (status) ? "1" : "0";
}
function calendarIsReverse(){
    // 受信履歴リストを逆ソートする status を返す
    var status = window.localStorage["calendarIsReverse"];
    return (status) ? status * 1 : 0;
}

function setCalendarToExpand(status){
    // カレンダーを全部表示 status を localStorage へ記憶
    window.localStorage["calendarToExpand"] = (status) ? "1" : "0";
}
function calendarToExpand(){
    // カレンダーを全部表示 status を返す
    var status = window.localStorage["calendarToExpand"];
    return (status && (status * 1 > 0)) ? true : false;
}

function setShowLinkField(elm){
    // リンク・ツールの入力欄表示 status を localStorage へ記憶
    window.localStorage["showLinkField"] = (elm.checked) ? "1" : "0";
}
function showLinkField(){
    // カレンダーを全部表示 status を返す
    var status = window.localStorage["showLinkField"];
    return (status && status * 1 > 0) ? 1 : 0;
}

function setShowHelp(elm){
    window.localStorage["showNoaHelp"] = (elm.checked) ? "1" : "0";
}
function showHelp(){
	// NOA 立ち上げ時にヘルプを表示せず
    var status = window.localStorage["showNoaHelp"];
    return (status && status * 1 > 0) ? 1 : 0;
}

function setNoCheckWaiting(elm){
    var status = (elm.checked) ? "1" : "";
    window.localStorage["noCheckWaiting"] = status;
}
function noCheckWaiting(){
    // 受診者ポップアップ・タグ 表示/非表示 の status を返す
    var status = window.localStorage["noCheckWaiting"];
    return (status) ? status * 1 : 0; // default は 0: チェックする
}

function setArrowKeyJump(elm){
    // 右矢印キーで次欄へ移動モードの status を localStorage へ記憶
    window.localStorage["arrowKeyJump"] = (elm.checked) ? "1" : "0";
}
function arrowKeyJump(){
    // 右矢印キーで次欄へ移動モードの status を返す
    var status = window.localStorage["arrowKeyJump"];
    return (status) ? status * 1 : 0;
}

function setOmitProblem(elm){
    // problemList 非表示モードの status を localStorage へ記憶
    window.localStorage["omitProblemStatus"] = (elm.checked) ? "1" : "0";
}
function omitProblem(){
    // roblemList 非表示省略モードの status を返す
    var status = window.localStorage["omitProblemStatus"];
    return (status) ? status * 1 : 0;
}

function setOmitCalculate(elm){
    // 集計ボタンで「計算せず転記のみ」の status を localStorage へ記憶
    window.localStorage["omitCalculate"] = (elm.checked) ? "1" : "0";
}
function omitCalculate(){
    var status = window.localStorage["omitCalculate"];
    return (status) ? status * 1 : 0;
}

function setFlexibleWaitingList(elm){
    var status = (elm.checked) ? "1" : "";
    window.localStorage["flexibleWaitingList"] = status;
}
function flexibleWaitingList(){
    //  待受リストの表示行数を制限するか否かを返す
    return (window.localStorage["flexibleWaitingList"])
    ? window.localStorage["flexibleWaitingList"] * 1 : 0;
}

function setPlanColumnCheck(elm){
    window.localStorage["planColumnCheck"] = (elm.checked) ? "1" : "0";
}
function planColumnCheck(){
    // 実施計画欄を表示する status を返す
    var status = window.localStorage["planColumnCheck"];
    return (status && status * 1) ? 1 : 0;
}
function setYoyakuCheck(elm){
    window.localStorage["yoyakuCheck"] = (elm.checked) ? "1" : "0";
}
function yoyakuCheck(){
    // 予約欄表示チェックボックスを表示する status を返す
    var status = window.localStorage["yoyakuCheck"];
    return (status && status * 1) ? 1 : 0;
}
function setShowBookingCheck(elm){
    window.localStorage["showBookingCheck"] = (elm.checked) ? "1" : "0";
}
function showBookingCheck(){
    // 診療済チェックボックスを表示する status を返す
    var status = window.localStorage["showBookingCheck"];
    return (status && status * 1) ? 1 : 0;
}
function setFinishCheck(elm){
    window.localStorage["finishCheck"] = (elm.checked) ? "1" : "0";
}
function finishCheck(){
    // 診療済を表示しない status を返す
    var status = window.localStorage["finishCheck"];
    return (status && status * 1) ? 1 : 0;
}
function setPostItColorCheck(elm){
    window.localStorage["postItColorCheck"] = (elm.checked) ? "1" : "0";
}
function postItColorCheck(){
    // 付箋カラー表示の status を返す
    var status = window.localStorage["postItColorCheck"];
    return (status) ? status * 1 : 0;
}
function setBookingTodayCheck(elm){
    window.localStorage["bookingTodayCheck"] = (elm.checked) ? "1" : "0";
}
function bookingTodayCheck(){
    // 診療済を表示しない status を返す
    var status = window.localStorage["bookingTodayCheck"];
    return (status) ? status * 1 : 0;
}
function setBookingReverse(status){
    window.localStorage["bookingReverse"] = status;
}
function bookingReverse(){
    // 待受リストを逆ソートする status を返す
    return (window.localStorage["bookingReverse"]) ? true : false;
}

function setCostColumnCheck(elm){
    window.localStorage["costColumnCheck"] = (elm.checked) ? "1" : "0";
}
function costColumnCheck(){
    // 金額欄を表示しない status を返す
    var status = window.localStorage["costColumnCheck"];
    return (status) ? status * 1 : 0;
}

function setPostItColorForListCheck(elm){
    window.localStorage["postItColorForListCheck"] = (elm.checked) ? "1" : "0";
}
function postItColorForListCheck(){
    // 付箋カラー表示の status を返す：listMaker.js 用
    var status = window.localStorage["postItColorForListCheck"];
    return (status) ? status * 1 : 0;
}

function setInsColumnCheck(elm){
    window.localStorage["insColumnCheck"] = (elm.checked) ? "1" : "0";
}
function insColumnCheck(){
    // 保険証欄を表示しない status を返す
    var status = window.localStorage["insColumnCheck"];
    return (status) ? status * 1 : 0;
}

function setDiseaseTouchAndGo(elm){
    // disease.js で「確定保存」チェックボックスの status を記憶
    window.localStorage["diseaseTouchAndGo"] = (elm.checked) ? "1" : "0";
}
function diseaseTouchAndGo(){
    var status = window.localStorage["diseaseTouchAndGo"];
    return (status) ? status * 1 : 0;
}

function setPagePrintFontSize(elm){
    window.localStorage["smallPagePrintFontSize"] = (elm.checked) ? "1" : "0";
}
function pagePrintFontSize(){
	// ページ印刷のフォントサイズの状態を返す( 0:lagge 1:small )
    var status = window.localStorage["smallPagePrintFontSize"];
    return (status) ? status * 1 : 0;
}

function setPagePrintWidth(elm){
    window.localStorage["smallPagePrintWidth"] = (elm.checked) ? "1" : "0";
}
function pagePrintWidth(){
	// ページ印刷のページ巾の状態を返す( 0:lagge 1:small )
    var status = window.localStorage["smallPagePrintWidth"];
    return (status) ? status * 1 : 0;
}

function setVinFilterEnabled(elm){
    // VinFilter が動作するか否かを記憶
    window.localStorage["vinFilterEnabled"] = (elm.checked) ? "1" : "0";
}
function vinFilterEnabled(){
    var status = window.localStorage["vinFilterEnabled"];
    return (status) ? status * 1 : 0;
}

function setFrontDebugStatus(elm){
    // FRONT の debug status を記憶
    window.localStorage["frontDebugStatus"] = (elm.checked) ? "1" : "0";
}
function frontDebugStatus(){
    var status = window.localStorage["frontDebugStatus"];
    return (status) ? status * 1 : 0;
}

function setMessageSender(sender){
    // Messenger の sender を記憶
    window.localStorage["messageSender"] = sender;
}
function messageSender(){
    return window.localStorage["messageSender"];
}

///// FORM ///////////////////////////////////////////////

function setFormTouchAndGo(elm){
    // 確定保存のチェック状態を記憶
    window.localStorage["formTouchAndGo"] = (elm.checked) ? "1" : "0";
}
function isFormTouchAndGo(){
    var status = window.localStorage["formTouchAndGo"];
    
    return (status && status * 1) ? true : false;
}
function setValueWithUnit(elm){
    // 単位表示のチェック状態を記憶
    window.localStorage["valueWithUnit"] = (elm.checked) ? "1" : "0";
}
function valueWithUnit(){
    var status = window.localStorage["valueWithUnit"];
    
    return (status && status * 1) ? true : false;
}

function setDocViewerMenuType(elm){
    // DocView のメニュー表示型式を記憶
    window.localStorage["docViewerMenuType"] = (elm.checked) ? "1" : "0";
}
function docViewerMenuType(){
    var status = window.localStorage["docViewerMenuType"];
    
    return (status && status * 1) ? true : false;
}

function setFormatMode(elm){
    // カルテへ整形して書き戻すかどうかを記憶
    window.localStorage["formatMode"] = (elm.checked) ? "1" : "0";
}
function formatMode(){
    var status = window.localStorage["formatMode"];
    
    return (status && status * 1) ? 1 : 0;
}

function setIgnoreBlankForm(elm){
    // 空欄を無視するかどうかを記憶
    window.localStorage["ignoreBlankForm"] = (elm.checked) ? "1" : "0";
}
function ignoreBlankForm(){
    var status = window.localStorage["ignoreBlankForm"];
    
    return (status && status * 1) ? 1 : 0;
}

function setCloseCategory(elm){
    window.localStorage["closeCategory"] = (elm.checked) ? "1" : "0";
}
function closeCategory(){
    // infoSack 初期画面でカテゴリーを閉じたモードの status を返す
    var status = window.localStorage["closeCategory"];
    return (status) ? status * 1 : 0;
}

function setCheckDiseases(elm){
    window.localStorage["checkDiseases"] = (elm.checked) ? "1" : "0";
}
function checkDiseases(){
    // 病名チェッカーを活かすかどうかのステータスを返す
    var status = window.localStorage["checkDiseases"];
    return (status) ? status * 1 : 0;
}

function setFloatToolMenu(elm){
    window.localStorage["floatToolMenu"] = (elm.checked) ? "1" : "0";
}
function floatToolMenu(){
    // TOOL MENU を float 形式で表示するかどうかのステータスを返す
    var status = window.localStorage["floatToolMenu"];
    return (status) ? status * 1 : 0;
}

function setShowAllergy(elm){
    window.localStorage["showAllergy"] = (elm.checked) ? "1" : "0";
}
function showAllergy(){
    // アレルギーをページヘッダーに表示するかどうかのステータスを返す
    var status = window.localStorage["showAllergy"];
    return (status) ? status * 1 : 0;
}

function setDebugMode(elm){
    window.localStorage["debugMode"] = (elm.checked) ? "1" : "0";
}
function debugMode(){
    // デバッグ・モードかどうかを返す
    var status = window.localStorage["debugMode"];
    return (status) ? status * 1 : 0;
}

function setAgent(obj){
    window.localStorage["agent"] = (obj) ? encodeObject(obj) : null;
}
function agent(){
    // Agent データ・オブジェクトを返す
    var buff = window.localStorage["agent"];
    
    return (buff) ? decodeObject(buff) : new Object();
}

function setListMakerHeader(buff){
    // listMaker のヘッダー情報を記憶
    window.localStorage["listMakerHeader"] = buff;
}
function listMakerHeader(){
    var buff = window.localStorage["listMakerHeader"];
    return (buff) ? buff : "";
}

function setListMakerSrc(obj){
    // listMaker のデータを記憶
    window.localStorage["listMakerSrc"] = encodeObject(obj);
}
function listMakerSrc(){
    var buff = window.localStorage["listMakerSrc"];
    
    return (buff) ? decodeObject(buff) : new Object();
}

function putListMakerLayout(array){
    window.localStorage["listMakerLayout"] = array.join(",");
}
function listMakerLayout(){
    // listMaker のレイアウトを返す
    var buff = window.localStorage["listMakerLayout"];
    
    return (buff) ? buff.split(",") : new Array();
}

function setPictureUploadType(type){
    window.localStorage["pictureUploadType"] = type;
}
function pictureUploadType(){
    // Picture ツールの画像添付のアップロード型式を返す
    var status = window.localStorage["pictureUploadType"];
    return (status && (status * 1 > 0)) ? status * 1 : 0;
}

function setHLOpenAnotherWindow(elm){
    window.localStorage["HLOpenAnotherWindow"] = (elm.checked) ? "1" : "0";
}
function HLOpenAnotherWindow(){
    // HL7 で別ウインドー表示するか否かの status を返す
    var status = window.localStorage["HLOpenAnotherWindow"];
    return (status) ? status * 1 : 0;
}

/////////////////////////////////////////////
///// 妊娠歴 /////////////////////////////////

function setCountFromOne(elm){
    window.localStorage["countFromOne"] = (elm.checked) ? "1" : "0";
}
function countFromOne(){
    // 妊娠歴：月経周期未満の場合の経過日数を１からカウント開始
    var status = window.localStorage["countFromOne"];
    return (status) ? status * 1 : 0;
}

function setPrintHospitalName(elm){
    window.localStorage["printHospitalName"] = (elm.checked) ? "1" : "0";
}
function printHospitalName(){
    // 妊娠歴：月経周期未満の場合の経過日数を１からカウント開始
    var status = window.localStorage["printHospitalName"];
    return (status) ? status * 1 : 0;
}

function setCommentCalendar(elm){
    window.localStorage["commentCalendar"] = (elm.checked) ? "1" : "0";
}
function commentCalendar(){
    // コメント付きカレンダーを印刷
    var status = window.localStorage["commentCalendar"];
    return (status) ? status * 1 : 0;
}

/////////////////////////////////////////////
///// DocMaker //////////////////////////////

function setSortDocMakerName(elm){
    window.localStorage["sortDocMakerName"] = (elm.checked) ? "1" : "0";
}
function sortDocMakerName(){
    // DocMaker の文書名をソート
    var status = window.localStorage["sortDocMakerName"];
    return (status) ? status * 1 : 0;
}

function setSortDocMakerAddress(elm){
    window.localStorage["sortDocAddress"] = (elm.checked) ? "1" : "0";
}
function sortDocAddress(){
    // DocMaker の宛先をソート
    var status = window.localStorage["sortDocAddress"];
    return (status) ? status * 1 : 0;
}

///// DocMaker //////////////////////////////
/////////////////////////////////////////////

/////////////////////////////////////////////
///// Prescription //////////////////////////

function setTouchAndGo(elm){
    // ピンを立てる：「確定」しても FORM は消えず NOA も編集モードから抜けない
    window.localStorage["prescriptionTouchAndGo"] = (elm.checked) ? "1" : "0";
}
function isTouchAndGo(){
    var status = window.localStorage["prescriptionTouchAndGo"];
    
    return (status && status * 1) ? true : false;
}

function setPrefConfirmPanel(elm){
    window.localStorage["prefConfirmPanel"] = (elm.checked) ? "1" : "0";
}
function prefConfirmPanel(elm){
    // 処方箋「確定」後、確認パネルを表示するか否かのステータスを返す
    var status = window.localStorage["prefConfirmPanel"];
    
    return (status && status * 1) ? true : false;
}

function setPrescClosePanel(elm){
    window.localStorage["prescClosePanel"] = (elm.checked) ? "1" : "0";
}
function prescClosePanel(){
    // 処方箋を印刷後、パネルを閉じる
    var status = window.localStorage["prescClosePanel"];
    
    return (status && status * 1) ? true : false;
}

///// Prescription //////////////////////////
/////////////////////////////////////////////


