//全角数字を半角に
function toHankakuNum(motoText)
{
	han = "0123456789.,-+";
	zen = "０１２３４５６７８９．，−＋";
	str = "";
	for (i=0; i<motoText.length; i++)
	{
		c = motoText.charAt(i);
		n = zen.indexOf(c,0);
		if (n >= 0) c = han.charAt(n);
		str += c;
	}
	return str;
}
//セレクトメニューからその他を選ぶ
function select_SW() {
	//ご依頼内容の目的
	if(document.estiFORM.MOKUTEKI.value == "その他"){
	document.estiFORM.MOKUTEKI_SONOTA.disabled =false;
	}else{
	document.estiFORM.MOKUTEKI_SONOTA.disabled =true;
	}
	
	//写真加工
	if(document.estiFORM.SOZAI_KAKO.value == "背景消し、合成等の複雑な写真加工"){
	document.estiFORM.SOZAI_KAKOSU.disabled =false;
	}else{
	document.estiFORM.SOZAI_KAKOSU.disabled =true;
	}

//撮影の必要
	if(document.estiFORM.SATSUEI.value == "あり"){
	document.estiFORM.SATSUEI_SONOTA.disabled =false;
	}else{
	document.estiFORM.SATSUEI_SONOTA.disabled =true;
	}


//ロゴの必要
	if(document.estiFORM.LOGO.value == "あり"){
	document.estiFORM.LOGO_SONOTA.disabled =false;
	}else{
	document.estiFORM.LOGO_SONOTA.disabled =true;
	}
	
//地図の必要
	if(document.estiFORM.CHIZU.value == "あり"){
	document.estiFORM.CHIZU_SONOTA.disabled =false;
	}else{
	document.estiFORM.CHIZU_SONOTA.disabled =true;
	}
	
//知った場所
	if(document.estiFORM.ANCAITE.value == "その他"){
	document.estiFORM.ANCAITE_SONOTA.disabled =false;
	}else{
	document.estiFORM.ANCAITE_SONOTA.disabled =true;
	}
	
}

function check()
{
//文字種変換（全角数を半角数に）
document.estiFORM.PAGE_KAZU.value=toHankakuNum(document.estiFORM.PAGE_KAZU.value);
document.estiFORM.YOSAN.value=toHankakuNum(document.estiFORM.YOSAN.value);
document.estiFORM.DIGITALDATA.value=toHankakuNum(document.estiFORM.DIGITALDATA.value);
document.estiFORM.FILMPRINT.value=toHankakuNum(document.estiFORM.FILMPRINT.value);
document.estiFORM.SOZAI_KAKOSU.value=toHankakuNum(document.estiFORM.SOZAI_KAKOSU.value);
document.estiFORM.SATSUEI_SONOTA.value=toHankakuNum(document.estiFORM.SATSUEI_SONOTA.value);
document.estiFORM.LOGO_SONOTA.value=toHankakuNum(document.estiFORM.LOGO_SONOTA.value);
document.estiFORM.CHIZU_SONOTA.value=toHankakuNum(document.estiFORM.CHIZU_SONOTA.value);
document.estiFORM.YEAR.value=toHankakuNum(document.estiFORM.YEAR.value);
document.estiFORM.MONTH.value=toHankakuNum(document.estiFORM.MONTH.value);
document.estiFORM.DAY.value=toHankakuNum(document.estiFORM.DAY.value);


//名前入力チェック
	name = document.estiFORM.NAME.value;
	if (name == ""){
	alert("名前が入力されていません");
	document.estiFORM.NAME.focus();//フォーカス
	return false;
	}
	

//メールアドレスチェック

			txt = document.estiFORM.MAIL.value; 
			data = txt.match(/^\S+@\S+\.\S+$/);
			if (!data){
			alert("メールアドレスが正しくありません");
			document.estiFORM.MAIL.focus();//フォーカス
			return false;
			}
	
			
//依頼内容入力チェック
	IRAI = document.estiFORM.IRAI.value;
	if (IRAI == ""){
	alert("依頼内容が選択されていません");
	document.estiFORM.IRAI.focus();//フォーカス
	return false;
	}

//予定ページ数入力チェック
	PAGE_KAZU = document.estiFORM.PAGE_KAZU.value;
	PAGE_KAZU2 = document.estiFORM.PAGE_KAZU2.checked;
	if(String(PAGE_KAZU).match(/[^0-9]/g)){alert("予定（希望）ページ数に数値以外は入力できません");document.estiFORM.PAGE_KAZU.focus();return false;}
	if (PAGE_KAZU == "" && PAGE_KAZU2 == false){
	alert("予定（希望）ページ数が入力されていません");
	document.estiFORM.PAGE_KAZU.focus();//フォーカス
	return false;
	}
	
//ご依頼内容の目的入力チェック
	MOKUTEKI = document.estiFORM.MOKUTEKI.value;
	if (MOKUTEKI == ""){
	alert("ご依頼内容の目的が選択されていません");
	document.estiFORM.MOKUTEKI.focus();//フォーカス
	return false;
	}
	
//素材点数入力チェック
	DIGITALDATA = document.estiFORM.DIGITALDATA.value;
	FILMPRINT = document.estiFORM.FILMPRINT.value;
	//SOZAI_SONOTA = document.estiFORM.SOZAI_SONOTA.value;
	if(String(DIGITALDATA).match(/[^0-9]/g)){alert("使用素材点数に数値以外は入力できません");document.estiFORM.DIGITALDATA.focus();return false;}
	if(String(FILMPRINT).match(/[^0-9]/g)){alert("使用素材点数に数値以外は入力できません");document.estiFORM.FILMPRINT.focus();return false;}
	/*if (DIGITALDATA == "" && FILMPRINT == "" && SOZAI_SONOTA == ""){
	alert("使用素材が入力されていません");
	document.estiFORM.DIGITALDATA.focus();//フォーカス
	return false;
	}*/
	
//使用サーバー入力チェック
	SERVER = document.estiFORM.SERVER.value;
	if (SERVER == ""){
	alert("使用するサーバーが選択されていません");
	document.estiFORM.SERVER.focus();//フォーカス
	return false;
	}
	
//納品日入力チェック
	YEAR = document.estiFORM.YEAR.value;
	MONTH = document.estiFORM.MONTH.value;
	DAY = document.estiFORM.DAY.value;
	if(String(YEAR+MONTH+DAY).match(/[^0-9]/g)){alert("納品日に数値以外は入力できません");document.estiFORM.YEAR.focus();return false;}
	if (YEAR == "" || MONTH == "" || DAY == ""){
	alert("納品希望日が入力されていません");
	document.estiFORM.YEAR.focus();//フォーカス
	return false;
	}
}