//------------------------------------------------
// form共用
//------------------------------------------------
//全角角数字配列
var char1 = new Array("１","２","３","４","５","６","７","８","９","０","‐");
//半角数字配列
var char2 = new Array(1,2,3,4,5,6,7,8,9,0,"-");
var count;
function Fulltohalf(id){
   var str = "$('" + id + "')";
    var obj = eval(str);
    var data = obj.value; 

    while(data.match(/[０-９]/)){       //入力データに全角数字がある場合
        for(count = 0; count < char1.length; count++){
                //入力データを全角数字から半角数字に置換する
            data = data.replace(char1[count], char2[count]);
        }
    }
    obj.value = data;  //半角数字に置換したデータを設定
}

function MultiToSingle_Kana( id ){
   var str = "$('" + id + "')" ;
    var obj = eval(str);
    var data = obj.value; 
        //検索文字列を変換するための変換文字列配列
    var Kana1 = new Array("ｶﾞ","ｷﾞ","ｸﾞ","ｹﾞ","ｺﾞ","ｻﾞ","ｼﾞ","ｽﾞ","ｾﾞ","ｿﾞ","ﾀﾞ","ﾁﾞ",
        "ﾂﾞ","ﾃﾞ","ﾄﾞ","ﾊﾞ","ﾋﾞ","ﾌﾞ","ﾍﾞ","ﾎﾞ","ﾊﾟ","ﾋﾟ","ﾌﾟ","ﾍﾟ","ﾎﾟ","ｦ","ｧ",
        "ｨ","ｩ","ｪ","ｫ","ｬ","ｭ","ｮ","ｯ","ｰ","ｱ","ｲ","ｳ","ｴ","ｵ","ｶ","ｷ","ｸ","ｹ",
        "ｺ","ｻ","ｼ","ｽ","ｾ","ｿ","ﾀ","ﾁ","ﾂ","ﾃ","ﾄ","ﾅ","ﾆ","ﾇ","ﾈ","ﾉ","ﾊ","ﾋ",
        "ﾌ","ﾍ","ﾎ","ﾏ","ﾐ","ﾑ","ﾒ","ﾓ","ﾔ","ﾕ","ﾖ","ﾗ","ﾘ","ﾙ","ﾚ","ﾛ","ﾜ","ﾝ");
    var Kana2 = new Array("ガ","ギ","グ","ゲ","ゴ","ザ","ジ","ズ","ゼ","ゾ","ダ","ヂ",
        "ヅ","デ","ド","バ","ビ","ブ","ベ","ボ","パ","ピ","プ","ペ","ポ","ヲ","ァ",
        "ィ","ゥ","ェ","ォ","ャ","ュ","ョ","ッ","ー","ア","イ","ウ","エ","オ","カ",
        "キ","ク","ケ","コ","サ","シ","ス","セ","ソ","タ","チ","ツ","テ","ト","ナ",
        "ニ","ヌ","ネ","ノ","ハ","ヒ","フ","ヘ","ホ","マ","ミ","ム","メ","モ","ヤ",
        "ユ","ヨ","ラ","リ","ル","レ","ロ","ワ","ン");
    while(str.match(/[ｦ-ﾝ]/)){                              //半角カタカナがある場合
        for(var i = 0; i < Kana1.length; i++){
            str = str.replace(Kana1[i], Kana2[i]);  //文字列置換
        }
    }
    obj.value = str;           //フォームに書きこむ
}

