<!--#include virtual="/common/lib/dbcon.asp"-->
<!--#include virtual="/common/lib/func.asp"-->
<%
s_num     = inputValue(Request("s_num"))
v_page    = inputValue(Request("p_page"))
v_search  = inputValue(Request("p_search"))
v_keyword = inputValue(Request("p_keyword"))
sorder    = inputValue(Request("sorder"))
page_info = "p_page="&v_page&"&p_block="&v_block&"&p_search="&v_search&"&p_keyword="&v_keyword

s_type		= Trim(inputValue( Request("s_type") ))

If s_type = "" Then s_type = "S"

If s_type = "S" Then
	pageTitle = "이모티콘"
Else
	pageTitle = "메세지"
End if



if sorder = "" then
	sorder = "e_idx desc"
end if

if s_num <> "" then
	
	opt = "and s_num="&s_num
else
	opt = "and s_num <> 9"
end if

'response.write Len(s_num)


If s_type = "S" then
	v_pagesize = 4 '--리스트 화면에 보여줄 갯수
Else
	v_pagesize = 2 '--리스트 화면에 보여줄 갯수
End If

v_block    = 10 '--페이징 갯수
length     = 30 '--내용 길이

If Len(v_page) = 0 Then
	v_page = 1
End If

if (trim(Request("p_keyword")) <> "") and (Request("p_search") <> "") Then  '검색어가 있다면	
	search_str = " and "& v_search &" like '%"& Replace(v_keyword,"'","''")&"%'" 
end if

If s_num = "9" Then
SQL_T = "Select Count(*),CEILING(CAST(Count(*) AS FLOAT)/" & v_pagesize & ")  " &_
				" from emt where m_id='"&session("ss_m_id")&"' and s_type <> 'V' "&opt
SQL_T = SQL_T & search_str
else
SQL_T = "Select Count(*),CEILING(CAST(Count(*) AS FLOAT)/" & v_pagesize & ")  " &_
				" from emt where m_id is not null and s_type <> 'V' "&opt
SQL_T = SQL_T & search_str
End if

'response.write SQL_T
Set Rs_Tot = Dbcon.execute(SQL_T)


v_total     = Rs_Tot(0)
v_totalpage = Rs_Tot(1)


If s_num = "9" Then
strSQL = "SELECT Top "& (v_page*v_pagesize) & " * " &_
				 " FROM emt where m_id='"&session("ss_m_id")&"' and s_type <> 'V'  "&opt
strSQL   = strSQL & search_str & " order by "& sorder
Else
strSQL = "SELECT Top "& (v_page*v_pagesize) & " * " &_
				 " FROM emt where m_id is not null and s_type <> 'V'  "&opt
strSQL   = strSQL & search_str & " order by "& sorder
End if
Set Rs_L = DbCon.Execute(strSQL)
'response.write strSQL

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>최신문자</title>
	<link rel="stylesheet" type="text/css" href="/common/css/sub_layout.css" />
	<link rel="stylesheet" type="text/css" href="/common/css/all.css" />
