
window.onload = function(){

//　問い合せ内容
	document.getElementById("iq_type1").onclick = function(){
		if(this.checked){
			document.getElementById("msgadd").style.display = "block";
		} else {
			document.getElementById("msgadd").style.display = "";
		}
	}

//　名前チェック
	document.getElementById("name_kanji").onchange = function(){
		grname = document.getElementById("name_kanji").value;
		grpos = grname.indexOf(" ",1) + grname.indexOf("　",1);
		if(grpos <= 0){
			alert("姓と名の間にはスペースを入れてください。");
			document.getElementById("name_kanji").style.backgroundColor = "#ffffdb";
			document.getElementById("name_kanji").focus();
		} else {
			document.getElementById("name_kanji").style.backgroundColor = "#ffffff";
		}
	}

//　フリガナチェック
	document.getElementById("name_kana").onchange = function(){
		grname = document.getElementById("name_kana").value;
		grpos = grname.indexOf(" ",1) + grname.indexOf("　",1);
		if(grpos <= 0){
			alert("姓と名の間にはスペースを入れてください。");
			document.getElementById("name_kana").style.backgroundColor = "#ffffdb";
			document.getElementById("name_kana").focus();
		} else {
			document.getElementById("name_kana").style.backgroundColor = "#ffffff";
		}
	}


//　郵便番号
	document.getElementById("sd_zip").onkeyup = function(){
		n = document.iq_form.sd_zip.value.length;
		if(n >= 3){
			document.getElementById("sd_zip2").focus();
		} else {
		}
	}

//　メールアドレスチェック
	document.getElementById("email").onchange = function(){
		txt = document.getElementById("email").value;
		data = txt.match(/^\S+@\S+\.\S+$/);
		if(!data){
			alert("メールアドレスの形式が正しくありません。");
			document.getElementById("email").style.backgroundColor = "#ffffdb";
			document.getElementById("email").focus();
		} else {
			document.getElementById("email").style.backgroundColor = "#ffffff";
		}
	}


}


/* END window.onload -------------------------------------------------- */
