<!--#include virtual="/common/file/inc_head.asp"-->
<%
Set ST = New SelectTable


'response.write mysilguk()
'response.write session("ss_m_sms") & "," & Request.Cookies("M_JobLevel")
'발송건에 대한 고유번호
randomize
jw1		= Int((100 * Rnd) + 1) 
jw2		= replace(right(now(),8),":","")
a_num	= trim(jw1) + trim(jw2)

'--------------------실국 리스트-------------------------
sql = "select bdm_idx, bdm_menuname from bd_menu_page where bdm_ref = 0 and bdm_chk = 'Y' order by bdm_code"
Set buseo_rs = DbCon.Execute(sql)
If buseo_rs.bof Or buseo_rs.eof Then
	buseo_data1 = Null
Else
	buseo_data1 = buseo_rs.getrows
End If
Set buseo_rs = Nothing
'-------------------실국 리스트 끝-----------------------

'---------------개인주소록 그룹 리스트-------------------------
sql = "select bdm_idx, bdm_menuname, (select count(*) from bd_address_page where bdm_idx = a.bdm_idx) as cnt from bd_address as a where bdm_id = '"&session("ss_m_id")&"' and bdm_ref = 0 order by bdm_code"
Set juso_rs = DbCon.Execute(sql)
If juso_rs.bof Or juso_rs.eof Then
	juso_data1 = Null
Else
	juso_data1 = juso_rs.getrows
End If
Set juso_rs = Nothing
'-------------------개인주소록 리스트 끝-----------------------


re_phone = request.form("number")
re_message = request.form("message")
'If re_message = "" Then re_message = "메세지를 입력하세요!"
%>


<link rel="stylesheet" type="text/css" href="/common/helloCalendar/helloCalendar.css" />
<script type="text/javascript" src="/common/helloCalendar/helloCalendar.js"></script>
<script type="text/javascript" src="/common/js/total.js"></script>


<script type="text/javascript">
//<![CDATA[
var M_sms;
M_sms = '1';	//sms등급 전역변수 생성


$(function(){
	memSelect();
	calendarSelect();
	newNumberSelect();
	newMessageSelect();

	$("#message").keyup(function(){
		var limit = eval( $(this).data("limit") );
		updateChar( limit );
	}).focus(function(){
		var limit = eval( $(this).data("limit") );
		setCleanMsg();
		updateChar(limit);
	});

	$("#rdate, #time1, #time2").change(function(){
		$("#resOrNot").attr("checked", true);
	});
	$("#calendarimg").click(function(){
		$("#resOrNot").attr("checked", true);
	});

	var length = calculate_msglen( $("#message").val() );
	if( length > 80 ){
		changeLimit( 2000 );
		updateChar( 2000 );
	}

});

onload = function(){
	var re_phone = "<%=re_phone%>";
	if (re_phone != ""){
		add(re_phone, "M"+";noname;"+re_phone, 1);
	}
}
//발송-----------

function smsSend(){
<%if session("ss_m_id") = "" then%>
	var frm;
	frm = document.login_frm;
	alert("로그인후 사용할 수 있습니다.");
	frm.m_id.focus();
}
<%else%>
	var eForm = document.getElementById("frmMsg");
	if((eForm.message.value == '메세지를 입력하세요!')||(eForm.message.value == '')){
		alert("메세지를 입력하세요!");
		eForm.message.focus();
		return;
	}
	if(eForm.callback.value.split(" ").join("") == ""){
		alert("송신자 번호를 입력하세요.");
		eForm.callback.focus();
		return;
	}

	var list_cnt = $("div.u_btm div.ctrl p strong").text();
	list_cnt = parseInt(list_cnt);
	if(eForm.mms_chk.value == "Y"){	//장문발송은 3건씩 차감
		list_cnt *= 3;
	}
	if(list_cnt > parseInt(eForm.smsQty.value)){
		alert("당월 남은 건수가 부족합니다.\n\n장문발송은 수신번호당 3건이 차감됩니다.");
		return;
	}
	
	if(list_cnt == 0){
		alert("받는사람을 선택하세요.");
		return;
	}
	if(eForm.mms_chk.value == "Y"){
		eForm.action = "./send_mms.asp";
	}
	eForm.submit();
}
<%end if%>


