/**
* ナイトライド入力チェックスクリプト
*/
/* 共通関数をインクルードする */
document.write('<script src="../common_euc.js?" type="text/javascript"></script>\n');

/* 
* 定数定義
*/
//メッセージ用文字列
var MSG_EMPTY = 'Enter ';
var MSG_NO_NUMBER = ' in half-size character.';
var MSG_NO_SELECT = 'Select ';

/*
* confirmSend
* 送信するか否か確認する
*
* @return true / false
*/
function confirmSend(){
	if (confirm("It transmits. Is it all right?")){
		return(true);
	} else {
		return(false);
	}
}


/*
* 共通項目入力チェック
*/
function isCheckCommon(theForm){
	var obj;
	
	//氏名
	if (isEmpty(theForm,'Name')){
		alert( MSG_EMPTY + 'First Name.' );//警告用 dialog box
		return false;
	}
	//フリガナ
	if (isEmpty(theForm,'Kana')){
		alert( MSG_EMPTY + "Last Name." );//警告用 dialog box
		return false;
	}
	//会社所在地
	if (isEmpty(theForm,'Adr')){
		alert( MSG_EMPTY + "Address." );//警告用 dialog box
		return false;
	}
	//郵便番号
	if (isEmpty(theForm,'Zip')){
		alert( MSG_EMPTY + "Zip Code." );//警告用 dialog box
		return false;
	}
	//Country
	if (isEmpty(theForm,'Country')){
		alert( MSG_EMPTY + "Country." );//警告用 dialog box
		return false;
	}
	//TEL
	if (isEmpty(theForm,'Tel')){
		alert( MSG_EMPTY + "Phone Number." );//警告用 dialog box
		return false;
	}
	//Mail
	if (isEmpty(theForm,'Mail')){
		alert( MSG_EMPTY + "E-mail address." );//警告用 dialog box
		return false;
	}
	
	return true;
}

/*
* showErrMsgForWaferAll
* Waferの全て未入力の場合のエラーメッセージを表示する。
*/
function showErrMsgForWaferAll(){
	alert('Entry the request and application.');
}

/*
* showErrMsgForChip
* Chipのエラーメッセージを表示する。
*
* @param	object	theForm		フォームオブジェクト
* @param	integer	isReq		エラー番号
* @param	string	ctrlSeihin	製品コントロール名
* @param	string	ctrlSeihin2	製品コントロール名2
* @param	string	ctrlRank	ランクコントロール名
* @param	string	ctrlSuryo1	数量1コントロール名
* @param	string	ctrlSuryo2	数量2コントロール名
* @param	string	ctrlSuryo3	数量3コントロール名
*/
function showErrMsgForChip( theForm , isReq , ctrlSeihin , ctrlSeihin2 , ctrlRank , ctrlSuryo1 , ctrlSuryo2 , ctrlSuryo3 ){
	switch (isReq){
		case ERR_NO_SEIHIN_1:
		case ERR_NO_SEIHIN_2:
			alert(MSG_NO_SELECT + 'Description.');
			if (isReq == ERR_NO_SEIHIN_1){
				theForm.elements[ctrlSeihin].focus();
			} else {
				theForm.elements[ctrlSeihin2].focus();
			}
			break;
		case ERR_NO_RANK:
			alert(MSG_NO_SELECT + 'Rank.');
			theForm.elements[ctrlRank].focus();
			break;
		case ERR_SELECT_RANK:
			alert(MSG_NO_SELECT + 'Rank.');
			theForm.elements[ctrlRank].focus();
			break;
		case ERR_NO_ALL_SURYO:
			alert(MSG_EMPTY + 'Quantity');
			theForm.elements[ctrlSuryo1].focus();
			break;
		case ERR_SELECT_SEIHIN:
			alert(MSG_NO_SELECT + 'Model No.');
			theForm.elements[ctrlSeihin].focus();
			break;
			/*
		case ERR_LOWER_SUURYO:
			alert('指定の製品は' + CHIP_LOWER_SUURYO + '個単位で入力してください。');
			break;
		case ERR_LOWER_SAMPLE_SUURYO:
			alert('指定の製品は' + CHIP_LOWER_SAMPLE_SUURYO + '個単位で入力してください。');
			break;
			*/
		case ERR_NUM_SUURYO:
			alert(MSG_EMPTY + 'Quantity' + MSG_NO_NUMBER);
			break;
	}
}

