<!--#include file="Conn.asp"--><%Checklogin("信息管理")%><!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" href="css/common.css" type="text/css" />
<link rel="stylesheet" href="css/jquery.galpop.css" type="text/css" />
<script language="javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/js.js"></script>
<script type="text/javascript" src="xheditor-1.1.9/xheditor-1.1.9-zh-cn.min.js"></script>

</head>
<body>
<div id="man_zone" style="margin:0">
<%
Keys=Request.QueryString("Keys")
Keyscode=TextEnCode(Keys)
Ord=Request.QueryString("Ord")
Page = Request.QueryString("Page")
qid=Request.QueryString("qid")
if qid="" or Not IsNumeric(qid) Then
	conn.close
	set Conn=Nothing
	Response.Redirect "/"
End If


If Ord<>"" Then
	OrdStr=Ord&","
Else
	OrdStr=""
End If

Set Rs=Server.CreateObject("ADODB.RecordSet")

Rs.Open "select productId from productFAQ where questionId="&qid,conn,1,1
productStr=","
Do while Not Rs.bof and Not Rs.eof
	productStr=productStr&Rs("productId")&","
Rs.moveNext
loop
Rs.close


Rs.Open "Select id,productName,productPic,productAddtime from product where productName like '%"&Keyscode&"%' Order By productAddtime Desc",Conn,1,1
Keys=Server.UrlEnCode(Keys)
Ord=Server.UrlEnCode(Ord)
hrefstr = "?keys="&Keys
%>	
	
	<table width="100%" border="0" cellpadding="3" cellspacing="1" class="table1">
		<thead>
			<tr>
				<th width="4%"></th>
				<th width="6%">序号</th>
				<th width="30%">产品名称</th>				
				<th width="30%">图片</th>
				<th width="20%">添加时间</th>				
			</tr>
		</thead>
		<tbody>
<%
If Not Rs.Bof And Not Rs.Eof Then
	Rs.PageSize = 7
	If Page = "" Then Page = 1
	If Page = "end" Then Page = Rs.PageCount
	If Not IsNumeric(Page) Or Page < 1 Then Page = 1
	Page = Cint(Page)
	If Page > Rs.PageCount Then Page = Rs.PageCount
	Rs.AbsolutePage = Page
	TempNum = Rs.PageSize * (Page - 1)
	
	Set Rs1=Server.CreateObject("ADODB.RecordSet")

	For i=1 To Rs.PageSize
		If Rs.Bof Or Rs.Eof Then Exit For
		TempNum=TempNum+1:classid=Rs(1)
%>
			<tr onMouseOver="this.style.background='#F7FCFF'" onMouseOut="this.style.background='#FFFFFF'">
				<td align="center"><input type="checkbox" <%if instr(productStr,","&Rs("id")&",") then Response.write "checked=""checked""" %>    name="chkbox"  class="relatedProducts"  onChange="relatedProducts(<%=qid%>,<%=Rs("id")%>)" /></td>
				<td align="center"><%=TempNum%></td>
				<td align="center"><%=Rs("productName")%></td>
				<td align="center"><img src="<%=Rs("productPic")%>" height="60px"></td>			
				<td align="center"><%=Rs("productAddtime")%></td>
			</tr>
<%
		Rs.MoveNext
	Next
Else
	If Keys="" Then
%>
			<tr>
				<td align="center" colspan="8">Sorry,当前暂无信息</td>
			</tr>

<%
	Else
%>
			<tr>
				<td align="center" colspan="8"><a href="?">Sorry,没有找到“<%=Keyscode%>”相关的信息,点击返回</a></td>
			</tr>
<%
	End If
End If
%>
		</tbody>
		<tfoot>
			<tr>
				<td colspan="8">
					<div class="showpagebox">
<%
If Rs.PageCount > 1 Then
	PageName="?qid="&qid&"&Keys="&Keys&"&Ord="&Ord&"&"
	Pagelen=3
	If Page>1 Then
		Response.Write "<a href="""&PageName&"Page=1"">首页</a>"
		Response.Write "<a href="""&PageName&"Page="&Page-1&""">上一页</a>"
	End If

	If Pagelen*2+1 >= Rs.PageCount Then
		StartPage=1:EndPage=Rs.PageCount
	Else
		If Page<=Pagelen+1 Then
			StartPage=1
			EndPage=Pagelen*2+1
		Else
			StartPage=Page-Pagelen
			EndPage=Page+Pagelen
		End If
		If Page+Pagelen>Rs.PageCount Then StartPage=Rs.PageCount-Pagelen*2:EndPage=Rs.PageCount
	End If

	For i = StartPage To EndPage
		If i = Page Then
			Response.Write "<a class=""current"">"&i&"</a>"
		Else
			Response.Write "<a href="""&PageName&"Page="&i&""">"&i&"</a>"
		End If
	Next

	If Page<Rs.PageCount Then
		If Rs.PageCount - Page > Pagelen Then Response.Write "<a href="""&PageName&"Page="&Rs.PageCount&""">..."&Rs.PageCount&"</a>"
		Response.Write "<a href="""&PageName&"Page="&Page+1&""">下一页</a>"
		Response.Write "<a href="""&PageName&"Page="&Rs.PageCount&""">尾页</a>"
	End If

	Response.Write "<input type=""text"" id=""Pagego"" value="""&Page&""" onFocus=""if(this.value == '"&Page&"'){this.value='';}"" onBlur=""if(this.value == ''){this.value='"&Page&"';}"" onKeyUp=""this.value=this.value.replace(/\D/g,'')"" onKeyDown=""if(event.keyCode==13){location.href='"&PageName&"Page='+document.getElementById('Pagego').value}"" />"
End If
%>					</div>
					<div class="searchbox"><input type="text" id="keys" value="<%If Keyscode="" Then Response.Write "请输入搜索关键词" Else Response.Write Keyscode%>" onFocus="if(this.value == '<%If Keyscode="" Then Response.Write "请输入搜索关键词" Else Response.Write Keyscode%>'){this.value='';}" onBlur="if(this.value == ''){this.value='<%If Keyscode="" Then Response.Write "请输入搜索关键词" Else Response.Write Keyscode%>';}" onKeyDown="if(event.keyCode==13){location.href='?qid=<%=qid%>&Keys='+escape(document.getElementById('keys').value)}" /><input type="button" id="searchgo" value="go" onClick="location.href='?qid=<%=qid%>&Keys='+escape(document.getElementById('keys').value)" /></div>
					<div class="postchkbox">
						<select id="chkact" name="chkact">
							<option value="1">显示</option>
							<option value="0">隐藏</option>
							<option value="-1">删除</option>
						</select>
						<input type="button" value="执行" onClick="postchk(1)" class="btn1" />
						<input type="button" value="新增" onClick="location.href='?act=add'" class="btn1" />
					</div>
				</td>
			</tr>
		</tfoot>
	</table>
<%Rs.Close:Set Rs=Nothing:Set Rs1=Nothing:Conn.Close:Set Conn=Nothing%>
</div>
</body>
</html>