/*
  必須項目チェック
  param   ojForm:必須項目のフォーム
  return  毎必須項目は入力場合、trueを戻す、そうしないと、falseを戻す
 */
function CheckRequired(ojForm){

	var strError="";      // エラーメッセージ
	var outError="";
	var index =0;
	var count =0;
	var len   =ojForm.elements.length;

	var nmLen;
	var itemName;
	for(count=0;count<len;count++){
	   	if(ojForm.elements[count].required=="true"){    // 必須項目です
	   	    if(Trim(ojForm.elements[count].value)==""){
	   	       // strError = strError+"["+ojForm.elements[count].itemdesp+"] "+
	   	       //            "は必須項目です。入力してください。\n";	
	   	       strError = strError+ojForm.elements[count].itemdesp+"\n" ; 	        
	   	    }
	   	}
	}
	if(Trim(strError)!=""){

		//outError = "入力エラー\n";
		alert(outError+strError);
		return false;
	}
	return true;
}

/* trim left and right space */
function Trim(TheString)
{
	var len;

	len = TheString.length;
 	while(TheString.substring(0,1) == " "){ //trim left
 		TheString = TheString.substring(1, len);
  		len = TheString.length;
	}

 	while(TheString.substring(len-1, len) == " "){ //trim right
 		TheString = TheString.substring(0, len-1);
  		len = TheString.length;
 	}
 	return TheString;
}
