/*
 * MosP - Mind Open Source Project    http://www.mosp.jp/
 * Copyright (C) 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.
 */
/**
 * 画面読込時追加処理
 * @param 無し
 * @return 無し
 * @throws 実行時例外
 */
function onLoadExtra() {
	// 初期設定
	// 項目背景色設定
	setFieldsBgColor(ARY_FIELDS_ID,     COLOR_FIELD_NORMAL);
	setFieldsBgColor(ARY_ERR_FIELDS_ID, COLOR_FIELD_ERROR);
	// 項目長設定	
	setMaxLength(PRM_TXT_PAY_BASIC_MONTH1	, LEN_AMOUNT);
	setMaxLength(PRM_TXT_PAY_BASIC_MONTH2	, LEN_AMOUNT);
	setMaxLength(PRM_TXT_PAY_BASIC_MONTH3	, LEN_AMOUNT);
	setMaxLength(PRM_TXT_PAY_BASIC_DAY1	, LEN_AMOUNT);
	setMaxLength(PRM_TXT_PAY_BASIC_DAY2	, LEN_AMOUNT);
	setMaxLength(PRM_TXT_PAY_BASIC_DAY3	, LEN_AMOUNT);
	setMaxLength(PRM_TXT_PAY_AMOUNT1	, LEN_AMOUNT);
	setMaxLength(PRM_TXT_PAY_AMOUNT2	, LEN_AMOUNT);
	setMaxLength(PRM_TXT_PAY_AMOUNT3	, LEN_AMOUNT);
	setMaxLength(PRM_TXT_GOODS_AMOUNT1	, LEN_AMOUNT);
	setMaxLength(PRM_TXT_GOODS_AMOUNT2	, LEN_AMOUNT);
	setMaxLength(PRM_TXT_GOODS_AMOUNT3	, LEN_AMOUNT);
	setMaxLength(PRM_TXT_REWARD_TOTAL1	, LEN_AMOUNT);
	setMaxLength(PRM_TXT_REWARD_TOTAL2	, LEN_AMOUNT);
	setMaxLength(PRM_TXT_REWARD_TOTAL3	, LEN_AMOUNT);
	setMaxLength(PRM_TXT_REWARD_TOTAL_SUM	, LEN_AMOUNT);
	setMaxLength(PRM_TXT_AVERAGE_THREE_MONTHS	, LEN_AMOUNT);
	setMaxLength(PRM_TXT_EDIT_AVERAGE	, LEN_AMOUNT);
	setMaxLength(PRM_TXT_HEALTH_BEF_GRADE	, LEN_AMOUNT);
	setMaxLength(PRM_TXT_HEALTH_BEF_PREMIUM	, LEN_AMOUNT);
	setMaxLength(PRM_TXT_PENSION_BEF_GRADE	, LEN_AMOUNT);
	setMaxLength(PRM_TXT_PENSION_BEF_PREMIUM	, LEN_AMOUNT);
	setMaxLength(PRM_TXT_HEALTH_DEC_GRADE	, LEN_AMOUNT);
	setMaxLength(PRM_TXT_HEALTH_DEC_PREMIUM	, LEN_AMOUNT);
	setMaxLength(PRM_TXT_PENSION_DEC_GRADE	, LEN_AMOUNT);
	setMaxLength(PRM_TXT_PENSION_DEC_PREMIUM	, LEN_AMOUNT);
	setMaxLength(PRM_TXT_RETROACTIVE_PAYMENT	, LEN_AMOUNT);
	setMaxLength(PRM_TXT_RAISE_DOWN_SALARY_BASIS	, LEN_AMOUNT);
}

/**
 * サーバー通信処理
 * @param 無し
 * @return 無し
 * @throws 実行時例外
 */
function submitForm(objForm) {
	// 入力チェック
	if (validate()) {
		// サーバー通信(入力エラー無の場合)
		doSubmitMessage(objForm, 'P4005', 'QC0001', '');
	}
}




/**
 * 入力チェック
 * @param 無し
 * @return チェック結果(true：OK、false：NG)
 * @throws 実行時例外
 */
