<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
  if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//地図表示
function Search_Map(addr){
 document.forms[0].ADDR.value=addr;
 document.forms[0].target="_blank";
 document.forms[0].submit(); 
}

//フォームリセット
function Reset() {
 document.forms[0].reset();
}

//フォームリセット2
function Reset2(n) {
 document.forms[n].reset();
}

//表示切替（トップページ用）
function showthis(obj) {
   if(!obj) return false;
   if(document.getElementById) {
      document.getElementById("2_1").style.display = "none";
      document.getElementById("3_1").style.display = "none";
      document.getElementById(obj + '_1').style.display = "block";
   } else {
      return false;
   }
}
//表示切替（詳細検索用）
function showthisnum(obj) {
   if(!obj) return false;
   if(document.getElementById) {
      document.getElementById("1").style.display = "none";
      document.getElementById("2").style.display = "none";
      document.getElementById("3").style.display = "none";
      document.getElementById(obj).style.display = "block";
   } else {
      return false;
   }
}

//ヘルプ表示
var newWindow;
function showhelp(title,msg,ex,width,height) {
  if (newWindow && !newWindow.closed) {
    newWindow.close();
  }
  if (!newWindow || newWindow.closed) {
    var options = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbar=1,resizable=0,";
    options = options + "width=" + width + ",";
    options = options + "height=" + height;
    newWindow = window.open("","help",options);
    newWindow.document.open();
    newWindow.document.write("<html><head><title>ヘルプ</title></head>\n");
    newWindow.document.write("<head>\n");
    newWindow.document.write("<title>ヘルプ</title>\n");
    newWindow.document.write("<style type='text/css'>\n");
    newWindow.document.write("body,td { font-size:x-small; background:#FFFFEE; font-family: 'ＭＳ Ｐゴシック', Osaka, 'ヒラギノ角ゴ Pro W3';}\n");
    newWindow.document.write("</style>\n");
    newWindow.document.write("</head>\n");
    newWindow.document.write("<body>\n");
    newWindow.document.write("<h4>"+ title +"</h4>\n");
    newWindow.document.write(msg +"\n");
    if(ex){
      newWindow.document.write("<hr size=1 noshade>\n");
      newWindow.document.write("<table><tr><td valign='top'><strong>例</strong></td><td valign='top' style='color:#0000FF;'>\n");
      newWindow.document.write(ex +"\n");
      newWindow.document.write("</td></tr></table>\n");
      newWindow.document.write("<hr size=1 noshade>\n");
    }else{
      newWindow.document.write("<br>\n");
    }
    newWindow.document.write("<br>\n");
    newWindow.document.write("<div align='center'><a href='#' onclick='JavaScript:window.close()'>閉じる</a></div>\n");
    newWindow.document.write("</body>\n");
    newWindow.document.write("</html>\n");
    newWindow.document.close();
  }
}


//入力チェックにひっかかったら、色を変えて留まる
function error(oj){
  if(!!oj.style){
    oj.style.backgroundColor='#ffff99';
    oj.focus();
  }
}
//入力チェックにひっかからなかったら、色を戻して進む
function ok(oj){
  if(!!oj.style){
    oj.style.backgroundColor='#ffffff';
    oj.blur();
  }
}

//入力チェック1（半角カンマ入力不可）
function chk1(oj){
  okstr = ',';
  str = oj.value;
  err = 0;
  for (i=0;i<str.length;i++){
    if (okstr.indexOf(str.charAt(i)) != -1) err++;
  }
  if(err!=0){
    alert('半角カンマは使用できません。');
    error(oj);
  }else{
    ok(oj);
  }
}

//入力チェック2（半角数字以外入力不可）
function chk2(oj){
  okstr = '1234567890.-';
  str = oj.value;
  err = 0;
  for (i=0;i<str.length;i++){
    if (okstr.indexOf(str.charAt(i)) == -1) err++;
  }
  if((err!=0)&&(str!=0)){
    alert('数字と小数点以外は入力できません。');
    error(oj);
  }else{
    ok(oj);
  }
}

