/*
 * MosP - Mind Open Source Project         http://www.mosp.jp/
 * Copyright (C) 1987-2009 MIND Co., Ltd.  http://www.e-mind.co.jp/
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
// メニューボタン定数 
var NAM_MENU = new Array(
	"勤怠入力",
	"スケジュール",
	"有休確認",
	"パスワード変更"
); 

var CMD_MENU = new Array(
	"K1010",
	"K1200",
	"K1300",
	"C1050"
);

/**
 * 画面読込時追加処理
 * @param 無し
 * @return 無し
 * @throws 実行時例外
 */
function onLoadExtra() {
	setMenu();
}

/**
 * メニュー設定
 * @param 無し
 * @return 無し
 * @throws 実行時例外
 */
function setMenu() {
	setInnerHtml(getObject("0"), NAM_MENU[0]);
	for (var i = 1; i < NAM_MENU.length; i++) {
		var obj = copyObject("0", new String(i));
		setInnerHtml(obj, NAM_MENU[i]);
	}
}

/**
 * メニューボタン押下時処理
 * @param idx メニューインデックス
 * @return 無し
 * @throws 実行時例外
 */
function clickMenu(idx) {
	doSubmit(document.form, CMD_MENU[idx]);
}

/**
 * オブジェクトコピー
 * @param fromId コピー元オブジェクトID
 * @param toId   コピーオブジェクトID
 * @return コピーオブジェクト
 * @throws 実行時例外
 */
function copyObject(fromId, toId) {
	var target = getObject(fromId);
	var clone  = target.cloneNode(true);
	clone.id = toId;
	target.parentNode.insertBefore(clone, null);
	return clone;
}
