  
  // エリア大
  function getLargeArea(){
      var blockId = $F('blockId');
      if( blockId == "" ){  return; }
      var pars = 'blockId='+blockId;
      var targetOptions = document.f[0].areaLarge.options;
      mediumAreaInit();
      getXML(pars,targetOptions);
   }
   
   //エリア大　引数あり
   function getLargeAreaByBlockId(blockId,targetOptions){
      if( blockId == "" ){  return; }
      var pars = 'blockId='+blockId;
      var targetOptions = document.f[0].areaLarge.options;
      getXML(pars,targetOptions);
   }
   
   //エリア大
   function getLargeAreaIndex(){
      var blockId = $F('blockIdUnder');
      if( blockId == "" ){  return; }
      var pars = 'blockId='+blockId;
      var targetOptions = document.f[0].areaLarge.options;
      mediumAreaInit();
      getXML(pars,targetOptions);
   }
   
   // エリア中
   function getMediumArea(){
      var areaLargeId = $F('areaLarge');
      if( areaLargeId == "" ){ return; }
      var pars = 'areaLargeId='+areaLargeId;
      var targetOptions = document.f[0].areaMedium.options;
      getXML(pars,targetOptions);
   }
   
   //職種
   function getOccupations(){
      var occupationCategoryId = $F('occupationCategory');
      if( occupationCategoryId == "" ){ return; }
      var pars = 'occupationCategoryId='+occupationCategoryId;
      var targetOptions = document.f[0].occupations.options;
      getXML(pars,targetOptions);
   }
   
   //給与
   function getPayment(){
      var paymentCategoryId = $F('paymentCategory');
      if( paymentCategoryId == "" ){ return; }
      var pars = 'paymentCategoryId='+paymentCategoryId;
      var targetOptions = document.f[0].payment.options;
      getXML(pars,targetOptions);
   }
   
   //エリア中の初期化
   function mediumAreaInit(){
      var areaMediumOptions = document.f[0].areaMedium.options;
      for( var i = 0, len = areaMediumOptions.length; i < len; i++ ){
          areaMediumOptions[len-i] = null;
      }
      areaMediumOptions[0] = new Option('▼');
      areaMediumOptions[0].value = "";
   }
   
   //xmlドキュメントの取得
   function getXML(pars,targetOptions){

      //初期化
      for(var i = 0, len = targetOptions.length; i < len; i++){
         targetOptions[len-i] = null;
      }
   
      var url = '/search_condition.xml';
      new Ajax.Request( url,{
                        method: "post",
                        parameters: pars,
                        onSuccess:function(httpObj){
                          var title = httpObj.responseXML.getElementsByTagName("title");
                          var value = httpObj.responseXML.getElementsByTagName("value");
                                             
                          targetOptions[0] = new Option('▼');
                          targetOptions[0].value = "";
                          for( i = 0; i<title.length; i++ ) {
                             targetOptions[i+1] = new Option(title[i].firstChild.nodeValue);
                             targetOptions[i+1].value = value[i].firstChild.nodeValue; 
                          }  
                        },
                        onFailure:function(httpObj){ }
                         
      });
   
   }
   
   //時給、日給、月給を直接
   function getPaymentCategory(id,targetOptions){
      var pars = 'paymentCategoryId='+id;
      var url = '/search_condition.xml';
      var str;
      if( id == 1 )     {  str = '時給'; }
      else if( id == 2 ){  str = '月給'; }
      else if( id == 3 ){  str = '日給'; }
      
      new Ajax.Request( url,{
                        method: "post",
                        parameters: pars,
                        onSuccess:function(httpObj){
                        
                          var title = httpObj.responseXML.getElementsByTagName("title");
                          var value = httpObj.responseXML.getElementsByTagName("value");
                          targetOptions[0] = new Option('指定しない');
                          targetOptions[0].value = "";
                          
                          for( i = 0; i<title.length; i++ ) {
                             targetOptions[i+1] = new Option(str+title[i].firstChild.nodeValue);
                             targetOptions[i+1].value = value[i].firstChild.nodeValue; 
                          }
                            
                        },
                        onFailure:function(httpObj){ }               
      });   
   }
   
   function getOccupationAndCategory(){
      var url = '/occupation_search_condition.xml';
      var targetOptions = document.f2.occupationCategory_occupation.options;
      new Ajax.Request( url,{
                        method: "post",
                        onSuccess:function(httpObj){
                          var title = httpObj.responseXML.getElementsByTagName("title");
                          var value = httpObj.responseXML.getElementsByTagName("value");
                          targetOptions[0] = new Option('職種');
                          targetOptions[0].value = "";
                          for( i = 0; i<title.length; i++ ) {
                             targetOptions[i+1] = new Option(title[i].firstChild.nodeValue);
                             targetOptions[i+1].value = value[i].firstChild.nodeValue; 
                          }
                        
                        },
                        onFailure:function(httpObj){ }
      });
   }
   
   // 小勤務地チェックを外す
   function uncheckAreaSmalls() {
     if(document.f[0].areaSmalls != null) {
        for (i = 0; document.f[0].areaSmalls.length; i++) {
             document.f[0].areaSmalls[i].checked = false;
             document.f[1].areaSmalls[i].checked = false;
        }   
     }
   }