function MultiToSingle_AB( id ){
   var str = "$('" + id + "')";  
    var obj = eval(str);
    var data = obj.value; 
        //検索文字列を変換するための変換文字列配列
    var ZEN = new Array(
        "ｶﾞ","ｷﾞ","ｸﾞ","ｹﾞ","ｺﾞ","ｻﾞ","ｼﾞ","ｽﾞ","ｾﾞ","ｿﾞ","ﾀﾞ","ﾁﾞ",
        "ﾂﾞ","ﾃﾞ","ﾄﾞ","ﾊﾞ","ﾋﾞ","ﾌﾞ","ﾍﾞ","ﾎﾞ","ﾊﾟ","ﾋﾟ","ﾌﾟ","ﾍﾟ","ﾎﾟ","ｦ","ｧ",
        "ｨ","ｩ","ｪ","ｫ","ｬ","ｭ","ｮ","ｯ","ｰ","ｱ","ｲ","ｳ","ｴ","ｵ","ｶ","ｷ","ｸ","ｹ",
        "ｺ","ｻ","ｼ","ｽ","ｾ","ｿ","ﾀ","ﾁ","ﾂ","ﾃ","ﾄ","ﾅ","ﾆ","ﾇ","ﾈ","ﾉ","ﾊ","ﾋ",
        "ﾌ","ﾍ","ﾎ","ﾏ","ﾐ","ﾑ","ﾒ","ﾓ","ﾔ","ﾕ","ﾖ","ﾗ","ﾘ","ﾙ","ﾚ","ﾛ","ﾜ","ﾝ"
        );
    var HAN = new Array("ガ","ギ","グ","ゲ","ゴ","ザ","ジ","ズ","ゼ","ゾ","ダ","ヂ",
        "ヅ","デ","ド","バ","ビ","ブ","ベ","ボ","パ","ピ","プ","ペ","ポ","ヲ","ァ",
        "ィ","ゥ","ェ","ォ","ャ","ュ","ョ","ッ","ー","ア","イ","ウ","エ","オ","カ",
        "キ","ク","ケ","コ","サ","シ","ス","セ","ソ","タ","チ","ツ","テ","ト","ナ",
        "ニ","ヌ","ネ","ノ","ハ","ヒ","フ","ヘ","ホ","マ","ミ","ム","メ","モ","ヤ",
        "ユ","ヨ","ラ","リ","ル","レ","ロ","ワ","ン");
    while(str.match(/[ｦ-ﾝ]/)){                              //半角カタカナがある場合
        for(var i = 0; i < Kana1.length; i++){
            str = str.replace(Kana1[i], Kana2[i]);  //文字列置換
        }
    }
    obj.value = str;           //フォームに書きこむ
}

function zentohan(id){
  var str = "$('" + id + "')" ;
  var obj = eval(str);
  if( typeof(obj.value) != "string" ) return false;
  var han= '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@-.,:';
  var zen= '１２３４５６７８９０ａｂｃｄｅｆｇｈｉｊｋｌｍｎｏｐｑｒｓｔｕｖｗｘｙｚＡＢＣＤＥＦＧＨＩＪＫＬＭＮＯＰＱＲＳＴＵＶＷＸＹＺ＠－．，：';
  var word = obj.value;
  for(i=0; i<zen.length; i++){
    var regex = new RegExp(zen[i],"gm");
    word = word.replace(regex,han[i]);
  }
  obj.value = word;
}

function gender_check(gender, f_id) {
  var str = "$('" + f_id + "')" 
  var obj = eval(str);
  new Ajax.Request('/check_form/gender_js/?f_value='+ obj.value + '&gender=' + gender , {asynchronous:true, evalScripts:true});
  return false;
}
function fill_check(id, f_id, controller) {
  var str = "$('" + f_id + "')" 
  var obj = eval(str);
   //alert('/' +  controller + '/fill_js/?f_value='+ obj.value + '&id=' + id);
  new Ajax.Request('/' +  controller + '/fill_js/?f_value='+ obj.value + '&id=' + id , {asynchronous:true, evalScripts:true});
  return false;
}

function check_privacy() {
  check_flg = false;
  if ($('privacy').value) {
    if ($('privacy').checked) {
      check_flg = true;
    }
  }
  if (check_flg) {
    document.entry_form.submit();
    return false;
  } else {
    alert('個人情報保護方針・当サイトのご利用規約にご同意ください。');
  }
}

//------------------------------------------------
// entry用
//------------------------------------------------
function fill_kana_check(id, f_id) {
  var str = "$('" + f_id + "')" 
  var obj = eval(str);
  new Ajax.Request('/check_form/fill_kana_js/?f_value='+ obj.value + '&id=' + id , {asynchronous:true, evalScripts:true});
  //alert('/entry/fill_kana_js/?f_value='+ obj.value + '&id=' + id);
  return false;
}


