var ajax_city = ajax.create();
var ajax_area = ajax.create();
var ajax_location = ajax.create();
var ajax_career = ajax.create();
var ajax_school = ajax.create();
function get_city(id){
 var obj,option,client_city_id,url;
 obj = 'city';$(obj).disabled = true;$(obj).innerHTML = '';
 client_city_id = $('city').lang;
 option = new Option('--Loading--');
 $(obj).options[0] = option;
 url = 'ajax.php?id='+id+'&client_city_id='+client_city_id+'&action=get_city';
 ajax.response(ajax_city,url,get_city_ed);
}
function get_city_ed(){
 var html = ajax.request(ajax_city);
 if(typeof(html)=='undefined')return;
 var obj,city_arr,len,i,j,city,id,city_name,option,selected,is_selected;
 obj = 'city';$(obj).disabled = false;$(obj).innerHTML = '';
 is_selected = $('is_selected').value;
 if(is_selected==1){option = new Option('所有城市',0);$(obj).options[0] = option;}
 city_arr = html.split('|');
 len = city_arr.length-1;
 for(i=0;i<len;i++){
  city = city_arr[i].split(',');
  id = city[0];
  city_name = city[1];
  selected = city[2];
  option = new Option(city_name,id);
  if(id==1||id==2||id==9||id==19||id==22)option.style.backgroundColor = '#FFEF50';
  if(selected==1)option.selected = true;
  (is_selected==1) ? j = i+1 : j = i;
  $(obj).options[j] = option;
  if(selected==1)$(obj).options[j].selected = true;//IE6
 }
 get_area($(obj).options[$(obj).selectedIndex].value);
 $(obj).onchange = function(){get_area(this.options[this.selectedIndex].value);};
}

function get_area(id){
 var obj,option,client_area_id,url;
 obj = 'area';
 $(obj).innerHTML = '';
 if(!$(obj))return;
 if(id==0){
  option = new Option('所有地区',0);
  $(obj).options[0] = option;return;
 }
 $(obj).disabled = true;
 client_area_id = $('area').lang;
 option = new Option('--Loading--');
 $(obj).options[0] = option;
 url = 'ajax.php?id='+id+'&client_area_id='+client_area_id+'&action=get_city';
 ajax.response(ajax_area,url,get_area_ed);
}

function get_area_ed(){
 var html = ajax.request(ajax_area);
 if(typeof(html)=='undefined')return;
 var obj,city_arr,len,i,j,city,id,city_name,option,selected,is_selected;
 obj = 'area';$(obj).disabled = false;$(obj).innerHTML = '';
 is_selected = $('is_selected').value;
 if(is_selected==1){option = new Option('所有地区',0);$(obj).options[0] = option;}
 city_arr = html.split('|');
 len = city_arr.length-1;
 for(i=0;i<len;i++){
  city = city_arr[i].split(',');
  id = city[0];
  city_name = city[1];
  selected = city[2];
  option = new Option(city_name,id);
  if(id==267||id==269)option.style.backgroundColor = '#FFEF50';
  if(selected==1)option.selected = true;
  (is_selected==1) ? j = i+1 : j = i;
  $(obj).options[j] = option;
  if(selected==1)$(obj).options[j].selected = true;//IE6
 }
 get_location($(obj).options[$(obj).selectedIndex].value);
 if($(obj).offsetWidth>150)$(obj).style.width = 150;
 $(obj).onchange = function(){get_location(this.options[this.selectedIndex].value);};
}

function get_location(id){
 var obj,option,client_location_id,url;
 obj = 'location';
 if(!$(obj))return;
 if(id==''||id==0){setVisibility(obj,'hidden');return;}
 setVisibility(obj,'visible');
 $(obj).disabled = true;$(obj).innerHTML = '';
 client_location_id = $('client_location_id').value;
 option = new Option('--Loading--');
 $(obj).options[0] = option;
 url = 'ajax.php?id='+id+'&client_location_id='+client_location_id+'&action=get_city';
 ajax.response(ajax_location,url,get_location_ed);
}

function get_location_ed(){
 var html = ajax.request(ajax_location);
 var obj,city_arr,len,i,j,city,id,city_name,option,selected,is_selected;
 obj = 'location';$(obj).disabled = false;$(obj).innerHTML = '';
 is_selected = $('is_selected').value;
 if(typeof(html)=='undefined'||empty(html)){setVisibility(obj,'hidden');return;}
 if(is_selected==1){option = new Option('所有区域',0);$(obj).options[0] = option;}
 setVisibility(obj,'visible');
 city_arr = html.split('|');
 len = city_arr.length-1;
 for(i=0;i<len;i++){
  city = city_arr[i].split(',');
  id = city[0];
  city_name = city[1];
  selected = city[2];
  option = new Option(city_name,id);
  if(selected==1)option.selected = true;
  (is_selected==1) ? j = i+1 : j = i;
  $(obj).options[j] = option;
  if(selected==1)$(obj).options[j].selected = true;//IE6
 }
 if($(obj).offsetWidth>150)$(obj).style.width = 150;
}

/*
function get_career(){
 var obj,option,client_career,url;
 obj = 'career';$(obj).disabled = true;
 client_career = $('client_career').value;
 option = new Option('请选择','');
 $(obj).options[0] = option;
 url = 'ajax.php?col=career&selected_value='+Escape(client_career)+'&action=get_options';
 ajax.response(ajax_career,url,get_career_ed);
}
function get_career_ed(){
 var html = ajax.request(ajax_career);
 if(typeof(html)=='undefined')return;
 var obj,city_arr,len,i,city,id,city_name,option,selected;
 obj = 'career';$(obj).disabled = false;
 city_arr = html.split('|');
 len = city_arr.length;
 for(i=1;i<len;i++){
  city = city_arr[i-1].split(',');
  city_name = city[0];
  selected = city[1];
  option = new Option(city_name,city_name);
  if(selected==1)option.selected = true;
  $(obj).options[i] = option;
 }
}
*/