
function month_onoff(){
	var slc;
	for (i=1; i<=8; i++){
		var sid="o"+i;
		if(document.getElementById(sid).style.color=="#020202"){
			document.getElementById(sid).style.color = "#d3d3d3";
		}else{
			document.getElementById(sid).style.color = "#020202";
			if(!slc){
				document.getElementById(sid).selected = true;
				slc=1;
			}
		}
	}
}

function day_onoff(){
	var opy=new Array("o1","o2","o3","o4","o5","o6","o7","o8"); 
	var sid = document.myForm.day.selectedIndex;
	if(document.getElementById(opy[sid]).style.color=="#d3d3d3"){
		for (i=1; i<=8; i++){
			var sid="o"+i;
			if(document.getElementById(sid).style.color=="#020202"){
				document.getElementById(sid).selected = true;
				return;
			}
		}
	}
}


function orderinp_check() {			///////　エラーチェック　///////
/* */ 
	cell = document.myForm.name;
	txt=cell.value;
	if (!txt) {
		alert("お名前を入力してください。");
		cell.focus();
		return false;
    }
/* */ 
	cell = document.myForm.zip;
	txt=cell.value;
	if (!txt) {
		alert("郵便番号を入力してください。");
		cell.focus();
		return false;
    }
/* */ 
	cell = document.myForm.zip;
	txt=cell.value;
	if (txt) {
	    if (txt.length !=8 || !txt.match(/^\d{3}-\d{4}$|^\d{3}-\d{2}$|^\d{3}$/)) {
			alert("郵便番号が間違っています。");
			cell.focus();
			return false;
	    }
	}
/* */ 
	cell = document.myForm.address;
	txt=cell.value;
	if (!txt) {
		alert("ご住所を入力してください。");
		cell.focus();
		return false;
    }
/* */ 
	cell = document.myForm.url;
	txt=cell.value;
	if (!txt) {
		alert("サイトURLを入力してください。");
		cell.focus();
		return false;
    }
/* */ 
	cell = document.myForm.email;
	txt=cell.value;
	if (!txt) {
		alert("メールアドレスを入力してください。");
		cell.focus();
		return false;
    }
/* */ 
	cell = document.myForm.email;
	txt=cell.value;
    if (!txt.match(/.+@.+\..+/)) {
		alert("メールアドレスの書式に間違いがあります。");
		cell.focus();
        return false;
    }
/* */ 
	cell = document.myForm.phone;
	txt=cell.value;
	if (!txt) {
		alert("電話番号を入力してください。");
		cell.focus();
		return false;
    }
/* */ 
	cell = document.myForm.phone;
	txt=cell.value;
	data1 = txt.match(/^[0-9-]{6,9}$|^[0-9-]{12}$/);
	data2 = txt.match(/^\d{1,4}-\d{4}$|^\d{2,5}-\d{1,4}-\d{4}$/);
	if(!data1 && !data2) {
		alert("電話番号が間違っています。");
		cell.focus();
		return false;
	}
/* */ 
	cell = document.myForm.fax;
	txt=cell.value;
	if (txt) {
		data1 = txt.match(/^[0-9-]{6,9}$|^[0-9-]{12}$/);
		data2 = txt.match(/^\d{1,4}-\d{4}$|^\d{2,5}-\d{1,4}-\d{4}$/);
		if(!data1 && !data2) {
			alert("FAX番号が間違っています。");
			cell.focus();
			return false;
	    }
	}
/* */ 
	cell = document.myForm.furikomimei;
	txt=cell.value;
	if (!txt) {
		alert("お振込人名を入力してください。");
		cell.focus();
		return false;
    }
/* */ 
	if(document.myForm.bank[0].checked==false && document.myForm.bank[1].checked==false){
		alert("お振込先を選んでください。");
		return false;
	}
/* */ 
	cell = document.myForm.fmonth;
	txt=cell.value;
	if (!txt) {
		alert("お振込予定月を入力してください。");
		cell.focus();
		return false;
    }
/* */ 
	cell = document.myForm.fday;
	txt=cell.value;
	if (!txt) {
		alert("お振込予定日を入力してください。");
		cell.focus();
		return false;
    }
/* */ 
	today = new Date();
	ty = today.getYear();
	tm = today.getMonth();
	td = today.getDate();
	nm = document.myForm.fmonth.value-1;
	nd = document.myForm.fday.value;
	inpday = new Date(ty,nm,nd);
	if((tm != nm || td != nd) && today > inpday){
		alert("振込予定日が間違っています。");
		return false;
	}

/* */ 
	if(confirm("内容に間違いありませんか？　今一度確認してください。　ＯＫボタンで送信します。")){
		return true;
	}else{
		return false;
	}
}




function key_check(fcName){
	if(fcName=="lic1"){
		if(document.myForm.lic1.value.length==4){
			if(document.myForm.lic2.value==""){
				document.myForm.lic2.focus();
			}
		}else if(document.myForm.lic1.value.length>4){
			document.myForm.lic1.value = document.myForm.lic1.value.substring(0, 4);
		}
	}else if(fcName=="lic2"){
		if(document.myForm.lic2.value.length==4){
			if(document.myForm.lic3.value==""){
				document.myForm.lic3.focus();
			}
		}else if(document.myForm.lic2.value.length>4){
			document.myForm.lic2.value = document.myForm.lic2.value.substring(0, 4);
		}
	}else if(fcName=="lic3"){
		if(document.myForm.lic3.value.length==4){
			document.myForm.ok.disabled=false;
		}else if(document.myForm.lic3.value.length>4){
			document.myForm.lic3.value = document.myForm.lic3.value.substring(0, 4);
		}
	}

	if(document.myForm.lic1.value.length==4 && document.myForm.lic2.value.length==4 && document.myForm.lic3.value.length==4){
		document.myForm.ok.disabled=false;
	}else{
		document.myForm.ok.disabled=true;
	}
}
