<style type="text/css">
	.snd_style		{ padding:0px 0 0 30px; float:left; }
	.btnsend		{ height:30px; width:80px; cursor:hand; margin:5px 0px 0px 5px; }
	.txtcenter		{ text-align:center; }
	.txtarea		{ width:160px; height:120px; margin:85px 0px 0px 0px; border:0px; }

	.phonelist		{ width:160px; height:155px; margin:5px 0px 0px 5px; overflow-y:scroll; overflow-x:hidden; border:0px solid; }
	.cssname		{ width:34px; border:0; margin-right:-1px; background:#FBFBFB; border-radius:0; }
	.csspcs			{ width:80px; border:0; border-radius:0; }

	.shootpcs		{ margin:4px 0px 0px 75px; }
	.shootin		{ width:80px; background-color:transparent; border:0px; }

	table tr td input	{ padding:1px; font:normal 11px Dotum; border:0; }
</style>

<div class="txtcenter">남은 문자 : <?=$zm_sms[residual]?></div>
<form name="FORM_SMS" method="post" action="sms_sender.php" style="margin:0px">
<input type="hidden" name="arSendPcs" value="">
<input type="hidden" name="arSendName" value="">
<table width="219" cellpadding="0" cellspacing="0" border=0 align="center">
<tr height="439">
	<td background="img/img_phone_bg1.gif" valign="top">
	<table width="150" align="center" cellpadding=0 cellspacing=0 border=0>
	<tr>
		<td><div class="txtcenter"><textarea name="inMsg" class="txtarea" onKeyUp="viewbyte(this)"></textarea></div></td>
	</tr>
	<tr>
		<td height="30">
		<table cellspacing=0 cellpadding=0 border=0><tr><td width="110" align="right"><span id="txtleng">0</span> / 80 Byte</td>
		<td><a href="#" onClick="FORM_SMS.inMsg.value=''; viewbyte(FORM_SMS.inMsg)"><img src="img/btn_reset.gif"></a></td></tr></table>
		</td>
	</tr>
	<tr>
		<td>
		<div class="phonelist">
		<table cellpadding="0" cellspacing="0" width="140">
		<!-- 전화목록 -->
<?		for($i = 0; $i < 20; $i++) : ?>
		<tr height="22">
			<td><input type="text" name="inSendName" value="" class="cssname" title="이름"></td>
			<td><input type="text" name="inSendPcs" value="<?=$receive_number?>" class="csspcs" onBlur=dropHyphen(this) title="번호를 입력하세요."></td>
			<td><!--<a href="#" onClick="dropPhoneNo(<?=$i?>)"><img src="img/icon_del.gif"></a>--></td>
		</tr>
		<tr height="1"><td colspan="3" bgcolor="#F7F7F7"></td></tr>
<?		$receive_number	= "";
		endfor; ?>
		</table>
		</div>
		</td>
	</tr>
	<tr>
		<td><!-- 보내는 사람 --><div class="shootpcs"><input type="text" name="inSenderPcs" value="<?=$member[mb_hp]?>" class="shootin"></div></td>
	</tr>
	</table>
	</td>
</tr>
<tr height="101">
	<td background="img/img_phone_bg3.gif" valign="top">
	<div class="snd_style">
	<input name="inSndStyle" type="radio" value="1" onClick="viewTime(1);" checked>즉시<br />
	<input name="inSndStyle" type="radio" value="2" onClick="viewTime(2);">예약
	</div>
	<div class="snd_style"><a href="#" class="btnsend" onClick="smsSend(FORM_SMS)"><img src="img/btn_smssend.gif"></a></div>
	</td>
</tr>
<tr id="revtime" style="display:none;">
	<td>
	<center>
	<select name="inYear">
<?	for($i = date("Y"); $i <= date("Y") +1; $i++) : ?>
	<option value="<?=$i?>"><?=$i?></option>
<?	endfor; ?>
	</select>년
	<select name="inMonth">
<?	for($i = 1; $i <= 12; $i++) :
	if($i == date("m")) $sSel = "selected"; else $sSel = "";
	$j		= substr($i+100, -2, 2); ?>
	<option value="<?=$j?>" <?=$sSel?>><?=$j?></option>
<?	endfor; ?>
	</select>월
	<select name="inDay">
<?	for($i = 1; $i <= 31; $i++) :
	if($i == date("d")) $sSel = "selected"; else $sSel = "";
	$j		= substr($i+100, -2, 2); ?>
	<option value="<?=$j?>" <?=$sSel?>><?=$j?></option>
<?	endfor; ?>
	</select>일
	<select name="inHour">
<?	for($i = 0; $i <= 23; $i++) :
	if($i == date("H")) $sSel = "selected"; else $sSel = ""; 
	$j		= substr($i+100, -2, 2); ?>
	<option value="<?=$j?>" <?=$sSel?>><?=$j?></option>
<?	endfor; ?>
	</select>시
	<select name="inMin">
<?	for($i = 0; $i <= 59; $i++) :
	if($i == date("i")) $sSel = "selected"; else $sSel = "";
	$j		= substr($i+100, -2, 2); ?>
	<option value="<?=$j?>" <?=$sSel?>><?=$j?></option>
<?	endfor; ?>
	</select>분
	</center>
	</td>
</tr>
</table>
</form>

<script language="javascript">
function viewTime(n) {
	if(n == 1)	$("#revtime").css("display", "none");
	if(n == 2)	$("#revtime").css("display", "block");
	
}
function viewbyte(th) {
	var strlng		= txtbyte(th.value);
	$("#txtleng").html(strlng);

	if(strlng > 80)	$("#txtleng").css("color", "#ff0000");
	else			$("#txtleng").css("color", "#000000");
}

function txtbyte(str) { 
	var i, j = 0; 
	for(i = 0; i < str.length; i++) { 
		val		= escape(str.charAt(i)).length; 
		if(val == 6) j += 2; 
		j++; 
	} 
	return j; 
}

function dropPhoneNo(no) {
	var f	= document.FORM_SMS;

	f.inSendName[no].value = "";
	f.inSendPcs[no].value = "";

	for(i = no; i < 19; i++) {
		f.inSendName[i].value	= f.inSendName[i+1].value;
		f.inSendPcs[i].value	= f.inSendPcs[i+1].value;
	}
	f.inSendName[19].value	= "";
	f.inSendPcs[19].value	= "";
}
function dropHyphen(th) {
	for(i = 0; i < 20; i++) {
		th.value	= th.value.replace("-", "");
	}
}
//-- 문자 전송하기 ------------------------------
function smsSend(f) {
	var inpCnt		= f.inSendPcs.length;
	var sw			= 0;

	if(!f.inMsg.value)	{
		alert("내용 입력이 없습니다.");
		f.inMsg.focus();
		return;
	}
		
	for(i = 0; i < inpCnt; i++)		if(f.inSendPcs[i].value) sw	= 1;
	if(!sw) {
		alert("전화번호가 없습니다.");
		f.inSendPcs[0].focus();
		return;
	}

	//-- 수신할 사람의 이름과 전화번호 목록 초기화
	f.arSendPcs.value		= "";
	f.arSendName.value		= "";

	for(i = 0; i < inpCnt; i++)
	{
		if(f.inSendPcs[i].value)	f.arSendPcs.value	+= "@" + f.inSendPcs[i].value;
		if(f.inSendPcs[i].value)	f.arSendName.value	+= "@" + f.inSendName[i].value;
	}
	
	f.submit();
}

</script>