function  mail_confirm(){
  if($('user_pc_mail_confirm').value == $('user_pc_mail').value ){
    $('comment_pc_mail_confirm').innerHTML = "<span class='ok'><img src='/images/form/icon-ok.gif' alt='ok' /></span>";
  }else{
     $('comment_pc_mail_confirm').innerHTML = "<span class='error'>メールアドレス確認が一致しません</span>"
  }
}

function zip_check() {
  new Ajax.Request('/check_form/zip_js/?f_value='+ $("user_zip_code").value  , {asynchronous:true, evalScripts:true});
  return false;
}

function tel_check(id) {
  new Ajax.Request('/check_form/tel_js/?home_tel='+ $("user_home_tel").value + '&mobi_tel=' + $("user_mobi_tel").value + '&id=' + id , {asynchronous:true, evalScripts:true});
  return false;
}


function  change_show_hide(id, checked){
  var str = "$('" + id + "')" 
  var obj = eval(str);
  if(obj){
    if(obj.style.display == 'none' && checked){
      obj.style.display = "block";
    }else if(obj.style.display == 'block' && !(checked)){
      obj.style.display = "none";
    }
  }
}

function  biz_show_hide(id, checked){
    change_show_hide(id, checked);
    if(checked){
       $('biz0').checked = false;
    }
}

function  other_show_hide(checked){
  if(checked){
       $('biz1').checked = false;
       $('biz_select1').style.display = 'none';
       $('biz2').checked = false;
       $('biz_select2').style.display = 'none';
       $('biz3').checked = false;
       $('biz_select3').style.display = 'none';
       $('biz4').checked = false;
       $('biz_select4').style.display = 'none';
       $('biz5').checked = false;
       $('biz_select5').style.display = 'none';
       $('biz6').checked = false;
       $('biz_select6').style.display = 'none';
  }
}


function mail_check(id,f_id,necessary) {
  var str = "$('" + f_id + "')" 
  var obj = eval(str);
  new Ajax.Request('/check_form/email_js/?f_value='+ obj.value + '&id=' + id  + '&necessary=' + necessary  , {asynchronous:true, evalScripts:true});
  return false;
}


function check_all() {
  var biz_id = eval($('business_id').innerHTML)
  
  new Ajax.Request('/entry/check_all/?business_id='+ biz_id + "&user_name_sei=" + $("user_name_sei").value  + "&user_name_mei=" + $("user_name_mei").value + "&user_name_sei_kana=" + $("user_name_sei_kana").value + "&user_name_mei_kana=" + $("user_name_mei_kana").value + "&user_gender_0=" +  $("user_gender_0").checked + "&user_gender_1=" + $("user_gender_1").checked + "&date_year=" + $("date_year").value + "&date_month=" +  $("date_month").value + "&date_day=" +  $("date_day").value + "&user_pref=" +  $("user_pref").value + "&user_city=" + $("user_city").value + "&user_address=" + $("user_address").value + "&user_zip_code=" +  $("user_zip_code").value + "&user_home_tel=" +  $("user_home_tel").value + "&user_mobi_tel=" + $("user_mobi_tel").value + "&user_pc_mail=" + $("user_pc_mail").value + "&pc_mail_confirm=" +  $("user_pc_mail_confirm").value + "&user_mobi_mail=" + $("user_mobi_mail").value + "&user_exp1=" +  $("user_exp1").value + "&user_exp2=" + $("user_exp2").value + "&user_exp3=" +  $("user_exp3").value + "&user_exp4=" +   $("user_exp4").value + "&user_exp5=" + $("user_exp5").value + "&textarea=" + $("textarea").value  + "&biz0=" + $("biz0").checked + "&biz1=" + $("biz1").checked + "&biz2=" + $("biz2").checked + "&biz3=" + $( "biz3").checked + "&biz4=" + $("biz4").checked + "&biz5=" + $("biz5").checked  + "&biz6=" + $("biz6").checked   + "&privacy=" + $("privacy").checked  , {asynchronous:true, evalScripts:true});
  return false;
}


