<style type="text/css">
<!-- 
.STYLE2 {color: #007DC6}
 -->
</style>
<form action="area.manage.php" id="form1" name="form1" method="post" style="margin-bottom:20px" onsubmit="return ajax_sort();">
<input type="hidden" name="action" value="sortarea" />
<table width="680px" border="0" cellspacing="0" cellpadding="0" class="area_ajax_list" >
	<tr class="area_ajax_list_title" >
		<td width="25%" height="34" align="center"><strong><tpl> $langAreaSort </tpl></strong></td>
		<td width="30%" height="34"><strong><tpl> $langArea </tpl></strong></td>
		<td width="30%" height="34"><strong><tpl> $langAreaOperate </tpl></strong></td>
		<td width="15%" height="34">	
		<span class="btn_left"><strong><input class="btn_submit" name="submit" type="submit" value="<tpl> $langCChangeOrder </tpl>" /></strong></span>
		</td>
	</tr>
	<tpl> if $areaArray[0].area_id neq '' </tpl>
	<tpl> section name=listclass loop=$areaArray </tpl>
	<tr class="area_ajax_list_title_main" onmouseout="this.style.backgroundColor='#fff'" onmouseover="this.style.backgroundColor='#E6F5FE'">
		<td height="30" align="center" valign="middle"><input name="sort[<tpl> $areaArray[listclass].area_id </tpl>]" type="text" style="border:1px solid #CCCCCC" value="<tpl> $areaArray[listclass].area_sort </tpl>" size="5" maxlength="5" class="area_ajax_list_title_main_input"/></td>
		<td width="30%" height="30" align="left" valign="middle"> 
			<span class="STYLE2">
			<tpl> if $areaArray[listclass].is_parent eq '1' </tpl> 
				<a id="img_<tpl> $areaArray[listclass].area_id </tpl>"onclick="ajax_get_child_class('<tpl> $areaArray[listclass].area_id </tpl>','<tpl> $deep </tpl>');" href="javascript:;"><img  src="../templates/system_new/images/jia.gif" width="10" height="10" /></a> 
			<tpl> /if </tpl>
			<tpl> $areaArray[listclass].area_name </tpl>
			</span>
		</td>
		<td width="30%" height="30" align="left" valign="middle">		
			<a href="javascript:;" onclick="ajax_modi('<tpl> $areaArray[listclass].area_id </tpl>');" title="<tpl> $langCedit </tpl>" class="edit_a_pic"></a>
			<a href="javascript:;" onclick="ui_del('<tpl> $areaArray[listclass].area_id </tpl>');" title="<tpl>$langCdele</tpl>" class="del_a_pic"></a>  
			<input type="hidden" name="id[<tpl> $areaArray[listclass].area_id </tpl>]" value="<tpl> $areaArray[listclass].area_id </tpl>" />	
		</td>
		<td height="30" align="left" valign="middle">&nbsp;</td>
	</tr>
	<tr>
		<td colspan="4" align="center">
			<div style="display:none" id="div_<tpl> $areaArray[listclass].area_id </tpl>"></div>
		</td>
	</tr>
	<tpl> /section </tpl>
	<tr class="area_ajax_list_title" >
		<td width="25%" height="34" align="center"></td>
		<td width="30%" height="34"></td>
		<td width="30%" height="34"></td>
		<td width="15%" height="34">	
		<span class="btn_left"><strong><input class="btn_submit" name="submit" type="submit" value="<tpl> $langCChangeOrder </tpl>" /></strong></span>
		</td>
	</tr>
	<tpl> else  </tpl>
		<tr class="area_ajax_list_title_main">
			<td height="30" colspan="4" align="center"><tpl> $langCNull  </tpl></td>
		</tr>
	<tpl> /if  </tpl>
</table>
</form>
<div id="ui_question" style="display:none; cursor: default; padding:10px"> 
        <b style=" font-size:14px; margin-top:10px; line-height:50px; height:50px;padding-top:10px; padding-bottom:10px"><tpl> $langSureDelArea  </tpl></b> <br />
        <input type="button" id="yes" value="<tpl> $langCYes </tpl>"  style=" border:1px solid #CCCCCC;width:80px; margin:5px; background-image:url(../templates/system_new/images/anniu.gif)"/> 
        <input type="button" id="no" value="<tpl> $langCNo  </tpl>"  style="border:1px solid #CCCCCC;width:80px; margin:5px; background-image:url(../templates/system_new/images/anniu.gif)"/>
		<input type="hidden" id="del_value" />
</div>
<script>
var ui_question = $("#ui_question")[0];
//删除
function ui_del(str){
	hideMessage();
	$.blockUI(ui_question, { width: '275px' }); 
	$('#del_value').val(str);
}
$(document).ready(function(){
	$('#yes').click(function() {
		$.ajax({
			url: "area.manage.php",
			data: 'action=delarea&chboxAreaId='+$('#del_value').val(),
			type:'post',
			dataType:"json",
			beforeSubmit:  showLoading(showText),
			success: function(msg){
				hideLoading();
				showMessage(msg.message,msg.type);
				if(msg.type == 1){
					ShowDiv	= 'result_content';
					getPageContent("area.manage.php?action=ajax_list");
				}
				$.unblockUI(); 
			}
		});
		return false; 
	}); 
	$('#no').click($.unblockUI); 
});

//编辑
function ajax_modi(id){
	ShowDiv = 'result_content';
	getPageContent('area.manage.php?action=modiarea&area_id='+id);
}

//提交排序
function ajax_sort(){
	var queryString=$("#form1").formSerialize();

	$.ajax({
		url: "area.manage.php",
		data: queryString,
		type:'post',
		dataType:"json",
		beforeSubmit:  showLoading(showSaveText),
		success: function(msg){
					hideLoading();
					showMessage(msg.message,msg.type);
					if(msg.type == '1'){
						ShowDiv	= 'result_content';
						getPageContent("area.manage.php?action=ajax_list");
					}
		}
	});
	return false;
}

//跳转到删除类别下的操作
function ajax_merger(id){
	ShowDiv	= 'result_content';
	getPageContent("area.manage.php?action=mergerarea&area_id="+id);
}

//取类别下的子类别
function ajax_get_child_class(id,deep){
	str = $("#div_"+id).html();
	if($("#div_"+id).css('display') == 'none'){
		if(str == ''){
			$("#div_"+id).css('display','');
			var length = parseFloat(deep)+1;
			$.ajax({
				url: "area.manage.php",
				data: "action=ajax_child_list&area_id="+id+"&deep="+length,
				type:'post',
				dataType:"html",
				beforeSubmit:  showLoading(showSaveText),
				success: function(msg){
					hideLoading();
					$("#img_"+id).html("<img  src='../templates/system_new/images/jian.gif' width='10' height='10'/>");
					$("#div_"+id).html(msg);
				}
			});
		}else{
			$("#img_"+id).html("<img  src='../templates/system_new/images/jian.gif' width='10' height='10'/>");
			$("#div_"+id).css('display','');
		}	
	}else{
		$("#img_"+id).html("<img  src='../templates/system_new/images/jia.gif' width='10' height='10'/>");
		$("#div_"+id).css('display','none');
	}
	return false;
}
</script>