<style type="text/css">
<!--
body {margin-left: 0px; margin-top: 0px;}
.style1 {font-family: "돋움"; font-size: 11px;color: #FFFFFF;}
.style4 {	font-family: "돋움"; font-size: 11px; color: #FFFFFF}
.style5 {font-family: "돋움"; font-size: 11px; color: #ffe50c;font-weight: bold;}
.style7 {font-family: "돋움"; font-size: 11px; color: #2865ae;font-weight: bold;}
.style9 {font-family: "돋움"; font-size: 11px; color: #666666; }
.style11 {font-family: "돋움"; font-size: 11px; color: #4888a0; font-weight: bold;}
.style12 {font-family: "돋움"; font-size: 11px; color: #333333; font-weight: bold;}
.style13 {font-family: "돋움"; font-size: 12px; color: #FFFFFF;}
-->
</style>


<script type="text/javascript">
//<![CDATA[
function addMessage(msg){
	//var obj = parent.document.getElementById("message");
	var obj = opener.document.getElementById("message");
	obj.value = msg;
	obj.focus();
	window.close();

}
//]]>
</script>
</head>

<body style="margin:0 auto; padding:20px;">

<div style="width:700px; margin:0 auto;">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
	<td width="167" align="left" valign="top">
		<table width="133" border="0" cellpadding="0" cellspacing="0">
		<tr><td align="left" valign="top"><img src="/sms_img/sub/emo_tit.gif" width="133" height="44" /></td></tr>
		<tr><td><a href="./m_write.asp" onclick="window.open(this.href, 'emt', 'width=150px,height=220');return false;"><img src="/sms_img/sub/emo_plus.gif" width="133" height="33" border="0" /></a></td></tr>
		<tr>
			<td height="24" style="background:url(/sms_img/sub/emo_bg.gif) no-repeat;">
				<span class="style12" style="padding:6px 0 0 15px;">
					<a href="m_emoticon.asp">
					<%if s_num = "" Then %>
					전체
					<%else%>
					<span class='style9'>전체</span>
					<%End if%>
					</a>
				</span>
			</td>
		</tr>
<%

SQL = "SELECT * FROM emt_category WHERE s_chk='Y' or s_chk = 'S' order by s_code asc"
set rs_cate = dbcon.execute(SQL)

i = 1
DO while not rs_cate.EOF


if trim(s_num) = trim(rs_cate("s_num")) then
	s_menuname_str = rs_cate("s_menuname")
else
	s_menuname_str = "<span class='style'>" & rs_cate("s_menuname") & "</span>"
end if

%>
		<tr>
			<td height="24" style="background:url(/sms_img/sub/emo_bg.gif) no-repeat;">
				<span class="style12" style="padding:6px 0 0 15px;">
					<a href="m_emoticon.asp?s_num=<%=rs_cate("s_num")%>"><%=s_menuname_str%></a>
				</span>
			</td>
		</tr>
<%
rs_cate.MoveNext
i= i+1
Loop

Set rs_cate = nothing
%>
		</table>
	</td>
	<td align="left" valign="top">
		<table border="0" cellpadding="0" cellspacing="0">
		<tr>
<%
If v_totalpage > 0 Then        '------ 내용이 있으면 리스트 출력

	Rs_L.Move (v_page - 1) * v_pagesize

	if v_page = 1 then
		num = v_total
	else 
		num = v_total - ((v_page - 1) *  v_pagesize) 
	end if
	  '-------------------- 리스트 반복 시작 --------------------

	z = 0

	DO while not Rs_L.EOF

		If z > 0 And z Mod 4 = 0 Then Response.write "</tr><tr>"
%>

			<td style="width:136px;height:160px; text-align:center; background:url(/sms_img/sub/emoti_bg.gif) no-repeat left top; padding-top:28px; padding-right:10px;">
				<!-- <img src="/sms_img/sub/emo_p01.gif" width="137" height="160" /> -->
				<textarea style='border:none; font-size: 9pt; overflow: hidden; color:#000000; position: relative; top: 5px; left:2px; width:100px; height: 97px; background-color:transparent;cursor:pointer;' name="emoticon" rows="5" cols="16" readonly="readonly" onclick="addMessage(this.value);" onkeypress="addMessage(this.value);"><%=rs_l("e_contents")%></textarea><br />
				<span><%=rs_l("e_subject")%></span><br /><br />
				<div style="padding-top:10px;padding-bottom:10px;"><a href="m_write.asp?e_idx=<%=Rs_L("e_idx")%>" onclick="window.open(this.href, 'emt', 'width=200,height=207');return false;"><img src="/sms_img/sub/btn_edit.gif"  border="0" /></a> <a href="m_delete_ok.asp?e_idx=<%=Rs_L("e_idx")%>&amp;s_num=<%=s_num%>" onclick="javascript:return confirm('정말 삭제하시겠습니까?')"><img src="/sms_img/sub/btn_del.gif"  border="0" /></a></div>
			</td>
<%
		Rs_L.MoveNext
		z= z+1
	Loop
end if
%>
		</table>
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td style="text-align:center; padding-top:20px;"><%page2("m_emoticon.asp?s_num="&s_num)%></td>
		</tr>
		</table>


		<!-- <table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td><img src="/sms_img/sub/emo_p01.gif" width="137" height="160" /></td>
			<td><img src="/sms_img/sub/emo_p02.gif" width="137" height="160" /></td>
			<td><img src="/sms_img/sub/emo_p03.gif" width="137" height="160" /></td>
			<td><img src="/sms_img/sub/emo_p04.gif" width="137" height="160" /></td>
		</tr>
		<tr>
			<td align="center"><a href="#"><img src="/sms_img/sub/btn_edit.gif"  border="0" /></a> <a href="#"><img src="/sms_img/sub/btn_del.gif"  border="0" /></a></td>
			<td align="center"><a href="#"><img src="/sms_img/sub/btn_edit.gif"  border="0" /></a> <a href="#"><img src="/sms_img/sub/btn_del.gif"  border="0" /></a></td>
			<td align="center"><a href="#"><img src="/sms_img/sub/btn_edit.gif"  border="0" /></a> <a href="#"><img src="/sms_img/sub/btn_del.gif"  border="0" /></a></td>
			<td align="center"><a href="#"><img src="/sms_img/sub/btn_edit.gif"  border="0" /></a> <a href="#"><img src="/sms_img/sub/btn_del.gif"  border="0" /></a></td>
		</tr>
		</table> -->
	</td>
</tr>
</table>
</div>

</body>
</html>