function entry_initiarize(){
  Event.observe($("user_name_sei"), "blur", function(){  fill_check(0, "user_name_sei", "entry"), check_all() }, true);
  Event.observe($("user_name_mei"), "blur", function(){  fill_check(1, "user_name_mei", "entry"), check_all() }, true);
  Event.observe($("user_name_sei_kana"), "blur", function(){  fill_kana_check(0, "user_name_sei_kana"), check_all() }, true);
  Event.observe($("user_name_mei_kana"), "blur", function(){  fill_kana_check(1, "user_name_mei_kana") , check_all()}, true);
  Event.observe($("user_gender_0"), "click", function(){  gender_check(0, "user_gender_0") , check_all()}, true);
  Event.observe($("user_gender_1"), "click", function(){  gender_check(1, "user_gender_1") , check_all()}, true);
  Event.observe($("date_year"), "change", function(){  fill_check(3, "date_year", "entry") , check_all()}, true);
  Event.observe($("date_month"), "change", function(){  fill_check(4, "date_month", "entry"), check_all() }, true);
  Event.observe($("date_day"), "change", function(){  fill_check(5, "date_day", "entry"), check_all() }, true);
  Event.observe($("user_pref"), "blur", function(){  fill_check(6, "user_pref", "entry"), check_all() }, true);
  Event.observe($("user_city"), "blur", function(){  fill_check(7, "user_city", "entry"), check_all() }, true);
  Event.observe($("user_address"), "blur", function(){  fill_check(8, "user_address", "entry"), check_all() }, true);
  Event.observe($("user_zip_code"), "blur", function(){ Fulltohalf("user_zip_code"), zip_check() , check_all() }, true);
  Event.observe($("user_pref"), "blur", function(){  fill_check(6, "user_pref", "entry"), check_all() }, true);
  Event.observe($("user_city"), "blur", function(){  fill_check(7, "user_city", "entry"), check_all() }, true);
  Event.observe($("user_address"), "blur", function(){  fill_check(8, "user_address", "entry")    , check_all() }, true);
  Event.observe($("user_zip_code"), "blur", function(){ Fulltohalf("user_zip_code"), zip_check()  , check_all() }, true);
  Event.observe($("user_home_tel"), "blur", function(){ Fulltohalf("user_home_tel") , tel_check(0), check_all() }, true);
  Event.observe($("user_mobi_tel"), "blur", function(){ Fulltohalf("user_mobi_tel") , tel_check(1), check_all() }, true);
  Event.observe($("user_pc_mail"), "blur", function(){mail_check(0,"user_pc_mail",true), check_all()  }, true);
  Event.observe($("user_pc_mail_confirm"), "blur", function(){  mail_confirm(), check_all() }, true);
  Event.observe($("user_mobi_mail"), "blur", function(){ mail_check(1,"user_mobi_mail",false), check_all()  }, true);
  Event.observe($("user_exp1"), "change", function(){ fill_check(9, "user_exp1" , "entry"), check_all() }, true);
  Event.observe($("user_exp2"), "change", function(){ fill_check(10, "user_exp2", "entry"), check_all()  }, true);
  Event.observe($("user_exp3"), "change", function(){ fill_check(11, "user_exp3", "entry"), check_all()  }, true);
  Event.observe($("user_exp4"), "change", function(){ fill_check(12, "user_exp4", "entry"), check_all()  }, true);
  Event.observe($("user_exp5"), "change", function(){ fill_check(13, "user_exp5", "entry"), check_all()  }, true);
  Event.observe($("textarea"), "blur"   , function(){ fill_check(14, "textarea" , "entry") , check_all() }, true);

  Event.observe($("biz0"), "click", function(){ other_show_hide( $("biz0").checked) , check_all() }, true);
  Event.observe($("biz1"), "click", function(){ biz_show_hide("biz_select1" , $("biz1").checked) , check_all() }, true);
  Event.observe($("biz2"), "click", function(){ biz_show_hide("biz_select2" , $("biz2").checked) , check_all() }, true);
  Event.observe($("biz3"), "click", function(){ biz_show_hide("biz_select3" , $("biz3").checked) , check_all() }, true);
  Event.observe($("biz4"), "click", function(){ biz_show_hide("biz_select4" , $("biz4").checked) , check_all() }, true);
  Event.observe($("biz5"), "click", function(){ biz_show_hide("biz_select5" , $("biz5").checked) , check_all() }, true);
  Event.observe($("biz6"), "click", function(){ biz_show_hide("biz_select6" , $("biz6").checked) , check_all() }, true);

  Event.observe($("privacy"), "click", function(){ entry_privacy_check(), check_all() }, true);
}

