<!--<?php
require($this->getSegmentFile('config.nav'));
print <<<EOT
-->
<script type="text/javascript">
var areas = {
	copy : function(){
		var s = getObj('amode').firstChild.cloneNode(true);
		getObj('abody').appendChild(s);
	},
	
	remove : function(url){
		if(confirm('你确定要删除吗?')){
			setTimeout(function(){
				window.location.href = url;
			},100);
		}
		return false;
	}
};
</script>
<form action="{$_viewer->baseUrl}&action=addarea" method="post">
<input type="hidden" name="step" value="2" />
<h2 class="h1">地区管理</h2>
<div class="admin_table mb10">
	<table width="100%">
		<tbody>
		<tr class="tr2">
			<td>排序</td>
			<td>地区名称</td>
			<td>操作</td>
		</tr>
<!--
EOT;
if($_viewer->areas){
foreach($_viewer->areas as $area){
print <<<EOT
-->		
		<tr class="tr1 vt">
			<td class="td2" width="40"><input name="presence[{$area[areaid]}][sort]" value="{$area[sort]}" type="text" class="input input_wd" /></td>
			<td class="td2" width="200"><input name="presence[{$area[areaid]}][name]" value="{$area[name]}" type="text" class="input input_wa" /></td>
			<td class="td2"><a href="javascript:;" class="mr10" onclick="areas.remove('{$_viewer->baseUrl}&action=deletearea&areaid={$area[areaid]}');">[删除]</a></td>
		</tr>
<!--
EOT;
}
print <<<EOT
-->	
		 </tbody>
<!--
EOT;
}
print <<<EOT
-->			 
		<tr class="tr1 vt">
			<td class="td2"><input name="sort[]" value="" type="text" class="input input_wd" /></td>
			<td class="td2"><input name="name[]" value="" type="text" class="input input_wa" /></td>
			<td class="td2"><a href="javascript:;" onclick="areas.copy();" class="s3">[添加]</a></td>
		</tr>
		
		<tbody id="abody"></tbody>
		<!-- 新增表单模板 -->
		<tbody id="amode" style="display:none;"><tr class="tr1 vt"><td class="td2"><input name="sort[]" value="" type="text" class="input input_wd" /></td><td class="td2"><input name="name[]" value="" type="text" class="input input_wa" /></td><td class="td2"><a href="javascript:;" onclick="areas.copy();" class="s3">[添加]</a></td></tr></tbody>
	</table>
</div>
<div class="p10 tac"><span class="btn"><span><button type="submit">提 交</button></span></span></div>
</form>
<!--
EOT;
?>
