{template 'phpcms','header'}
<table cellspacing="0" cellpadding="0" class="member">
<tr>
<td valign="top" class="left">
{template 'member','left'}
</td>
<td width="10">
</td>
<td class="right" valign="top">
{template 'message','message_catlist'}
<div class="memberborder_1">
<div class="memberborder_2">
  <h1>回收站</h1>
{if $recyclenum > 0}
<form action="{$PHP_SELF}" method="post">
<table cellpadding="0" cellspacing="0" class="righttable">
  <tbody>
	<tr>
		<td width="8%" class="td_center">删除</td>
		<td width="52%" class="td_center">标题</td>
		<td width="20%" class="td_center">来自/发送到</td>
		<td width="20%" class="td_center">时间</td>
	</tr>

{loop $recycle $value}
	<tr onmouseover="this.className='mrowbg2';" onmouseout="this.className='mrowbg1';">
		<td class="td_center"><input id="mid" type="checkbox" name="mid[]" value="{$value[0]}|{$value[3]}" onclick="delCheck();"></td>
		<td class="td_center"><a href="{$MOD[linkurl]}show.php?folder=recycle&mid={$value[0]}&types={$value[3]}" target="_self" title="查看消息内容">{$value[2]}</a></td>
		<td class="td_center">{if $value[3] == 0}来&nbsp;&nbsp;自{else}发送到{/if}:{$value[1]}</td>
		<td class="td_center">{date('Y-m-d H:i:s', $value[4])}</td>
	</tr>
{/loop}
  </tbody>
</table>
<script language="javascript" type="text/javascript">
<!--
function btnClick() {
	try {
		var objEvt = evt.target;
	} catch (e) {
		var objEvt = event.srcElement;
	}
	if (objEvt.id == "subBtn") {
		if (confirm("您确定要删除所选项目?")) {
			return true;
		} else {
			return false;
		}
	} else if (objEvt.id == "rstBtn") {
		document.getElementById("restore").name = "restore";
		document.getElementById("restore").value = 1;
		return true;
	} else {
		return false;
	}
}
function checknum() {
	var intNum = 0;
	var element = document.forms[0].mid;
	if (element.length) {
		for (var i = 0; i < element.length; i++) {
			if (element[i].checked) {
				intNum++;
			}
		}
	} else {
		if (element.checked) {
			intNum = 1;
		}
	}
	return intNum;
}
function delCheck() {
	var intNum = checknum();
	if (intNum > 0) {
		if (document.forms[0].mid.length) {
			if (intNum == document.forms[0].mid.length) {
				document.getElementById("checkAll").disabled = true;
				document.getElementById("checkOther").disabled = true;
			} else {
				document.getElementById("checkAll").disabled = false;
				document.getElementById("checkOther").disabled = false;
			}
		} else {
			document.getElementById("checkAll").disabled = true;
			document.getElementById("checkOther").disabled = true;
		}
		document.getElementById("cancel").disabled = false;
		document.getElementById("rstBtn").disabled = false;
		document.getElementById("subBtn").disabled = false;
	} else {
		document.getElementById("checkAll").disabled = false;
		document.getElementById("checkOther").disabled = true;
		document.getElementById("cancel").disabled = true;
		document.getElementById("rstBtn").disabled = true;
		document.getElementById("subBtn").disabled = true;
	}
}
function selectAll() {
	var element = document.forms[0].mid;
	if (element.length) {
		for (var i = 0; i < element.length; i++) {
			element[i].checked = true;
		}
	} else {
		element.checked = true;
	}
	document.getElementById("checkAll").disabled = true;
	document.getElementById("checkOther").disabled = true;
	document.getElementById("cancel").disabled = false;
	document.getElementById("rstBtn").disabled = false
	document.getElementById("subBtn").disabled = false;
}
function selOther() {
	var element = document.forms[0].mid;
	for (var i = 0; i < element.length; i++) {
		if (element[i].checked) {
			element[i].checked = false;
		} else {
			element[i].checked = true;
		}
	}
}
function noCheck() {
	document.forms[0].reset();
	document.getElementById("checkAll").disabled = false;
	document.getElementById("checkOther").disabled = true;
	document.getElementById("rstBtn").disabled = true;
	document.getElementById("subBtn").disabled = true;
}
//-->
</script>
<table width="100%" cellpadding="0" cellspacing="0" class="righttable">
  <tbody>
	<tr>
		<td width="50%" class="td_center"><input id="checkAll" type="button" value="全选" onclick="selectAll();">&nbsp;<input id="checkOther" type="button" value="反选" disabled onclick="selOther();">&nbsp;<input id="cancel" type="button" value="取消选择" disabled onclick="noCheck();"></td>
		<td width="50%" class="td_center"><input id="restore" type="hidden"><input id="rstBtn" type="submit" name="dosubmit" value="恢复" disabled onclick="return btnClick();">&nbsp;&nbsp;<input id="subBtn" type="submit" name="dosubmit" value="删除消息" disabled onclick="return btnClick();" title="彻底删除短消息"></td>
	</tr>
  </tbody>
</table></form>
{/if}
{template 'message','numalert'}
</div></div>
    </td>
	</tr>
  </table>
		</div></td>
	</tr>
</tbody></table>
{template 'phpcms','footer'}