function direct_check_all() {
  new Ajax.Request('/direct_entry/check_all/?hope_pref_id=' + $("hope_pref_id").value + '&ind_1=' + $("ind_1").checked + '&ind_2=' + $("ind_2").checked + '&ind_3=' + $("ind_3").checked  + '&ind_4=' + $("ind_4").checked + '&ind_5=' + $("ind_5").checked + '&ind_6=' + $("ind_6").checked + '&ind_7=' + $("ind_7").checked + '&ind_8=' + $("ind_8").checked + '&hope_time=' + $("hope_time").value + '&other=' + $("other").value +  '&user_name_sei=' + $("user_name_sei").value  + "&user_name_mei=" + $("user_name_mei").value + "&user_name_sei_kana=" + $("user_name_sei_kana").value + "&user_name_mei_kana=" + $("user_name_mei_kana").value + "&user_gender_0=" +  $("user_gender_0").checked + "&user_gender_1=" + $("user_gender_1").checked + "&date_year=" + $("date_year").value + "&date_month=" +  $("date_month").value + "&date_day=" +  $("date_day").value + "&user_pref=" +  $("user_pref").value + "&user_city=" + $("user_city").value + "&user_address=" + $("user_address").value + "&user_zip_code=" +  $("user_zip_code").value + "&user_home_tel=" +  $("user_home_tel").value + "&user_mobi_tel=" + $("user_mobi_tel").value + "&user_pc_mail=" + $("user_pc_mail").value + "&pc_mail_confirm=" +  $("user_pc_mail_confirm").value + "&user_mobi_mail=" + $("user_mobi_mail").value + "&user_exp1=" +  $("user_exp1").value + "&user_exp2=" + $("user_exp2").value + "&user_exp3=" +  $("user_exp3").value + "&user_exp4=" +   $("user_exp4").value + "&user_exp5=" + $("user_exp5").value + "&textarea=" + $("textarea").value  + "&biz1=" + $("biz1").checked + "&biz2=" + $("biz2").checked + "&biz3=" + $( "biz3").checked + "&biz4=" + $("biz4").checked + "&biz5=" + $("biz5").checked  + "&biz6=" + $("biz6").checked   + "&privacy=" + $("privacy").checked  , {asynchronous:true, evalScripts:true});
  return false;
}

function industry_check() {
  //alert('/direct_entry/industry_js/?ind_1=' + $("ind_1").checked + '&ind_2=' + $("ind_2").checked + '&ind_3=' + $("ind_3").checked  + '&ind_4=' + $("ind_4").checked + '&ind_5=' + $("ind_5").checked + '&ind_6=' + $("ind_6").checked + '&ind_7=' + $("ind_7").checked + '&ind_8=' + $("ind_8").checked );
  new Ajax.Request('/direct_entry/industry_js/?ind_1=' + $("ind_1").checked + '&ind_2=' + $("ind_2").checked + '&ind_3=' + $("ind_3").checked  + '&ind_4=' + $("ind_4").checked + '&ind_5=' + $("ind_5").checked + '&ind_6=' + $("ind_6").checked + '&ind_7=' + $("ind_7").checked + '&ind_8=' + $("ind_8").checked  , {asynchronous:true, evalScripts:true});
  return false;
}

