function InputCheck() {
	var inpval, inpval2, tmpval;
	
	inpval	= document.getElementById('NameKs').value;
	if (inpval == '') {
		document.getElementById('NameKs').focus();
		alert('ご氏名（姓）を入力してください');
		return false;
	}
	inpval	= document.getElementById('NameKn').value;
	if (inpval == '') {
		document.getElementById('NameKn').focus();
		alert('ご氏名（名）を入力してください');
		return false;
	}
	inpval	= document.getElementById('NameFs').value;
	if (inpval == '') {
		document.getElementById('NameFs').focus();
		alert('フリガナ（姓）を入力してください');
		return false;
	}
	inpval	= document.getElementById('NameFn').value;
	if (inpval == '') {
		document.getElementById('NameFn').focus();
		alert('フリガナ（名）を入力してください');
		return false;
	}
	inpval	= document.getElementById('Sex1').checked;
	inpval2  = document.getElementById('Sex2').checked;
	if (inpval == false && inpval2 == false) {
		document.getElementById('Sex1').focus();
		alert('性別を入力してください');
		return false;
	}
// 	inpval	= document.getElementById('Yy').value;
// 	if (inpval == '') {
// 		document.getElementById('Yy').focus();
// 		alert('生年月日（年）を入力してください');
// 		return false;
// 	}
	inpval	= document.getElementById('Mm').value;
	if (inpval == '') {
		document.getElementById('Mm').focus();
		alert('生年月日（月）を入力してください');
		return false;
	}
	inpval	= document.getElementById('Dd').value;
	if (inpval == '') {
		document.getElementById('Dd').focus();
		alert('生年月日（日）を入力してください');
		return false;
	}
// 	tmpval = new Date();
// //alert(String(tmpval.getFullYear()) + '|' + String(tmpval.getMonth()+1) + '|' + String(tmpval.getDate()));
// 	tmpval.setYear(document.getElementById('Yy').value - 1900);
// 	tmpval.setMonth(document.getElementById('Mm').value - 1);
// 	tmpval.setDate(document.getElementById('Dd').value);
// 	tmpval.setHours(0);
// 	tmpval.setMinutes(0);
// 	tmpval.setSeconds(0);
// alert(String(tmpval.getFullYear()) + '|' + String(tmpval.getMonth()+1) + '|' + String(tmpval.getDate()) + '**' + Number(document.getElementById('Yy').value) + '|' + Number(document.getElementById('Mm').value) + '|' + Number(document.getElementById('Dd').value));
// 	if ( (tmpval.getFullYear() != Number(document.getElementById('Yy').value))
// 	  || (tmpval.getMonth() != Number((document.getElementById('Mm').value - 1)))
// 	  || (tmpval.getDate() != Number(document.getElementById('Dd').value)) ) {
// 		document.getElementById('Yy').focus();
// 		alert('生年月日を正しく入力してください');
// 		return false;
// 	}
	inpval = document.getElementById('PostCD').value;
	inpval = inpval.replace('-', '');
	if (inpval == '') {
		document.getElementById('PostCD').focus();
		alert('郵便番号を入力してください');
		return false;
	}
	if (inpval.length != 7) {
		document.getElementById('PostCD').focus();
		alert('郵便番号は７桁または８桁（ハイフン付）で入力してください');
		return false;
	}
	inpval	= document.getElementById('PrefName').value;
	if (inpval == '') {
		document.getElementById('PrefName').focus();
		alert('都道府県を入力してください');
		return false;
	}
	inpval	= document.getElementById('Address1').value;
	if (inpval == '') {
		document.getElementById('Address1').focus();
		alert('市区町村番地を入力してください');
		return false;
	}
	//if ((document.getElementById('TelNo1').value == '') || (document.getElementById('TelNo2').value == '') || (document.getElementById('TelNo3').value == ''))
	//	 ((document.getElementById('TelNo1').value == '') || (document.getElementById('TelNo2').value == '') || (document.getElementById('TelNo3').value == '')) {
	if ( !( ((document.getElementById('TelNo1').value != '') && (document.getElementById('TelNo2').value != '') && (document.getElementById('TelNo3').value != '')) ||
			((document.getElementById('PoTelNo1').value != '') && (document.getElementById('PoTelNo2').value != '') && (document.getElementById('PoTelNo3').value != '')) ) ){
		document.getElementById('TelNo1').focus();
		alert('電話番号を入力してください');
		return false;
	}
	inpval	= document.getElementById('Mail1').value;
	if (inpval == '') {
		document.getElementById('Mail1').focus();
		alert('第1メールアドレスを入力してください');
		return false;
	}
	inpval	= document.getElementById('Mail1Chk').value;
	if (inpval == '') {
		document.getElementById('Mail1Chk').focus();
		alert('第1メールアドレスを入力してください');
		return false;
	}
	if (document.getElementById('Mail1').value != document.getElementById('Mail1Chk').value) {
		document.getElementById('Mail1').focus();
		alert('メールアドレスは同じものを入力してください');
		return false;
	}
	if (document.getElementById('Mail2').value != document.getElementById('Mail2Chk').value) {
		document.getElementById('Mail2').focus();
		alert('メールアドレスは同じものを入力してください');
		return false;
	}
	inpval	= document.getElementById('Job').value;
	if (inpval == '') {
		document.getElementById('Job').focus();
		alert('ご職業を入力してください');
		return false;
	}
	if (inpval == 'その他') {
		if (document.getElementById('JobEtc').value == '') {
			document.getElementById('JobEtc').focus();
			alert('ご職業　その他の場合を入力してください');
			return false;
		}
	}
	if ((inpval != '主婦') && (inpval != '無職')) {
		inpval	= document.getElementById('CorpName').value;
		if (inpval == '') {
			document.getElementById('CorpName').focus();
			alert('お勤務先情報　名称を入力してください');
			return false;
		}
		inpval	= document.getElementById('CorpPosName').value;
		if (inpval == '') {
			document.getElementById('CorpPosName').focus();
			alert('お勤務先情報　所属部署 役職名を入力してください');
			return false;
		}
		inpval	= document.getElementById('CorpPostCD').value;
		if (inpval == '') {
			document.getElementById('CorpPostCD').focus();
			alert('お勤務先情報　郵便番号を入力してください');
			return false;
		}
		inpval	= document.getElementById('CorpPrefName').value;
		if (inpval == '') {
			document.getElementById('CorpPrefName').focus();
			alert('お勤務先情報　都道府県を入力してください');
			return false;
		}
		inpval	= document.getElementById('CorpAddress1').value;
		if (inpval == '') {
			document.getElementById('CorpAddress1').focus();
			alert('お勤務先情報　市区町村番地を入力してください');
			return false;
		}
		if ((document.getElementById('CorpTelNo1').value == '') || (document.getElementById('CorpTelNo2').value == '') || (document.getElementById('CorpTelNo3').value == '')) {
			document.getElementById('CorpTelNo1').focus();
			alert('お勤務先情報　電話番号を入力してください');
			return false;
		}
	}
	//if ((document.getElementById('Contact1').value == '') || (document.getElementById('Contact2').value == '') || (document.getElementById('Contact3').value == '')) {
	if (document.getElementById('Contact1').value == '') {
		document.getElementById('Contact1').focus();
		alert('指定連絡先を入力してください');
		return false;
	}
	inpval	= document.getElementById('BankName').value;
	if (inpval == '') {
		document.getElementById('BankName').focus();
		alert('銀行を入力してください');
		return false;
	}
	inpval	= document.getElementById('BankBranchName').value;
	if (inpval == '') {
		document.getElementById('BankBranchName').focus();
		alert('支店を入力してください');
		return false;
	}
	inpval	= document.getElementById('AccountKind').value;
	if (inpval == '') {
		document.getElementById('AccountKind').focus();
		alert('口座種別を入力してください');
		return false;
	}
	inpval	= document.getElementById('AccountNo').value;
	if (inpval == '') {
		document.getElementById('AccountNo').focus();
		alert('口座番号を入力してください');
		return false;
	}
	inpval	= document.getElementById('AccountNameKana').value;
	if (inpval == '') {
		document.getElementById('AccountNameKana').focus();
		alert('口座名義人（カナ）を入力してください');
		return false;
	}
	inpval	= document.getElementById('Salary').value;
	if (inpval == '') {
		document.getElementById('Salary').focus();
		alert('ご年収を入力してください');
		return false;
	}
	inpval	= document.getElementById('Shisan').value;
	if (inpval == '') {
		document.getElementById('Shisan').focus();
		alert('金融資産を入力してください');
		return false;
	}
	inpval	= document.getElementById('Motivation').value;
	if (inpval == '') {
		document.getElementById('Motivation').focus();
		alert('お取引の動機を入力してください');
		return false;
	}
	if (inpval == 'その他') {
		if (document.getElementById('MotivationEtc').value == '') {
			document.getElementById('MotivationEtc').focus();
			alert('お取引の動機　その他の場合を入力してください');
			return false;
		}
	}
	inpval	= document.getElementById('KabuGenbutsu').value;
	if (inpval == '') {
		document.getElementById('KabuGenbutsu').focus();
		alert('ご投資経験　株式（現物）を入力してください');
		return false;
	}
	inpval	= document.getElementById('KabuShinyo').value;
	if (inpval == '') {
		document.getElementById('KabuShinyo').focus();
		alert('ご投資経験　株式（信用）を入力してください');
		return false;
	}
	inpval	= document.getElementById('ToshiShintaku').value;
	if (inpval == '') {
		document.getElementById('ToshiShintaku').focus();
		alert('ご投資経験　投資信託を入力してください');
		return false;
	}
	inpval	= document.getElementById('Saiken').value;
	if (inpval == '') {
		document.getElementById('Saiken').focus();
		alert('ご投資経験　債権を入力してください');
		return false;
	}
	inpval	= document.getElementById('GaikaYokin').value;
	if (inpval == '') {
		document.getElementById('GaikaYokin').focus();
		alert('ご投資経験　外貨預金を入力してください');
		return false;
	}
	inpval	= document.getElementById('ShohinSakimono').value;
	if (inpval == '') {
		document.getElementById('ShohinSakimono').focus();
		alert('ご投資経験　商品先物取引を入力してください');
		return false;
	}
	inpval	= document.getElementById('FXTorihiki').value;
	if (inpval == '') {
		document.getElementById('FXTorihiki').focus();
		alert('ご投資経験　外国為替証拠金取引を入力してください');
		return false;
	}
	inpval	= document.getElementById('KinyuSakimono').value;
	if (inpval == '') {
		document.getElementById('KinyuSakimono').focus();
		alert('ご投資経験　金融先物取引（FX除く）を入力してください');
		return false;
	}

	inpval	= document.getElementById('Mokuteki1').checked;
	inpval2  = document.getElementById('Mokuteki2').checked;
	inpval3  = document.getElementById('Mokuteki3').checked;
	inpval4  = document.getElementById('Mokuteki4').checked;
	if (inpval == false && inpval2 == false && inpval3 == false && inpval4 == false) {
		document.getElementById('Mokuteki1').focus();
		alert('投資目的を入力してください');
		return false;
	}

	inpval	= document.getElementById('CourseSelect').value;
	if (inpval == '') {
		document.getElementById('CourseSelect').focus();
		alert('コース選択を入力してください');
		return false;
	}
	
	
	inpval = document.getElementById('Job').value;
	if (inpval == '無職') {
		document.getElementById('JobShinsei').checked = true;
	}
	
	
	return true;
}