/*
* showErrMsgForChipAll
* Chipの全て未入力の場合のエラーメッセージを表示する。
*/
function showErrMsgForChipAll(){
		alert('Entry the contents of the quotation request.');
}

/*
* showErrMsgForLamp
* Lampのエラーメッセージを表示する。
*
* @param	object	theForm		フォームオブジェクト
* @param	integer	isReq		エラー番号
* @param	string	ctrlSeihin1	製品1コントロール名
* @param	string	ctrlSeihin2	製品2コントロール名
* @param	string	ctrlRank	ランクコントロール名
* @param	string	ctrlSuryo1	数量1コントロール名
* @param	string	ctrlSuryo2	数量2コントロール名
* @param	string	ctrlSuryo3	数量3コントロール名
*/
function showErrMsgForLamp( theForm , isReq , ctrlSeihin1 , ctrlSeihin2 , ctrlRank , ctrlSuryo1 , ctrlSuryo2 , ctrlSuryo3 ){
	switch (isReq){
		case ERR_NO_SEIHIN_1:
		case ERR_NO_SEIHIN_2:
			alert(MSG_NO_SELECT + 'Description.');
			if (isReq == ERR_NO_SEIHIN_1){
				theForm.elements[ctrlSeihin1].focus();
			} else {
				theForm.elements[ctrlSeihin2].focus();
			}
			break;
		case ERR_NO_RANK:
			alert(MSG_NO_SELECT + 'Rank.');
			theForm.elements[ctrlRank].focus();
			break;
		case ERR_SELECT_RANK:
			alert(MSG_NO_SELECT + 'Rank.');
			theForm.elements[ctrlRank].focus();
			break;
		case ERR_NO_ALL_SURYO:
			alert(MSG_EMPTY + 'Quantity');
			theForm.elements[ctrlSuryo1].focus();
			break;
		case ERR_SELECT_SEIHIN:
			alert(MSG_NO_SELECT + 'Model No.');
			theForm.elements[ctrlSeihin1].focus();
			break;
			/*
		case ERR_LOWER_SUURYO:
			alert('指定の製品は' + LAMP_LOWER_SUURYO + '個単位で入力してください。');
			break;
			*/
		case ERR_NUM_SUURYO:
			alert(MSG_EMPTY + 'Quantity' + MSG_NO_NUMBER);
			break;
	}
}

/*
* showErrMsgForLampAll
* Lampの全て未入力の場合のエラーメッセージを表示する。
*/
function showErrMsgForLampAll(){
		alert('Entry the contents of the quotation request.');
}

/*
* showErrMsgForModule
* Lampのエラーメッセージを表示する。
*
* @param	object	theForm		フォームオブジェクト
* @param	integer	isReq		エラー番号
* @param	string	ctrlSeihin1	製品1コントロール名
* @param	string	ctrlSeihin2	製品2コントロール名
* @param	string	ctrlSuryo1	数量1コントロール名
* @param	string	ctrlSuryo2	数量2コントロール名
* @param	string	ctrlSuryo3	数量3コントロール名
*/
function showErrMsgForModule( theForm , isReq , ctrlSeihin1 , ctrlSeihin2 , ctrlSuryo1 , ctrlSuryo2 , ctrlSuryo3 ){
	switch (isReq){
		case ERR_NO_SEIHIN_1:
		case ERR_NO_SEIHIN_2:
			alert(MSG_NO_SELECT + 'Description.');
			if (isReq == ERR_NO_SEIHIN_1){
				theForm.elements[ctrlSeihin1].focus();
			} else {
				theForm.elements[ctrlSeihin2].focus();
			}
			break;
		case ERR_NO_ALL_SURYO:
			alert(MSG_EMPTY + 'Quantity');
			theForm.elements[ctrlSuryo1].focus();
			break;
		case ERR_SELECT_SEIHIN:
			alert(MSG_NO_SELECT + 'Model No.');
			theForm.elements[ctrlSeihin1].focus();
			break;
			/*
		case ERR_LOWER_SUURYO:
			alert('指定の製品は' + LAMP_LOWER_SUURYO + '個単位で入力してください。');
			break;
			*/
		case ERR_NUM_SUURYO:
			alert(MSG_EMPTY + 'Quantity' + MSG_NO_NUMBER);
			break;
	}
}

/*
* showErrMsgForModuleAll
* Moduleの全て未入力の場合のエラーメッセージを表示する。
*/
function showErrMsgForModuleAll(){
		alert('Entry the contents of the quotation request.');
}