function direct_entry_initiarize(){
  Event.observe($("hope_pref_id")      , "change", function(){ fill_check(0, "hope_pref_id" , "direct_entry"), direct_check_all() }, true);
  Event.observe($("hope_time")         , "change", function(){ fill_check(1, "hope_time"    , "direct_entry"), direct_check_all() }, true);

  Event.observe($("ind_1")             , "change", function(){ industry_check()                              , direct_check_all() }, true);
  Event.observe($("ind_2")             , "change", function(){ industry_check()                              , direct_check_all() }, true);
  Event.observe($("ind_3")             , "change", function(){ industry_check()                              , direct_check_all() }, true);
  Event.observe($("ind_4")             , "change", function(){ industry_check()                              , direct_check_all() }, true);
  Event.observe($("ind_5")             , "change", function(){ industry_check()                              , direct_check_all() }, true);
  Event.observe($("ind_6")             , "change", function(){ industry_check()                              , direct_check_all() }, true);
  Event.observe($("ind_7")             , "change", function(){ industry_check()                              , direct_check_all() }, true);
  Event.observe($("ind_8")             , "change", function(){ industry_check()                              , direct_check_all() }, true);

  Event.observe($("user_name_sei")     , "blur"  , function(){ fill_check(2, "user_name_sei", "direct_entry"), direct_check_all() }, true);
  Event.observe($("user_name_mei")     , "blur"  , function(){ fill_check(3, "user_name_mei", "direct_entry"), direct_check_all() }, true);
  Event.observe($("user_name_sei_kana"), "blur"  , function(){ fill_kana_check(0, "user_name_sei_kana")      , direct_check_all() }, true);
  Event.observe($("user_name_mei_kana"), "blur"  , function(){ fill_kana_check(1, "user_name_mei_kana")      , direct_check_all() }, true);
  Event.observe($("user_gender_0")     , "click" , function(){ gender_check(0, "user_gender_0")              , direct_check_all() }, true);
  Event.observe($("user_gender_1")     , "click" , function(){ gender_check(1, "user_gender_1")              , direct_check_all() }, true);
  Event.observe($("date_year")         , "change", function(){ fill_check(4, "date_year"    , "direct_entry"), direct_check_all() }, true);
  Event.observe($("date_month")        , "change", function(){ fill_check(5, "date_month"   , "direct_entry"), direct_check_all() }, true);
  Event.observe($("date_day")          , "change", function(){ fill_check(6, "date_day"     , "direct_entry"), direct_check_all() }, true);
  Event.observe($("user_pref")         , "blur"  , function(){ fill_check(7, "user_pref"    , "direct_entry"), direct_check_all() }, true);
  Event.observe($("user_city")         , "blur"  , function(){ fill_check(8, "user_city"    , "direct_entry"), direct_check_all() }, true);
  Event.observe($("user_address")      , "blur"  , function(){ fill_check(9, "user_address" , "direct_entry"), direct_check_all() }, true);
  Event.observe($("user_zip_code")     , "blur"  , function(){ Fulltohalf("user_zip_code")  , zip_check()    , direct_check_all() }, true);
  Event.observe($("user_zip_code")     , "blur"  , function(){ Fulltohalf("user_zip_code")  , zip_check()    , direct_check_all() }, true);
  Event.observe($("user_home_tel")     , "blur"  , function(){ Fulltohalf("user_home_tel")  , tel_check(0)   , direct_check_all() }, true);
  Event.observe($("user_mobi_tel")     , "blur"  , function(){ Fulltohalf("user_mobi_tel")  , tel_check(1)   , direct_check_all() }, true);
  Event.observe($("user_pc_mail")      , "blur"  , function(){ mail_check(0,"user_pc_mail",true)             , direct_check_all()  }, true);
  Event.observe($("user_pc_mail_confirm"), "blur", function(){ mail_confirm()                                , direct_check_all() }, true);
  Event.observe($("user_mobi_mail")    , "blur"  , function(){ mail_check(1 ,"user_mobi_mail",false)         , direct_check_all()  }, true);
  Event.observe($("user_exp1")         , "change", function(){ fill_check(10, "user_exp1" , "direct_entry")  , direct_check_all() }, true);
  Event.observe($("user_exp2")         , "change", function(){ fill_check(11, "user_exp2" , "direct_entry")  , direct_check_all() }, true);
  Event.observe($("user_exp3")         , "change", function(){ fill_check(12, "user_exp3" , "direct_entry")  , direct_check_all() }, true);
  Event.observe($("user_exp4")         , "change", function(){ fill_check(13, "user_exp4" , "direct_entry")  , direct_check_all() }, true);
  Event.observe($("user_exp5")         , "change", function(){ fill_check(14, "user_exp5" , "direct_entry")  , direct_check_all() }, true);
  Event.observe($("textarea")          , "blur"  , function(){ fill_check(15, "textarea"  , "direct_entry")  , direct_check_all() }, true);

  Event.observe($("biz1"), "click", function(){ biz_show_hide("biz_select1" , $("biz1").checked) , direct_check_all() }, true);
  Event.observe($("biz2"), "click", function(){ biz_show_hide("biz_select2" , $("biz2").checked) , direct_check_all() }, true);
  Event.observe($("biz3"), "click", function(){ biz_show_hide("biz_select3" , $("biz3").checked) , direct_check_all() }, true);
  Event.observe($("biz4"), "click", function(){ biz_show_hide("biz_select4" , $("biz4").checked) , direct_check_all() }, true);
  Event.observe($("biz5"), "click", function(){ biz_show_hide("biz_select5" , $("biz5").checked) , direct_check_all() }, true);
  Event.observe($("biz6"), "click", function(){ biz_show_hide("biz_select6" , $("biz6").checked) , direct_check_all() }, true);

  Event.observe($("privacy"), "click", function(){ entry_privacy_check(), direct_check_all() }, true);
}