function callBackChange(){
	if(confirm("회신번호를 변경하시려면 개인정보 수정메뉴에서\n모바일번호를 인증받아야 합니다.\n\n변경하시겠습니까?")){
		location.href="/content/06mypage/index03.asp";
	}else{
		return;
	}
}

function setBuseo(bdm_idx, value){
	var url = "./ajax_get_buseo.asp?bdm_idx="+bdm_idx+"&value="+value;
	$("#address2").load(url);
}

function textClear(){
	$("#message").val("");
}


//]]>
</script>
<script type="text/javascript" src="/common/calendar/total.js"></script>


<!-- 타이틀 -->
<div id="cont_head">
	<h2>문자전송</h2>
	<p class="imp">80 Byte이상 메세지를 입력하면 <span>장문발송으로 전환되며 수신번호당 3건이 차감</span>됩니다.</p>
</div>
<!-- //타이틀 -->
<!-- 내용 -->
<div id="cont_wrap">
	<div class="s0101">
		<!-- 문자전송 -->
		<div class="sms_section">


			<form id="frmMsg" name='frmMsg' method='post' action='./send_sms.asp'>
			<input type="hidden" name="a_num" value="<%=a_num%>">
			<input type="hidden" name="smsQty" value="<%=smsSelect()%>">
			<input type="hidden" id="mms_chk" name="mms_chk" value="N">
			<input type="hidden" id="list_check" name="list_check" value="Y" />
			<!-- 예약발송 관련 -->
			<input type="hidden" id="resOrNot" name="resOrNot" value="" />
			<input type="hidden" id="rdate" name="rdate" value="" />
			<input type="hidden" id="time1" name="time1" value="" />
			<input type="hidden" id="time2" name="time2" value="" />
			<!-- 예약발송 관련끝 -->

			<input name="callback" type="hidden" value='<%=Replace(Trim(SESSION("ss_m_mobile")),"-","")%>' />

			<div class="send_area">
				<div class="phone">
					<textarea rows="10" id="message" name="message" data-limit="80" placeholder="내용을 입력하세요."><%=re_message%></textarea>
					<div class="byte"><strong id="textlimit">0</strong> / <span id="span_limit">80</span> byte</div>
					<dl class="callnum">
						<dt>발신번호</dt>
						<dd><input type="text" value="<%=SESSION("ss_m_mobile")%>" style="width:100%;" disabled="disabled" /></dd>
						<dt>수신번호</dt>
						<dd><input id="mobile" type="tel" style="width:72%" onkeyup="addDash(this);if(event.keyCode ==13){add_input(this);}" maxlength="13" /> <a href="#addmobile" onclick="add_input(document.getElementById('mobile'));" onkeypress="add_input(document.getElementById('mobile'));" class="btn_add"><img src="/img/sub/btn_add_num.gif" alt="추가" /></a></dd>
					</dl>
					<ul class="addr">
						<li><a href="javascript:;" onclick="clickArea(detaillayer4,0);">최근번호</a></li>
						<li><a href="javascript:;" onclick="clickArea(detaillayer7,0);">최근메시지</a></li>
					</ul>
					<ul class="chk">
						<li><a href="javascript:;" onclick="clickArea(detaillayer6,0);" />예약설정</a></li>
						<li class="date">&nbsp;</li>
					</ul>
					<div class="btngroup">
						<ul class="btn_nrm column2">
							<li><a href="#send" onclick="smsSend();" onkeypress="smsSend();" class="nrm3">보내기</a></li>
							<li><a href="#clear" onclick="textClear();" class="nrm3">다시 쓰기</a></li>
						</ul>
					</div>
				</div>
				<div class="numlist">
					<div class="inner">
						<ul class="add_num">
							&nbsp;
						</ul>								
						<div class="u_btm">
							<div class="ctrl">
								<p>총 <strong>0</strong>명</p>
							</div>
							<div class="btngroup">
								<ul class="btn_nrm_bor column2">
									<li><a href="#chk" onclick="listCheck();" onkeypress="listCheck();" class="nrm_bor1">전체선택</a></li>
									<li><a href="#del" onclick="memDel();" onkeypress="memDel();" class="nrm_bor1">선택삭제</a></li>
								</ul>
							</div>
						</div>
					</div>
				</div>
			</div>

			</form>

			<!-- 주소록 -->
			<div class="sent_area">
				<h3 class="tit">주소록</h3>
				<div class="f_board">
					<div class="s_group">
						<select id="jusoGrp" name="jusoGrp" onchange="memSelect();">
								<%						
									If Not(IsNull(juso_data1)) Then
										For i = 0 To UBound(juso_data1, 2)
								%>
									<option value="<%=juso_data1(0, i)%>" data-count="<%=juso_data1(2, i)%>"><%=juso_data1(1, i)%>(<%=juso_data1(2, i)%>)</option>
								<%
										Next
									End if
								%>
									<option value="0">그룹미지정</option>
						</select>
						<input type="text" id="sh_keyword" name="sh_keyword" onkeyup="if(event.keyCode ==13){memSelect();}" />
						<a href="#add_group" onclick="Addr_grp_add();" class="btn_add">그룹추가</a>
					</div>
					<div class="s_btn">
						<a href="#addr_search" onclick="memSelect();"><img src="/img/sub/btn_search.png" title="검색" class="btn_search" /></a>
						<a href="javascript:;" onclick="clickArea(detaillayer15,0);"><img src="/img/sub/btn_file.png" title="파일추가" class="btn_file" /></a>
					</div>
				</div>
				<div class="addrlist">
					&nbsp;
				</div>
				<div class="btngroup">
					<ul class="btn_nrm column1">
						<li><a href="#seladd" onclick="memAdd('chk_adr_idx');" class="nrm1">선택추가</a></li>
					</ul>
				</div>
			</div>
			<!-- //주소록 -->
		</div>
		<!-- //문자전송 -->
		<!-- 부서 -->
		<div class="dep_section">
			<h3 class="tit">나의 부서</h3>
			<a href="#allbuseo" onclick="sMasterAdd2();" class="all_send">전 부서 발송</a>
			<div class="dep_box">
				<ul>
					<li>
						<div class="part_box">
							<h4>분류1</h4>
							<select id="address1" ondblclick="setBuseo(this.value, '');" size="14" multiple="multiple">
							<%
								If Not(IsNull(buseo_data1)) Then
									For i = 0 To ubound(buseo_data1, 2)
										tot_cnt = ST.selectQueryColumn( "select count(*) as cnt from member where bdm_idx in (select bdm_idx from bd_menu_page where bdm_ref = '" & buseo_data1(0, i) & "') and m_mobile1 <> '' and m_mobile2 <> '' and m_mobile3 <> ''" )

							%>
								<option value="<%=buseo_data1(0, i)%>" data-count="<%=tot_cnt%>"><%=buseo_data1(1, i)%>(<%=tot_cnt%>)</option>
							<%
									Next
								End if
							%>
							</select>
							<ul class="btnarea">
								<li><a href="#buseo_group" onclick="selectAll($('#address1').get(0), true);">전체선택</a></li>
								<li><a href="#buseo_group" onclick="selectAll($('#address1').get(0), false);">전체해제</a></li>
								<li><a href="#buseo_group" onclick="Buseo_grp_add('address1');" class="add">추가</a></li>
							</ul>
						</div>
					</li>
					<li>
						<div class="part_box">
							<h4>분류2</h4>
							<select id="address2" ondblclick="buseoSelectBuseo();" size="14" multiple="multiple">
								&nbsp;
							</select>
							<ul class="btnarea">
								<li><a href="#buseo_group" onclick="selectAll($('#address2').get(0), true);">전체선택</a></li>
								<li><a href="#buseo_group" onclick="selectAll($('#address2').get(0), false);">전체해제</a></li>
								<li><a href="#buseo_group" onclick="Buseo_grp_add('address2');" class="add">추가</a></li>
							</ul>
						</div>
					</li>
					<li>
						<div class="mem_box">
							<h4>구성원</h4>
							<div class="sbox">
								<input type="text" id="sh_buseo_keyword" class="w_name" placeholder="이름 또는 전화번호 검색" onkeyup="if(event.keyCode ==13){buseoSelectKeyword();}" />
								<a href="#buseo_search" onclick="buseoSelectKeyword();"><input type="image" src="/img/sub/btn_search.png" class="btn_search" /></a>
							</div>
							<ul class="memlist">
								&nbsp;
							</ul>
							<ul class="btnarea">
								<li><a href="#buseo_group" onclick="chkAllByTagName('chk_m_num', true);">전체선택</a></li>
								<li><a href="#buseo_group" onclick="chkAllByTagName('chk_m_num', false);">전체해제</a></li>
								<li><a href="#seladd" onclick="memAdd('chk_m_num');" class="add">추가</a></li>
							</ul>
						</div>
					</li>
				</ul>
			</div>
		</div>
		<!-- //부서 -->
	</div>