//入力チェック3（半角英数字＆四則演算子＆アンダースコア＆ピリオド以外入力不可）
function chk3(oj){
  str = escape(oj.value);
  if(str.indexOf('%') != -1){
    alert('無効な文字を入力しました。入力し直してください。');
    error(oj);
  }else{
    ok(oj);
  }
}

//未入力チェック
function chktext(oj) {
  if(!oj.value){
    alert("この項目は必ず入力してください")
    error(oj);
  }else{
    ok(oj);
  }
}

//入力字数チェック
function chklen(oj,n) {
  if((oj.value.length != n)&&(oj.value.length != 0)){
    alert("ここは必ず"+ n +"文字で入力してください。");
    error(oj);
  }else{
    ok(oj);
  }
}

//yyyymmdd入力チェック
function chkdate(oj) {
  okstr = '1234567890*';
  str = oj.value;
  err = 0;
  for (i=0;i<str.length;i++){
    if (okstr.indexOf(str.charAt(i)) == -1) err++;
  }
  if((err!=0)&&(str!=0)){
    alert(okstr + '以外は入力できません。');
    error(oj);
  }else if((str.length != 8)&&(str!=0)){
    alert("ここは必ず8文字で入力してください。");
    error(oj);
  }else{
    ok(oj);
  }
}

//平米→坪
function m2tubo(oj,n){
  chk2(oj);
  if(err == 0){
    if((document.form1.elements[n].value == 0) && (oj.value != 0) && (err == 0)){
      document.form1.elements[n].value = Math.round((oj.value - 0) * 0.3025 * 10)/10;
    }
  }
}

//坪→平米
function tubom2(oj,n){
  chk2(oj);
  if(err == 0){
    if((document.form1.elements[n].value == 0) && (oj.value != 0)){
      document.form1.elements[n].value = Math.round((oj.value - 0) * 3.30578512 * 10)/10;
    }
  }
}

//建ぺい・容積率入力チェック＆自動入力
function chkrate(oj,n){
  chk2(oj);
  if(err == 0){
    if((document.form1.elements[n].value == 0) && (document.form1.elements[n+1].value != 0)){
      document.form1.elements[n].value = '-';
    }
    if((document.form1.elements[n].value == '-') && (document.form1.elements[n+1].value == 0)){
      document.form1.elements[n].value = '';
    }
  }
}
//敷金・礼金入力チェック＆自動入力
function chkprice2(oj,n){
  chk2(oj);
  if(err == 0){
    if((document.form1.elements[n].value == 0) && (document.form1.elements[n+1].value != 0)){
      document.form1.elements[n].value = '-';
    }
    if((document.form1.elements[n].value == '-') && (document.form1.elements[n+1].value == 0)){
      document.form1.elements[n].value = '';
    }
  }
}

//仲介料詳細
function chkprice4_1(oj,n){
  chk2(oj);
  if(err == 0){
    if((document.form1.elements[n].value == 0) && (document.form1.elements[n+1].value != 0)){
      document.form1.elements[n].value = '-';
    }
    if((document.form1.elements[n].value == '-') && (document.form1.elements[n+1].value == 0)){
      document.form1.elements[n].value = '';
    }
  }
}
function chkprice4_2(oj,n){
  chk1(oj);
  if(err == 0){
    if((document.form1.elements[n].value == 0) && (document.form1.elements[n+1].value != 0)){
      document.form1.elements[n].value = '-';
    }
    if((document.form1.elements[n].value == '-') && (document.form1.elements[n+1].value == 0)){
      document.form1.elements[n].value = '';
    }
  }
}
function inprice4_2(oj){
  if(oj.value == 0){
      oj.value = '賃料の1.05か月分';
  }
}
