{template admin/header}
<div class="nav3">
  <ul class="cc">
    <li>
      <a href="admin.php?mod=city">省份管理</a>
    </li>
    <li>
      <a href="admin.php?mod=city&code=city">城市管理</a>
    </li>
    <li class="current">
      <a href="admin.php?mod=city&code=zone">区域管理</a>
    </li>
	<li>
	  <a href="admin.php?mod=city&code=street">地段管理</a>
	</li>
  </ul>
</div>

<div class="mt10">
<form name="form1" id="form1" method="post" action="admin.php?mod=city&code=addzone">
  <table width=98% cellspacing=1 cellpadding=3 class="tableorder">
  <!--{if $id}-->
    <tr class="header">
      <td colspan=2>修改区域</td>
    </tr>
    <tr>
      <td class="altbg1">名称</td>
      <td class="altbg2"><input type="text" name="zone" id="zone" value="{$name}"></td>
    </tr>
  <!--{else}-->
    <tr class="header">
      <td colspan=2>创建区域</td>
    </tr>
    <tr>
      <td class="altbg1">名称</td>
      <td class="altbg2"><textarea name="zone" id="zone" rows="5" cols="40"></textarea><font color="red">注:</font>如要同时添加多个地名,每个区域换一行.</td>
    </tr>
  <!--{/if}-->
    <tr>
      <td class="altbg1">城市</td>
      <td class="altbg2">
        <select name="area" id="area" onchange="return changeArea();">
          <option value=0>请选择</option>
          $area_option
        </select>
        <select name="city" id="city" onchange="return changeCity();">
          <option value=''>请选择</option>
        </select>
        <input type="hidden" name="hid_city" id="hid_city" value="{$city}">
      </td>
    </tr>
  </table>
<script type="text/javascript">
  function changeArea(){
	var area_id = document.getElementById("area").value;
	var city = document.getElementById("hid_city").value;
    var url = "ajax.php?mod=member&code=sel&province="+area_id + "&hid_city=" + city;
    if(area_id > 0){
  	$.get(
  		  	url,
  		  	function(d){
  	  		  	if(d){
  	  		    	$('#' + "city").html(d);
  	  	  			changeCity();
  	  		  	}else{
  	  	  		  	document.getElementById("city").length = 1;;
  	  	  		  	document.getElementById("zone").length = 1;;
  	  	  		}
  		  	}
  		  	);
    }
    return false;
  }
  changeArea();
  
  function changeCity(){
	    var area_id = document.getElementById("area").value;
		var city_id = document.getElementById("city").value;
	    var url = "ajax.php?mod=class&code=resultlist&act=zone&area="+area_id + "&city_id="+city_id;
	    if(city_id == '0'){
	    	 $('#' + "resultlist").hide();
	    	 return;
		}
	  	var myAjax=$.post(
	  		  	url,
	  		  	function(d){
		  		    $('#' + "resultlist").show();
	  	  		    $('#' + "resultlist").html(d);
	  		  	}
	  		  	);
	    return false;
	  }
  
</script>
<div>
  <input type="submit" name="addarea" value="确定" class="button">
  <input type="hidden" name="id" value="{$id}">
</div>
</form>
<div id="resultlist"></div>
</div>