function SendForm() {
	var frm;
	
	if (InputCheck() == false) {
		return false;
	} else {
		
		JobShinsei = document.getElementById('JobShinsei').checked;
		
// alert(JobShinsei);
// return false;
		
		frm = document.getElementById('Form');
		if (Age70MoreCheck()) {
			frm.action = 'account_70.php';
		} else {
			if (JobShinsei) {
				frm.action = 'account_fx.php';
			} else {
				frm.action = 'account_conf.php';
			}
		}
		
		//document.Form.submit();
		return true;
	}
}

function Age70MoreCheck() {
	var age = 0;
	
	Yy = document.getElementById('Yy').value;
	Mm = document.getElementById('Mm').value;
	Dd = document.getElementById('Dd').value;
	
	now = new Date();
	now_y = now.getYear();
	now_m = now.getMonth() + 1;
	now_d = now.getDate();
	if (now_y < 1900) { now_y = now_y + 1900; }
	if (now_m < Mm) { age = now_y - Yy - 1 }
	if (now_m > Mm) { age = now_y - Yy }
	if (now_m == Mm) {
		if (now_d < Dd) {
			age = now_y - Yy - 1
		} else {
			age = now_y - Yy
		}
	}
	
//alert("年齢："+age+"歳");
		
	if (age < 70) return false;
	else return true;
	
}