</div>
<!-- //내용 -->

<!-- 최근번호 -->
<div id="detaillayer4" class="maskpopbox" style="display:none;">
	<div class="popbox">
		<div class="poptit">
			<h4>최근 전송번호</h4>
			<span class="popcls"><img src="/img/sub/btn_popcls.gif" alt="닫기" /></span>
		</div>
		<div class="popct">
			
		</div>
	</div>
</div>
<!-- //최근번호 -->

<!-- 예약발송 -->
<div id="detaillayer6" class="maskpopbox" style="display:none;">
	<div class="popbox">
		<div class="poptit">
			<h4>예약발송</h4>
			<span class="popcls"><img src="/img/sub/btn_popcls.gif" alt="닫기" /></span>
		</div>
		<div class="popct">
			<form id="frm_reserve">
			<input type="hidden" name="rdate" value="<%=Date()%>" />
			<input type="hidden" name="time1" value="00" />
			<input type="hidden" name="time2" value="00" />
			<ul class="sl_area">
				<li>
					<select id="p_year" name="p_year" onchange="calendarSelect();">
<%
For i = year(now) To year(now) + 1
%>
						<option value="<%=i%>" <%=chkSelect(i, year(now))%>><%=i%>년</option>
<%
next
%>
					</select>
				</li>
				<li>
					<select id="p_month" name="p_month" onchange="calendarSelect();">
