// JavaScript Document
<!--
//---------------------初期設定---------------------

var formName="contact"; //作業フォーム名を指定

//##表示名
F_mes=new Array();
F_mes[0]="Name";
F_mes[1]="Country";
F_mes[2]="Company";
F_mes[3]="E-Mail";
F_mes[4]="Coment/Request";

//##チェック項目 (yes:1)
F_ch=new Array();
F_ch[0]="1";
F_ch[1]="1";
F_ch[2]="0";
F_ch[3]="1";
F_ch[4]="1";

var formMail=3;
//---------------------設定終了---------------------

//フォーム削除
function formClear(formElement){
	if(formElement.value=='&nbsp;'){formElement.value='';}
}

//入力確認
function inputCheck(){
for( i=0 ; i<document[formName].length ; i++ ){document[formName].elements[i].style.backgroundColor='#FFFFFF'}
for( i=0 ; i<document[formName].length ; i++ ){
if(F_ch[i]==1){
	if(document[formName].elements[i].type == "select-one" && document[formName].elements[i].options[0].selected){
		alert("Please choose the "+F_mes[i]);
		document[formName].elements[i].focus();
		document[formName].elements[i].style.backgroundColor='#ccc';
		return false;
	}
	else{
		if(document[formName].elements[i].value == "" ){ 
			if(i==formMail && document[formName].elements[i].value == ""){
				alert("Please input the "+F_mes[i]);
				document[formName].elements[i].focus();
				document[formName].elements[i].style.backgroundColor='#ccc';
				return false;
			}
			alert("Please input the "+F_mes[i]);
			document[formName].elements[i].focus();
			document[formName].elements[i].style.backgroundColor='#ccc';
			return false; 
		}
		if(i==formMail){
			_ret=_ChkStringEmail(document[formName].elements[i].value);
			if (_ret!=true){
			window.alert("The format of an input E-Mail address is wrong.");
			document[formName].elements[i].style.backgroundColor='#ccc';
			return false;
			}
		}
	}
}
}
}


function _ChkStringEmail(str){
	if (str.match(/[!"#$%&'\(\)=\\|,:;^\[\]\{\}`*?<>]/)){
	return false;
	}
	else{
		if (str.indexOf("@",0)<=0){
			return false;
		}
		else{
			return true;
		}
	}
}

//-->


