<style type="text/css">
	td, span, div, a, textarea	{ font-family:Dotum; font-size:11px; letter-spacing:-1px; }
	.title			{ text-align:center; font-size:13px; font-weight:bold; }
	.list			{ overflow-y:scroll; height:500px; }
</style>
<div class="title">전화번호부</div>
<div class="list">
<table width="100%" cellpadding="0" cellspacing="1">
<tr><td colspan="5" height="1" bgcolor="#E3E3E3"></td></tr>
<tr align="center" height="22" bgcolor="#F7F7F7">
	<td>선택</td>
	<td>이름</td>
	<td>전화번호</td>
	<td>메모</td>
	<td></td>
</tr>
<tr><td colspan="5" height="1" bgcolor="#E3E3E3"></td></tr>
<?	$sRes		= mysql_query("select * from zm_sms_phonebook order by ds_phn_name asc"); ?>
<? while($rdTel = mysql_fetch_array($sRes)) : ?>
<tr height="22">
	<td><a href="#" onClick="addList('<?=$rdTel[ds_phn_name]?>', '<?=$rdTel[ds_phn_pcs]?>')"><img src="img/icon_addtel.gif"></a></td>
	<td><?=$rdTel[ds_phn_name]?></td>
	<td><?=$rdTel[ds_phn_pcs]?></td>
	<td><?=$rdTel[ds_memo]?></td>
	<td><a href="#" onClick="if(confirm('<?=$rdTel[ds_phn_pcs]?>를 제거 합니다.')) document.location.href='sms_process.php?mode=teldel&recno=<?=$rdTel[ds_recno]?>';"><img src="img/icon_del.gif"></a></td>
</tr>
<tr><td colspan="5" height="1" bgcolor="#E3E3E3"></td></tr>
<? endwhile; ?>
<form name="FROM_ADDR" method="post" onSubmit="return addPhone(this)">
<input type="hidden" name="mode" value="addphone">
<tr align="center">
	<td></td>
	<td><input type="text" name="in_name" itemname="이름" required size="8"></td>
	<td><input type="text" name="in_tel" itemname="전화번호" required size="10"></td>
	<td><input type="text" name="in_memo" size="35" maxlength="20">
	<input type="submit" value="등록"></td>
	<td></td>
</tr>
</form>
</table>
</div>
<script language="javascript">
function addPhone(f) {
	f.action="sms_process.php"

	return true;
}

function addList(name, pcs) {
	var frm			= document.FORM_SMS;
	var inpCnt		= frm.inSendName.length;
		for(i = 0; i < inpCnt; i++)
		{
			if(frm.inSendPcs[i].value == pcs) {
				alert("이미 목록에 포함되어 있는 번호입니다.");
				return false;
			}
			if(!frm.inSendPcs[i].value)	{
				frm.inSendName[i].value		= name;
				frm.inSendPcs[i].value		= pcs;
				return false;
			}
		}
}
</script>