<%
For i = 1 To 12
%>
						<option value="<%=i%>" <%=chkSelect(i, month(now))%>><%=i%>월</option>
<%
next
%>
					</select>
				</li>
				<li>
					<select id="p_time1" name="p_time1" onchange="selectTimeTemp();">
<%
For i = 0 To 23
	i_value = Right("0" & i, 2)
%>
						<option value="<%=i_value%>"><%=i_value%>시</option>
<%
next
%>
					</select>
				</li>
				<li>
					<select id="p_time2" name="p_time2" onchange="selectTimeTemp();">
<%
For i = 0 To 50 Step 10
	i_value = Right("0" & i, 2)
%>
						<option value="<%=i_value%>"><%=i_value%>분</option>
<%
next
%>
					</select>
				</li>
			</ul>
			<table id="table_calendar" class="table1">
				<colgroup>
					<col width="15%" />
					<col width="14%" />
					<col width="14%" />
					<col width="14%" />
					<col width="14%" />
					<col width="14%" />
					<col width="15%" />
				</colgroup>
				<thead>
					<tr>
						<th scope="col">일</th>
						<th scope="col">월</th>
						<th scope="col">화</th>
						<th scope="col">수</th>
						<th scope="col">목</th>
						<th scope="col">금</th>
						<th scope="col">토</th>
					</tr>
				</thead>
				<tbody>
				</tbody>
			</table>
			<p class="sl_date"><span id="span_reserve_date"><%=year(now)%>년 <%=Right("0" & month(now), 2)%>월 <%=Right("0" & day(now), 2)%>일 </span><span id="span_reserve_time">00시 00분</span></p>
			<div class="btngroup">
				<ul class="btn_nrm column2">
					<li><a href="#reserve" onclick="reserveDateTime();closeArea();" class="nrm1">문자예약</a></li>
					<li><a href="#close" onclick="resetReserveDateTime();closeArea();" class="nrm2">예약취소</a></li>
				</ul>
			</div>
			</form>
		</div>
	</div>
</div>
<!-- //예약발송 -->

<!-- 최근메시지 -->
<div id="detaillayer7" class="maskpopbox" style="display:none;">
	<div class="popbox">
		<div class="poptit">
			<h4>최근메시지</h4>
			<span class="popcls"><img src="/img/sub/btn_popcls.gif" alt="닫기" /></span>
		</div>
		<div class="popct">
			<ul class="sentlist">
				
			</ul>
			
		</div>
	</div>