function account_fx_SubmitForm(){
	if (document.form_fx.ConfirmChk.checked == false) {
		alert("確認事項がチェックされていません！");
		return;
	}
	if (document.form_fx.KsgGak.value == "") {
		document.form_fx.KsgGak.focus();
		alert("金額を正しく入力してください。");
		return;
	}
	if (document.form_fx.KsgGak.value.match(/[^0-9]/g)) {
		alert("数値以外が含まれています。");
		return;
	}
	document.form_fx.submit();
}

function account_init_SubmitForm(){
	if (document.form_init.check1.checked == false ||
		document.form_init.check2.checked == false ||
		document.form_init.check3.checked == false ||
		document.form_init.check4.checked == false ||
		document.form_init.check5.checked == false ||
		document.form_init.check6.checked == false ||
		document.form_init.check7.checked == false) {
		alert("確認事項にチェックされていない項目があります！");
		return;
	}else{
		document.form_init.submit();
	}
}

function initColor(iColor){
	if(document.form_init.check1.checked == false){
	  document.form_init.check1.style.backgroundColor = iColor;
	  co1td.style.backgroundColor = iColor;
	}
	if(document.form_init.check2.checked == false){
	  document.form_init.check2.style.backgroundColor = iColor;
	  co2td.style.backgroundColor = iColor;
	}
	if(document.form_init.check3.checked == false){
	  document.form_init.check3.style.backgroundColor = iColor;
	  co3td.style.backgroundColor = iColor;
	}
	if(document.form_init.check4.checked == false){
	  document.form_init.check4.style.backgroundColor = iColor;
	  co4td.style.backgroundColor = iColor;
	}
	if(document.form_init.check5.checked == false){
	  document.form_init.check5.style.backgroundColor = iColor;
	  co5td.style.backgroundColor = iColor;
	}
	if(document.form_init.check6.checked == false){
	  document.form_init.check6.style.backgroundColor = iColor;
	  co6td.style.backgroundColor = iColor;
	}
	if(document.form_init.check7.checked == false){
	  document.form_init.check7.style.backgroundColor = iColor;
	  co7td.style.backgroundColor = iColor;
	}
}

