<!-- JavaScript
function syusei(){
	with (document.forms[0]){	
		chk_p.value = "1";
		window.status = "データ送信しました。(処理中！！)";		
		btnLock("chk3");
		btnLock("chk2");
		submit();
		return true;
	}
}
function soushin(){
	with (document.forms[0]){
		chk_p.value = "2";
		window.status = "データ送信しました。(処理中！！)";
		btnLock("chk2");
		btnLock("chk3");		
		submit();		
		return true;
	}
}
function kakunin(){

	with (document.forms[0]){
		if(chkForm() == "F"){		//Fに暫定
			return false;
		}
		chk_p.value = "";
		window.status = "データ送信しました。(処理中！！)";
		btnLock("chk1");
		submit();		
		return true;
	}	
}
function btnLock(ivalue){
		document.getElementById(ivalue).disabled = true;	
}
function chkForm(){

	var sts;
	var c_fg;
	sts = "以下の項目の確認をお願いいたします。\n";
	c_fg = 0;
	with (document.forms[0]){

		if (carMaker.selectedIndex == 0){
			sts = sts + "\nメーカーを選択してください。" ;
			if( c_fg == 0) carMaker.focus();
				c_fg++;
		}
		if (car_name.selectedIndex == 0){
			sts = sts + "\n車種を選択してください。" ;
			if( c_fg == 0) car_name.focus();
				c_fg++;
		}
		if (katashiki.selectedIndex == 0){
			sts = sts + "\n年式を選択してください。" ;
			if( c_fg == 0) katashiki.focus();
				c_fg++;
		}
		if (mileage.selectedIndex == 0){
			sts = sts + "\n走行距離を選択してください。" ;
			if( c_fg == 0) mileage.focus();
				c_fg++;
		}		
		if (chkNull(bodycolor.value) == "F"){
			sts = sts + "\n車体色を入力してください。" ;
			if( c_fg == 0) bodycolor.focus();
				c_fg++;
		}			
		if (chkNull(honbun.value) != "F"){
			if (chkNullZen() == "F"){
				sts = sts + "\nアピールポイントの内容が空白のようです。" ;
				if( c_fg == 0) honbun.focus();
					c_fg++;
			}
			else {
				if (chkLength() == "F"){
					if( c_fg == 0) honbun.focus();
					c_fg++;
				}
			}
		}	
		if (chkNull(u_name.value) == "F"){
			sts = sts + "\nお名前を入力してください。" ;
			if( c_fg == 0) u_name.focus();
				c_fg++;
		}
		if (chkNull(u_tel.value) == "F"){
			sts = sts + "\nお電話番号を入力して下さい。" ;
			if( c_fg == 0) u_tel.focus();
				c_fg++;
		}
		else if(chkTelno(u_tel.value) == "F"){
			sts = sts + "\nお電話番号は、半角数値とハイフンのみです。" ;
			if( c_fg == 0) u_tel.focus();
				c_fg++;
		}

		if (chkNull(u_mail.value) == "F"){
			sts = sts + "\nメールアドレスを入力して下さい。" ;
			if( c_fg == 0) u_mail.focus();
				c_fg++;
		}
		else {
			if (chkMailadd(u_mail.value) == "F"){
				sts = sts + "\nメールアドレスに誤りがあるようです。" ;
				if( c_fg == 0) u_mail.focus();
					c_fg++;
			}
		}

		if (chkNull(add.value) == "F"){
			sts = sts + "\nご住所を入力してください。" ;
			if( c_fg == 0) add.focus();
				c_fg++;
		}		

	}
 	if( c_fg != 0 ) { 
	alert(sts);
 		return "F";
 	} 
}
function chkZipSend(){

	var sts;
	var c_fg;
	sts = "以下の項目の確認をお願いいたします。\n";
	c_fg = 0;
	with (document.forms[0]){

		if (chkNull(zip.value) == "F"){
			sts = sts + "\n郵便番号は３桁以上入力してください。" ;
			if( c_fg == 0) zip.focus();
				c_fg++;
		}
		else {
			if(chkTelno(zip.value) == "F"){
				sts = sts + "\n郵便番号は、半角数値とハイフンのみです。" ;
				if( c_fg == 0) zip.focus();
					c_fg++;
			}
			if(chkZipLen(zip.value) == "F"){
				sts = sts + "\n郵便番号は３桁以上入力してください。" ;
				if( c_fg == 0) zip.focus();
					c_fg++;
			}			
		}
	}
 	if( c_fg != 0 ) { 
	alert(sts);
 		return "F";
 	} 
}
function zip_list() {
	var imput_zip = "";
	var ur = "";
	zip_init();
	with (document.forms[0]){
		if(chkZipSend() == "F"){		//Fに暫定
			return false;
		}
		imput_zip = zip.value;
		ur = "./selectzip.php?zip=" + imput_zip;
		window.self.propertyName = "mainview";
		subview = window.open(ur,"sub","width=300,height=300,scrollbars=1,status=0,resizable=1,toolbar=0,menubar=0,location=0");
	}
}
function zip_init() {
	$("cityData").update("");
	$("townData").update("");
	$("add1").selectedIndex = 0;
	document.forms[0].add.value = "";
}
function formSend(){
	with (document.forms[0]){
		if(chkForm() == "F"){		//Fに暫定
			return false;
		}
		window.status = "データ送信しました。(処理中！！)";
		submit();
		return true;
	}
}
function chkNull(ivalue){
    if (ivalue.length == 0) {
      return "F";
		}
		else {
			return ivalue;
		}
}
// 数字(.小数点禁止)
function chkSeisu(ivalue){
  var newString = "";
  for (i = 0; i < ivalue.length; i++) {
      ch = ivalue.substring(i, i+1);
      if (ch >= "0" && ch <= "9") {
          newString += ch;
      }
  }
	if (ivalue != newString) {
		return "F";
	}
	else {
		return ivalue;
	}
}
function chkMailadd(ivalue){
  var newString = "";
	var cnt1 = 0;
	var cnt2 = 0;
  for (i = 0; i < ivalue.length; i++) {
      ch = ivalue.substring(i, i+1);
      if (ch == "@"){
          cnt1 = cnt1 + 1;
      }
      if (ch == "."){
          cnt2 = cnt2 + 1;
      }
  }
	if ((cnt1 != 1)||(cnt2 == 0)) {
		return "F";
	}
	else {
		return ivalue;
	}
}

// 全角の空白チェック
function chkNullZen() {
	var temp = "";
	var cnt = 0;
	var c = "";
	temp = document.forms[0].honbun.value;
		
		for (i=0; i<temp.length; i++) {
			c = temp.substr(i, 1);

			if ((c == "　")||(c == " ")){
				cnt = cnt + 1;
			}
		}
		if (cnt == temp.length){
			return "F";
		}
}

// レングスチェック
function chkLength() {
	var len;
	len = document.forms[0].honbun.value.length;

	if(len > 1000){
		alert("1000文字以上は送信できません。\n(現在"+len+"文字です)");
		return "F";
	}
}
function chkZipLen(ivalue) {
	var len;
	len = document.forms[0].zip.value.length;

	if(len < 3){
		return "F";
	}
	else {
		return ivalue;
	}	
}
function chkTelno(ivalue){
  var newString = "";
  for (i = 0; i < ivalue.length; i++) {
      ch = ivalue.substring(i, i+1);
      if ((ch >= "0" && ch <= "9") || (ch == "-")) {
          newString += ch;
      }
  }
	if (ivalue != newString) {
		return "F";
	}
	else {
		return ivalue;
	}
}
// -->