</div>
<!-- //최근메시지 -->
<!-- 주소록검색 -->
<div id="detaillayer14" class="maskpopbox" style="display:none;">
	<div class="popbox">
		<div class="poptit">
			<h4>주소록 검색</h4>
			<span class="popcls"><img src="/img/sub/btn_popcls.gif" alt="닫기" /></span>
		</div>
		<div class="popct">
			<p class="">그룹 중 메세지를 보내기 원하는 개인을 검색하세요.</p>
			<div class="f_board">
				<div class="search_frm">
					<ul>
						<li class="s_word">
							<select style="width:100px;">
								<option>이름</option>
								<option>전화번호</option>
							</select>
							<input type="text" class="w_text" placeholder="검색어를 입력하세요." />
							<input type="image" src="/img/sub/btn_search.png" title="검색" class="btn_search" />
						</li>
						<li class="allsearch"><a href="#" >모두검색</a></li>
					</ul>
				</div>
			</div>
			<div class="s_list">
				<table class="table1" summary="주소록">
					<colgroup>
						<col width="10%" />
						<col width="*" />
						<col width="50%" />
					</colgroup>
					<thead>
						<tr>
							<th scope="col"><input type="checkbox" /></th>
							<th scope="col">이름(분류명)</th>
							<th scope="col">연락처</th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td><input type="checkbox" /></td>
							<td>홍길동(가족)</td>
							<td>010-1234-5463</td>
						</tr>
						<tr>
							<td><input type="checkbox" /></td>
							<td>홍길동(가족)</td>
							<td>010-1234-5463</td>
						</tr>
						<tr>
							<td><input type="checkbox" /></td>
							<td>홍길동(가족)</td>
							<td>010-1234-5463</td>
						</tr>
						<tr>
							<td><input type="checkbox" /></td>
							<td>홍길동(가족)</td>
							<td>010-1234-5463</td>
						</tr>
						<tr>
							<td><input type="checkbox" /></td>
							<td>홍길동(가족)</td>
							<td>010-1234-5463</td>
						</tr>
						<tr>
							<td><input type="checkbox" /></td>
							<td>홍길동(가족)</td>
							<td>010-1234-5463</td>
						</tr>
						<tr>
							<td><input type="checkbox" /></td>
							<td>홍길동(가족)</td>
							<td>010-1234-5463</td>
						</tr>
						<tr>
							<td><input type="checkbox" /></td>
							<td>홍길동(가족)</td>
							<td>010-1234-5463</td>
						</tr>
						<tr>
							<td><input type="checkbox" /></td>
							<td>홍길동(가족)</td>
							<td>010-1234-5463</td>
						</tr>
						<tr>
							<td><input type="checkbox" /></td>
							<td>홍길동(가족)</td>
							<td>010-1234-5463</td>
						</tr>
						<tr>
							<td><input type="checkbox" /></td>
							<td>홍길동(가족)</td>
							<td>010-1234-5463</td>
						</tr>
					</tbody>
				</table>
			</div>
			<div class="btngroup">
				<ul class="btn_nrm column1">
					<li><a href="#" class="nrm1">선택추가</a></li>
				</ul>
			</div>
		</div>
	</div>
</div>
<!-- //주소록검색 -->

<!-- 파일추가 -->
<div id="detaillayer15" class="maskpopbox" style="display:none;">
	<div class="popbox">
		<div class="poptit">
			<h4>파일추가</h4>
			<span class="popcls"><img src="/img/sub/btn_popcls.gif" alt="닫기" /></span>
		</div>
		<div class="popct">
			<p class="tip">문서종류는 반드시 텍스트(.txt)이어야만 합니다.</p>
			<div class="file"><input type="file" /></div>
			<ul class="step">
				<li>
					<span>1</span>메모장에서 아래의 예제처럼 숫자를 입력 후 저장하십시오.
					<img src="/img/sub/img_file_v1.gif" alt="" />
				</li>
				<li>
					<span>2</span>상단의 찾아보기를 누르신 후 txt파일을 선택합니다.
					<img src="/img/sub/img_file_v2.gif" alt="" />
				</li>
			</ul>
		</div>
	</div>
</div>
<!-- //파일추가 -->


<!--#include virtual="/common/file/bottom.asp"-->