function initColorForm(iColor){
	if(document.Form.NameKs.value == ''){
	  document.Form.NameKs.style.backgroundColor = iColor;
	}
	if(document.Form.NameKn.value == ''){
	  document.Form.NameKn.style.backgroundColor = iColor;
	}
	if(document.Form.NameFs.value == ''){
	  document.Form.NameFs.style.backgroundColor = iColor;
	}
	if(document.Form.NameFn.value == ''){
	  document.Form.NameFn.style.backgroundColor = iColor;
	}
	if(document.Form.Sex1.checked == false && document.Form.Sex2.checked == false){
	  tdSex.style.backgroundColor = iColor;
	}
	if(document.Form.Mm.value == ''){
	  document.Form.Mm.style.backgroundColor = iColor;
	}
	if(document.Form.Dd.value == ''){
	  document.Form.Dd.style.backgroundColor = iColor;
	}
	if(document.Form.PostCD.value == ''){
	  document.Form.PostCD.style.backgroundColor = iColor;
	}
	if(document.Form.PrefName.value == ''){
	  document.Form.PrefName.style.backgroundColor = iColor;
	}
	if(document.Form.Address1.value == ''){
	  document.Form.Address1.style.backgroundColor = iColor;
	}
	if(document.Form.TelNo1.value != '' && document.Form.TelNo2.value != '' && document.Form.TelNo3.value != '' || document.Form.PoTelNo1.value != '' && document.Form.PoTelNo2.value != '' && document.Form.PoTelNo3.value != ''){
	} else {
	  document.Form.TelNo1.style.backgroundColor = iColor;
	  document.Form.TelNo2.style.backgroundColor = iColor;
	  document.Form.TelNo3.style.backgroundColor = iColor;
	  document.Form.PoTelNo1.style.backgroundColor = iColor;
	  document.Form.PoTelNo2.style.backgroundColor = iColor;
	  document.Form.PoTelNo3.style.backgroundColor = iColor;
	}
	if(document.Form.Mail1.value == ''){
	  document.Form.Mail1.style.backgroundColor = iColor;
	}
	if(document.Form.Mail1Chk.value == ''){
	  document.Form.Mail1Chk.style.backgroundColor = iColor;
	}
	if(document.Form.Job.value == ''){
	  document.Form.Job.style.backgroundColor = iColor;
	}
	if(document.Form.CorpName.value == ''){
	  document.Form.CorpName.style.backgroundColor = iColor;
	}
	if(document.Form.CorpPosName.value == ''){
	  document.Form.CorpPosName.style.backgroundColor = iColor;
	}
	if(document.Form.CorpPostCD.value == ''){
	  document.Form.CorpPostCD.style.backgroundColor = iColor;
	}
	if(document.Form.CorpPrefName.value == ''){
	  document.Form.CorpPrefName.style.backgroundColor = iColor;
	}
	if(document.Form.CorpAddress1.value == ''){
	  document.Form.CorpAddress1.style.backgroundColor = iColor;
	}
	if(document.Form.CorpTelNo1.value == ''){
	  document.Form.CorpTelNo1.style.backgroundColor = iColor;
	}
	if(document.Form.CorpTelNo2.value == ''){
	  document.Form.CorpTelNo2.style.backgroundColor = iColor;
	}
	if(document.Form.CorpTelNo3.value == ''){
	  document.Form.CorpTelNo3.style.backgroundColor = iColor;
	}
	if(document.Form.Contact1.value == ''){
	  document.Form.Contact1.style.backgroundColor = iColor;
	}
	if(document.Form.BankName.value == ''){
	  document.Form.BankName.style.backgroundColor = iColor;
	}
	if(document.Form.BankBranchName.value == ''){
	  document.Form.BankBranchName.style.backgroundColor = iColor;
	}
	if(document.Form.AccountKind.value == ''){
	  document.Form.AccountKind.style.backgroundColor = iColor;
	}
	if(document.Form.AccountNo.value == ''){
	  document.Form.AccountNo.style.backgroundColor = iColor;
	}
	if(document.Form.AccountNameKana.value == ''){
	  document.Form.AccountNameKana.style.backgroundColor = iColor;
	}
	if(document.Form.Salary.value == ''){
	  document.Form.Salary.style.backgroundColor = iColor;
	}
	if(document.Form.Shisan.value == ''){
	  document.Form.Shisan.style.backgroundColor = iColor;
	}
	if(document.Form.Motivation.value == ''){
	  document.Form.Motivation.style.backgroundColor = iColor;
	}
	if(document.Form.KabuGenbutsu.value == ''){
	  document.Form.KabuGenbutsu.style.backgroundColor = iColor;
	}
	if(document.Form.KabuShinyo.value == ''){
	  document.Form.KabuShinyo.style.backgroundColor = iColor;
	}
	if(document.Form.ToshiShintaku.value == ''){
	  document.Form.ToshiShintaku.style.backgroundColor = iColor;
	}
	if(document.Form.Saiken.value == ''){
	  document.Form.Saiken.style.backgroundColor = iColor;
	}
	if(document.Form.GaikaYokin.value == ''){
	  document.Form.GaikaYokin.style.backgroundColor = iColor;
	}
	if(document.Form.ShohinSakimono.value == ''){
	  document.Form.ShohinSakimono.style.backgroundColor = iColor;
	}
	if(document.Form.FXTorihiki.value == ''){
	  document.Form.FXTorihiki.style.backgroundColor = iColor;
	}
	if(document.Form.KinyuSakimono.value == ''){
	  document.Form.KinyuSakimono.style.backgroundColor = iColor;
	}
	if(document.Form.Mokuteki1.checked == false && document.Form.Mokuteki2.checked == false  && document.Form.Mokuteki3.checked == false  && document.Form.Mokuteki4.checked == false){
	  tdMokuteki.style.backgroundColor = iColor;
	}
	if(document.Form.CourseSelect.value == ''){
	  document.Form.CourseSelect.style.backgroundColor = iColor;
	}
}

function initColorForm70(iColor){
	if(document.Form.AgeChk.checked == false){
		document.Form.AgeChk.style.backgroundColor = iColor;
		tdAge.style.backgroundColor = iColor;
	}
}

function initColorFormFx(iColor){
	if(document.form_fx.ConfirmChk.checked == false){
		document.form_fx.ConfirmChk.style.backgroundColor = iColor;
		tdNoJob.style.backgroundColor = iColor;
	}
	if(document.form_fx.KsgGak.value == ''){
	  document.form_fx.KsgGak.style.backgroundColor = iColor;
	}
}