function validate() {
	// フィールド背景色設定
	setFieldsBgColor(ARY_FIELDS_ID, COLOR_FIELD_NORMAL);
	// 入力チェック
	var aryMessage = new Array();
	//checkCode(PRM_TXT_K_CODE, NAM_K_CODE, aryMessage);
		checkLength(PRM_TXT_PAY_AMOUNT1            , LEN_AMOUNT, NAM_PAY_AMOUNT1            , aryMessage);
		checkLength(PRM_TXT_PAY_AMOUNT2            , LEN_AMOUNT, NAM_PAY_AMOUNT2            , aryMessage);
		checkLength(PRM_TXT_PAY_AMOUNT3            , LEN_AMOUNT, NAM_PAY_AMOUNT3            , aryMessage);
		checkLength(PRM_TXT_GOODS_AMOUNT1          , LEN_AMOUNT, NAM_GOODS_AMOUNT1          , aryMessage);
		checkLength(PRM_TXT_GOODS_AMOUNT2          , LEN_AMOUNT, NAM_GOODS_AMOUNT2          , aryMessage);
		checkLength(PRM_TXT_GOODS_AMOUNT3          , LEN_AMOUNT, NAM_GOODS_AMOUNT3          , aryMessage);
		checkLength(PRM_TXT_REWARD_TOTAL1          , LEN_AMOUNT, NAM_REWARD_TOTAL1          , aryMessage);
		checkLength(PRM_TXT_REWARD_TOTAL2          , LEN_AMOUNT, NAM_REWARD_TOTAL2          , aryMessage);
		checkLength(PRM_TXT_REWARD_TOTAL3          , LEN_AMOUNT, NAM_REWARD_TOTAL3          , aryMessage);
		checkLength(PRM_TXT_REWARD_TOTAL_SUM       , LEN_AMOUNT, NAM_REWARD_TOTAL_SUM       , aryMessage);
		checkLength(PRM_TXT_AVERAGE_THREE_MONTHS   , LEN_AMOUNT, NAM_AVERAGE_THREE_MONTHS   , aryMessage);
		checkLength(PRM_TXT_EDIT_AVERAGE           , LEN_AMOUNT, NAM_EDIT_AVERAGE           , aryMessage);
		checkLength(PRM_TXT_HEALTH_BEF_GRADE       , LEN_AMOUNT, NAM_HEALTH_BEF_GRADE       , aryMessage);
		checkLength(PRM_TXT_HEALTH_BEF_PREMIUM     , LEN_AMOUNT, NAM_HEALTH_BEF_PREMIUM     , aryMessage);
		checkLength(PRM_TXT_PENSION_BEF_GRADE      , LEN_AMOUNT, NAM_PENSION_BEF_GRADE      , aryMessage);
		checkLength(PRM_TXT_PENSION_BEF_PREMIUM    , LEN_AMOUNT, NAM_PENSION_BEF_PREMIUM    , aryMessage);
		checkLength(PRM_TXT_HEALTH_DEC_GRADE       , LEN_AMOUNT, NAM_HEALTH_DEC_GRADE       , aryMessage);
		checkLength(PRM_TXT_HEALTH_DEC_PREMIUM     , LEN_AMOUNT, NAM_HEALTH_DEC_PREMIUM     , aryMessage);
		checkLength(PRM_TXT_PENSION_DEC_GRADE      , LEN_AMOUNT, NAM_PENSION_DEC_GRADE      , aryMessage);
		checkLength(PRM_TXT_PENSION_DEC_PREMIUM    , LEN_AMOUNT, NAM_PENSION_DEC_PREMIUM    , aryMessage);
		checkLength(PRM_TXT_RETROACTIVE_PAYMENT    , LEN_AMOUNT, NAM_RETROACTIVE_PAYMENT    , aryMessage);
		checkLength(PRM_TXT_RAISE_DOWN_SALARY_BASIS, LEN_AMOUNT, NAM_RAISE_DOWN_SALARY_BASIS, aryMessage);
	
	if (aryMessage.length == 0) {
		return true;
	} else {
		showMessage(aryMessage);
		return false;
	}
}

/**
 * 例外処理
 * @param e 例外オブジェクト
 * @return 無し
 * @throws 無し
 */
/*function handleException(e) {
	alert("クライアントエラーが発生しました。");
	
	if (e.description != null) {
		alert(e.description);
	}
	throw e;
	
}*/



