<!--#include virtual = "/common/lib/dbcon.asp" -->
<!--#include virtual = "/common/lib/func.asp" -->
<%

skin = "blue"

search_type = InputValue( request("search_type"))
search_keyword = InputValue( request("search_keyword"))
p_page_url = request("p_page_url")


If search_keyword <> "" then

	sql = " SELECT m_id, m_name, b.ct_name FROM member a LEFT OUTER JOIN member_div b ON a.m_div1=b.ct_idx WHERE m_level = 52 and "
	If search_type = "" then
		sql = sql & " m_name like '%"&search_keyword&"%' or m_id like '%"&search_keyword&"%' or a.m_div1 in ( SELECT  ct_idx  FROM member_div WHERE ct_name like '%"&search_keyword&"%') "
	ElseIf search_type = "sh_m_temp1" then
		sql = sql & "  a.m_div1 in ( SELECT  ct_idx  FROM member_div WHERE ct_name like '%"&search_keyword&"%') "
	else
		sql = sql & " "&replace(search_type, "sh_", "")&" like '%"&search_keyword&"%'"
	End If


	Set Rs = Dbcon.Execute (sql)
	If Not rs.eof Then
		vData = rs.getrows()
		vCnt = UBound(vData,2)
	Else
		vCnt = -1
	End If
	rs.close : Set rs = nothing

End if


%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko" lang="ko">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="Stylesheet" type="text/css" href="/manager/common/css/all.css" />

	<script type="text/javascript">
	<!--
	function sendit(eForm){
		//var eForm = document.frm;
		if(!valueChk(eForm.search_keyword, "검색어")){return false;}
		//alert("OK");
		//eForm.submit();
	}
	function valueChk(obj, objName){	//text필드
		if(obj.value.split(" ").join("") == ""){
			alert(objName+"을(를) 입력하세요");
			try{
				obj.focus();
			}catch(e){
			}
			return false;
		}else{
			return true;
		}
	}
	//-->
	</script>

</head>
<body>
<form id="memberSearch" method="get" action="search_member.asp" onsubmit="return sendit(this)">
<div>
<input type="hidden" name="p_page_url" value="<%=p_page_url%>" />
</div>
<div id="search_content" style="padding-left:10px;padding-top:10px">
	<div>
	<ul>
		<li>
			<select id="search_type" name="search_type">
				<option value="">전체</option>
				<option value="sh_m_name" <%=chkSelect(search_type, "sh_m_name")%>>이름</option>
				<option value="sh_m_id" <%=chkSelect(search_type, "sh_m_id")%>>아이디</option>
				<option value="sh_m_temp1" <%=chkSelect(search_type, "sh_m_temp1")%>>부서</option>
			</select>
			<input type="text" id="search_keyword" name="search_keyword" style="width:100px" value="<%=search_keyword%>" />
			<input type="submit" value="검색" />
		</li>
	</ul>
	</div>
	<div>
						<table cellspacing="0" style="width:95%" class="bbs_<%=skin%>" summary="사이트의 회원을 관리합니다.">
						<caption>회원관리 서식</caption>
						<colgroup>
						<col width="40" />
						<col width="80" />
						<col width="80" />
						<col />
						<col width="50" />
						</colgroup>

						<thead>
						<tr>
							<th scope="col">번호</th>
							<th scope="col">아이디</th>
							<th scope="col">이름</th>
							<th scope="col">부서</th>
							<th scope="col">선택</th>
						</tr>
						</thead>
<%
	If search_keyword = "" then
%>
						<tr>
							<td colspan="5" style="text-align:center">
								회원을 검색하세요.
							</td>
						</tr>
<%
	Else
	
		For i=0 To vCnt
			m_id = vData(0,i)
			m_name = vData(1,i)
			ct_name = vData(2,i)
%>
						<tr>
							<td style="text-align:center"><%=i+1%></td>
							<td style="text-align:center"><%=m_id%></td>
							<td style="text-align:center"><%=m_name%></td>
							<td style="text-align:center"><%=ct_name%></td>
							<td style="text-align:center"><a href="search_member_ok.asp?p_page_m_id=<%=m_id%>&amp;p_page_url=<%=server.urlencode(p_page_url)%>" onclick="select()">선택</a></td>
						</tr>
<%
		next
	End if
%>
						</table>
	</div>
</div>

</form>
</body>
</html>