function entry_privacy_check() {
    new Ajax.Request('/check_form/privacy_js/?privacy='+ $('privacy').checked   , {asynchronous:true, evalScripts:true});
    return false;
}
//------------------------------------------------
// inquiry用
//------------------------------------------------
function inquiry_initiarize(){
  Event.observe($("inquiry_name"), "blur", function(){ fill_check(0, "inquiry_name", "inquiry") , check_all_inquiry() }, true);
  Event.observe($("inquiry_tel"), "blur", function(){ zentohan("inquiry_tel"),both_check(), check_all_inquiry() }, true);
  Event.observe($("inquiry_mail"), "blur", function(){zentohan("inquiry_mail"), both_check(), check_all_inquiry() }, true);
  Event.observe($("inquiry_content"), "blur", function(){ fill_check(1, "inquiry_content", "inquiry"), check_all_inquiry() }, true);
  Event.observe($("type1"), "change", function(){ type_check(), check_all_inquiry() }, true);
  Event.observe($("type2"), "change", function(){ type_check(), check_all_inquiry() }, true);
  Event.observe($("type3"), "change", function(){ type_check(), check_all_inquiry() }, true);
  Event.observe($("privacy"), "change", function(){ privacy_check(), check_all_inquiry() }, true);
}

function both_check() {
  new Ajax.Request('/inquiry/both_js/?tel='+ $('inquiry_tel').value + '&mail=' + $('inquiry_mail').value   , {asynchronous:true, evalScripts:true});
  return false;
}

function privacy_check() {
  new Ajax.Request('/inquiry/privacy_js/?privacy='+ $('privacy').checked   , {asynchronous:true, evalScripts:true});
  return false;
}

function type_check() {
  if ($('type1').checked ||  $('type2').checked || $('type3').checked ){
         $('ok_type').innerHTML = "<span class='ok'><img src='/images/form/icon-ok.gif' alt='ok' /></span>" 
         $('comment_type').innerHTML = "" 
  }else{
         $('comment_type').innerHTML = "<span class='error'>お問い合わせの種類を選択してください</span>" 
         $('ok_type').innerHTML = "" 
  }
  return false;
}


function check_all_inquiry(){
  new Ajax.Request('/inquiry/check_all/?name='+ $('inquiry_name').value  + '&tel=' + $('inquiry_tel').value + '&mail=' + $('inquiry_mail').value  + '&type1=' + $('type1').checked + '&type2=' + $('type2').checked  + '&type3=' + $('type3').checked  + '&content=' + $('inquiry_content').value + '&privacy=' +  $('privacy').checked , {asynchronous:true, evalScripts:true});
  return false;

}


//------------------------------------------------
// list用
//------------------------------------------------


function change_form(){
  new Ajax.Request('/list/search_detail/?search_type=list', {asynchronous:true, evalScripts:true});
}

function limit_form( collections){
  new Ajax.Request('/list/search_limit/?clections=' + collections, {asynchronous:true, evalScripts:true});
}

function list_city_set(pref,city){
  new Ajax.Request('/list/setcity/?pref_id='+ pref + "&city=" + city  , {asynchronous:true, evalScripts:true});
//  alert('/list/setcity/?pref_id='+ pref + "&city=" + city);
}
