<form name="memoform" method="post" onSubmit="return memodel(this)">
<input type="hidden" name="mode" value="deleteall">
<input type="hidden" name="kind" value="<?=$kind?>">
<table width=100% cellpadding=0 cellspacing=0 border=0>
<tr><td height="1" colspan="6" bgcolor="#C3C3C3"></td></tr>
<? ob_start(); ?>
<tr height="30" align=center bgcolor="#FBFBFB"> 
	<td colspan="6" align="left">&nbsp;
<?	if($kind == "recv") : ?>
		<input type="image" src="<?=$member_skin_path?>/img/btn_comment_delete.gif">
<?	elseif($kind == "send") : ?>
		<input type="image" src="<?=$member_skin_path?>/img/btn_comment_cancel.gif" onClick="if(confirm('발송취소하면 받는 사람의 쪽지함에서 쪽지가 삭제 됩니다. ')) submit();">
<?	elseif($kind == "save") : ?>
		<input type="image" src="<?=$member_skin_path?>/img/btn_comment_delete.gif">
<? endif; ?>
	</td>
</tr>
<tr><td height="1" colspan="6" bgcolor="#C3C3C3"></td></tr>
<? $buttons		= ob_get_contents();
    ob_end_flush(); 
?>
<tr height="22" align=center>
	<td width="5%"><input type="checkbox" name="chkall" onClick="check_all(this.form)"></td>
    <td width="13%"><span class="txtsmall"><?=($kind == "recv" || $kind == "save") ? "보낸사람" : "받는사람"; ?></span></td>
	<td width="*"><span class="txtsmall">내용</span></td>
    <td width="13%"><span class="txtsmall">보낸시간</span></td>
    <td width="10%"><span class="txtsmall">확인날짜</span></td>
    <td width="7%"></td>
</tr>
<tr><td height="1" colspan="6" bgcolor="#E7E7E7"></td></tr>
<? for ($i=0; $i<count($list); $i++) : ?>
<tr height=25 align="center"> 
	<td><input type="checkbox" name="memolist[]" value="<?=$list[$i][me_id]?>" onClick="check_chkall(this, this.form)" <?=$memochkbox[$i]?>></td>
    <td align="left"><?=$list[$i][name]?></td>
	<td align="left"><a href="<?=$list[$i][view_href]?>"><?=$list[$i][memo_summary]?></a></td>
    <td ><span class="txtsmall"><?=$list[$i][send_datetime]?></span></td>
    <td><span class="txtsmall"><?=$list[$i][read_date]?></span></td>
    <td><span class="txtsmall"><? if($kind == "recv" || $kind == "save") : ?><a href="#" onClick="id_refusal('<?=$list[$i][me_send_mb_id]?>')">수신거부</a><? endif; ?></span></td>
</tr>
<tr><td height="1" colspan="6" bgcolor="#E7E7E7"></td></tr>
<? endfor; ?>
<? if ($i==0) { echo "<tr><td height=100 align=center colspan=6><span class='txtsmall'>쪽지가 없습니다.</span></td></tr>"; } ?>
<?=$buttons?>
</table>
</form>
<?=$memo_pages?>

<!-- ↓ 수정 X -->
<script language="javascript">
function memodel(f) {
	var sw	= false;

	for(i = 0; i < f.length; i++) {
		if(document.getElementsByName("memolist[]")[i] && document.getElementsByName("memolist[]")[i].checked) {
			sw	= true;
		}
	}

	if(!sw) {
		alert("삭제할 쪽지를 선택 해 주세요.");
		return false;
	}

	if(confirm("선택한 쪽지를 삭제합니다."))	f.action	= "./memo_delete.php"
	else	return false;
}

function check_all(f) {
	for(i = 0; i < f.length; i++) {
		if(f.chkall.checked)	try{ document.getElementsByName("memolist[]")[i].checked = true; }catch(e) {}
		else					try{ document.getElementsByName("memolist[]")[i].checked = false; }catch(e) {}
	}
}

function check_chkall(th, f) {
	var sw	= true;

	for(i = 0; i < f.length; i++) {
		if(document.getElementsByName("memolist[]")[i] && !document.getElementsByName("memolist[]")[i].checked) {
			sw	= false;
		}
	}

	if(sw)	f.chkall.checked	= true;
	else	f.chkall.checked	= false;
	
}

function id_refusal(id) {
	var myid	= "<?=$member[mb_id]?>";

	if(!id) { alert("차단 할 아이디가 없습니다."); return false; }
	if(id == myid) { alert("본인을 차단 할 수 없습니다."); return false; }

	if(!confirm("차단 될 회원 : "+id+" \n차단 된 회원이 발송 한 쪽지는 무시 됩니다.")) return false;

	zm_gourl("./zm.memo_update.php?mode=refusal&id="+id+"&kind=<?=$kind?>");
}
</script>