/*
 * 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 );
	// 一覧背景色設定
	setTableColor("list");
	// 初期設定
	setFocus("");
	if (MODE == 0) {
		setVisibility("btnImport", false);
		setVisibility("btnReport", false);
	} else if (MODE == 1) {
		setVisibility("btnImport", true);
		setVisibility("btnReport", false);
	} else if (MODE == 2) {
		setVisibility("btnImport", false);
		setVisibility("btnReport", true);
	}
	setColumnWidth();
	if (TABLE == 0) {
		setObjectVisibility('list', false);
	}
	// 一覧背景色設定
	setTableColorEdith("list");
}

/**
 * サーバー通信処理
 * @param 無し
 * @return 無し
 * @throws 実行時例外
 */
function submitForm(objForm, cmd) {
	doSubmitMessage(objForm, cmd, 'QC0001', '');
}

/**
 * テーブル項目の長さ設定
 * @param	無し
 * @return	無し
 * @throws 実行時例外
 */
function setColumnWidth() {
	for (var i = 0; i < 43; i++) {
		setWidth('thColumn' + i, '45.6px');
	}
}

/**
 * 一覧背景色設定
 * @param strTargetTable 設定対象テーブルオブジェクトID
 * @return 無し
 * @throws 実行時例外
 */
function setTableColorEdith(strTargetTable) {
	var objTable = getObject(strTargetTable);
	if (objTable == null) {
		return;
	}
	var objTarget = null;
	var numHeader = 0;
	var numFooter = 0;
	if (objTable.tHead) {
    	numHeader = objTable.tHead.rows.length;
	}
	if (objTable.tFoot) {
    	numFooter = objTable.tFoot.rows.length;
	}
	for (var i = numHeader; i < objTable.rows.length - numFooter; i++ ) {

		if ((i-3) % 4 == 0){
			objTable.rows[i-1].bgColor = COLOR_TABLE_ROW2;
			objTable.rows[i].bgColor = COLOR_TABLE_ROW2;

			objTable.rows[i-1].onmouseout = function(){this.bgColor = COLOR_TABLE_ROW2};
			objTable.rows[i].onmouseout = function(){this.bgColor = COLOR_TABLE_ROW2};	
		} else {
			objTable.rows[i].bgColor = COLOR_TABLE_ROW1;
			objTable.rows[i].onmouseout = function(){this.bgColor = COLOR_TABLE_ROW1};
			
		}
	objTable.rows[i].onmouseover = function(){this.bgColor = COLOR_TABLE_SELECT;};
	}
}
