<!--#include file="Include/Const.Asp" -->
<!--#include file="Include/NoSQL.Asp" -->
<!--#include file="Include/ConnSiteData.Asp" -->
<%Call SiteInfo()%>
<!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><% =SiteTitle %></title>
<meta name="keywords" content="<% =Keywords %>" />
<meta name="description" content="<% =Descriptions %>" />
</head>
<!--#include file="Top.Asp" -->
<div id="web_bg">
<div id="mainmain">
	 <div id="main_con" class="web_bg">
            <div id="right">
<!--#include file="new_left.Asp" -->
		</div>
		<div id="left">
<div class="art_list" >
	<div class="art_list_title">搜索结果</div>
	<div class="art_list_search">
</div>
	<div class="art_list_con">
		<ul>
<%=WebContent(trim(request("Keyword")),request("Range"))%>
        		</ul>
	</div>
</div>		</div>
               
        <div class="blankbar"></div>
	</div>
        </div>
</div>
</div>
<!--#include file="End.Asp"-->
<%
Function WebMenu(ParentID, i, level)
    If request("Range") = "Void" Then
        response.Write "<center>请选择搜索范围</center>"
        Exit Function
    End If
    Dim rs, sql
    Set rs = server.CreateObject("adodb.recordset")
    sql = "select * from Shenbi_"&request("Range")&"Sort where ViewFlag and ParentID="&ParentID&" order by ID asc"
    rs.Open sql, conn, 1, 1
    If conn.Execute("select ID from Shenbi_"&request("Range")&"Sort Where ViewFlag and ParentID=0").EOF Then
        response.Write "<center>暂无相关信息</center>"
    End If
    Do While Not rs.EOF
        response.Write "<li><a href="""&request("Range")&"List.Asp?SortID="&rs("ID")&""">"&rs("SortName")&"</a></li>"
        'i=i+1
        'if i<level then call WebMenu(rs("ID"),i,level)
        'i=i-1
        rs.movenext
    Loop
    rs.Close
    Set rs = Nothing
End Function

Function WebLocation()
    WebLocation = "&nbsp;当前位置：<a href=""index.Asp"" class=""agray"">首页</a> - 搜索 - "&vbCrLf
    If request("Range") = "Void" Then
        WebLocation = WebLocation&"<center>请选择搜索范围</center>"
        Exit Function
    ElseIf Trim(request("Keyword")) = "" Then
        WebLocation = WebLocation&"<font color=""red"">关键字为空</font>"
    ElseIf request("Range") = "Product" Then
        WebLocation = WebLocation&"产品 - 关键字[<font color=""red"">"&Trim(request("Keyword"))&"</font>]"
    ElseIf request("Range") = "News" Then
        WebLocation = WebLocation&"新闻 - 关键字[<font color=""red"">"&Trim(request("Keyword"))&"</font>]"
    ElseIf request("Range") = "Down" Then
        WebLocation = WebLocation&"下载 - 关键字[<font color=""red"">"&Trim(request("Keyword"))&"</font>]"
    ElseIf request("Range") = "Others" Then
        WebLocation = WebLocation&"其他 - 关键字[<font color=""red"">"&Trim(request("Keyword"))&"</font>]"
    End If
End Function

Function WebContent(Keyword, Range)
    If Range = "Void" Then
        response.Write "<center>请选择搜索范围</center>"
        Exit Function
    End If
    Dim idCount
    Dim pages
    pages = 12
    Dim pagec
    Dim page
    page = CLng(request("Page"))
    Dim pagenc
    pagenc = 5
    Dim pagenmax
    Dim pagenmin
    Dim pageprevious
    Dim pagenext
    Dim datafrom
    Dim datawhere
    Select Case Range
        Case "Product"
            datafrom = "Shenbi_Products"
            datawhere = "where ViewFlag and ProductName like '%"&KeyWord&"%'"
        Case "News"
            datafrom = "Shenbi_News"
            datawhere = "where ViewFlag and NewsName like '%"&KeyWord&"%'"
        Case "Down"
            datafrom = "Shenbi_Download"
            datawhere = "where ViewFlag and DownName like '%"&KeyWord&"%'"
        Case "Others"
            datafrom = "Shenbi_Others"
            datawhere = "where ViewFlag and OthersName like '%"&KeyWord&"%'"
    End Select
    Dim sqlid
    Dim Myself, PATH_INFO, QUERY_STRING
    PATH_INFO = request.servervariables("PATH_INFO")
    QUERY_STRING = request.ServerVariables("QUERY_STRING")'
    If QUERY_STRING = "" Then
        Myself = PATH_INFO & "?"
    ElseIf InStr(PATH_INFO & "?" & QUERY_STRING, "Page=") = 0 Then
        Myself = PATH_INFO & "?" & QUERY_STRING & "&"
    Else
        Myself = Left(PATH_INFO & "?" & QUERY_STRING, InStr(PATH_INFO & "?" & QUERY_STRING, "Page=") -1)
    End If
    Dim taxis
    taxis = "order by id desc "
    Dim i
    Dim rs, sql
    Set rs = server.CreateObject("adodb.recordset")
    sql = "select count(ID) as idCount from ["& datafrom &"]" & datawhere
    Set rs = server.CreateObject("adodb.recordset")
    rs.Open sql, conn, 0, 1
    idCount = rs("idCount")
    If(idcount>0) Then
    If(idcount Mod pages = 0)Then
    pagec = Int(idcount / pages)
Else
    pagec = Int(idcount / pages) + 1
End If
sql = "select id from ["& datafrom &"] " & datawhere & taxis
Set rs = server.CreateObject("adodb.recordset")
rs.Open sql, conn, 1, 1
rs.pagesize = pages
If page < 1 Then page = 1
If page > pagec Then page = pagec
If pagec > 0 Then rs.absolutepage = page
For i = 1 To rs.pagesize
    If rs.EOF Then Exit For
    If(i = 1)Then
    sqlid = rs("id")
Else
    sqlid = sqlid &","&rs("id")
End If
rs.movenext
Next
End If
If(idcount>0 And sqlid<>"") Then
sql = "select * from ["& datafrom &"] where id in("& sqlid &") "&taxis
Set rs = server.CreateObject("adodb.recordset")
rs.Open sql, conn, 0, 1
Response.Write "<table width=""98%"" border=""0"" cellspacing=""0"" cellpadding=""0"">"&vbCrLf
Response.Write "  <tr height=""32"">"&vbCrLf
Response.Write "    <td width=""550"" style=""color:#FFFFFF; font-weight:bold; background:url(Images/split.gif) no-repeat right center; background-color:#2585a6"">&nbsp;&nbsp;&nbsp;&nbsp;信息标题</td>"&vbCrLf
Response.Write "    <td align=""center"" bgcolor=""#2585a6"" style=""color:#FFFFFF; font-weight:bold"">发布日期</td>"&vbCrLf
Response.Write "  </tr>"&vbCrLf
While Not rs.EOF
    If ISHTML = 1 Then
        ProAutoLink = ""&ProName&""&Separated&""&rs("ID")&"."&HTMLName&""
        NewAutoLink = ""&NewName&""&Separated&""&rs("ID")&"."&HTMLName&""
        DownAutoLink = ""&DownNameDiy&""&Separated&""&rs("ID")&"."&HTMLName&""
        OtherAutoLink = ""&OtherName&""&Separated&""&rs("ID")&"."&HTMLName&""
    Else
        ProAutoLink = "ProductView.Asp?ID="&rs("ID")&""
        NewAutoLink = "NewsView.Asp?ID="&rs("ID")&""
        DownAutoLink = "DownView.Asp?ID="&rs("ID")&""
        OtherAutoLink = "OtherView.Asp?ID="&rs("ID")&""
    End If
    Select Case Range
        Case "Product"
            Response.Write "  <tr height=""28"">"&vbCrLf
            Response.Write "    <td style=""background:url(Images/bg2.gif) repeat-x left bottom;"">&nbsp;<img src=""images/arr.gif"" width=""11"" height=""14"" align=""absmiddle"" />&nbsp;&nbsp;<a href="""&ProAutoLink&""">"&rs("ProductName")&"</a></td>"&vbCrLf
            Response.Write "    <td align=""center"" style=""background:url(Images/bg2.gif) repeat-x left bottom; color:#999999"">"&FormatDate(rs("UpdateTime"), 13)&"</td>"&vbCrLf
            Response.Write "  </tr>"&vbCrLf
        Case "News"
            Response.Write "  <tr height=""28"">"&vbCrLf
            Response.Write "    <td style=""background:url(Images/bg2.gif) repeat-x left bottom;"">&nbsp;<img src=""images/arr.gif"" width=""11"" height=""14"" align=""absmiddle"" />&nbsp;&nbsp;<a href="""&NewAutoLink&""">"&rs("NewsName")&"</a></td>"&vbCrLf
            Response.Write "    <td align=""center"" style=""background:url(Images/bg2.gif) repeat-x left bottom; color:#999999"">"&FormatDate(rs("Addtime"), 13)&"</td>"&vbCrLf
            Response.Write "  </tr>"&vbCrLf
        Case "Down"
            Response.Write "  <tr height=""28"">"&vbCrLf
            Response.Write "    <td style=""background:url(Images/bg2.gif) repeat-x left bottom;"">&nbsp;<img src=""images/arr.gif"" width=""11"" height=""14"" align=""absmiddle"" />&nbsp;&nbsp;<a href="""&DownAutoLink&""">"&rs("DownName")&"</a>("&rs("FileSize")&")</td>"&vbCrLf
            Response.Write "    <td align=""center"" style=""background:url(Images/bg2.gif) repeat-x left bottom; color:#999999"">"&FormatDate(rs("Updatetime"), 13)&"</td>"&vbCrLf
            Response.Write "  </tr>"&vbCrLf
        Case "Others"
            Response.Write "  <tr height=""28"">"&vbCrLf
            Response.Write "    <td style=""background:url(Images/bg2.gif) repeat-x left bottom;"">&nbsp;<img src=""images/arr.gif"" width=""11"" height=""14"" align=""absmiddle"" />&nbsp;&nbsp;<a href="""&OtherAutoLink&""">"&rs("OthersName")&"</a></td>"&vbCrLf
            Response.Write "    <td align=""center"" style=""background:url(Images/bg2.gif) repeat-x left bottom; color:#999999"">"&FormatDate(rs("UpdateTime"), 13)&"</td>"&vbCrLf
            Response.Write "  </tr>"&vbCrLf
    End Select
    rs.movenext
Wend
Response.Write "</table>"&vbCrLf
Else
    response.Write "<center>暂无相关信息</center>"
    Exit Function
End If
Response.Write "<table width=""98%"" border=""0"" cellspacing=""0"" cellpadding=""0"">"&vbCrLf
Response.Write "  <tr height=""35"">"&vbCrLf
Response.Write "    <td align=""center"">"&vbCrLf
Response.Write "共<strong style=""color:red"">"&idcount&"</strong>条记录 页次：<strong style=""color:red"">"&page&"</strong>/"&pagec&" 每页：<strong style=""color:red"">"&pages&"</strong>条记录" & vbCrLf
pagenmin = page - pagenc
pagenmax = page+pagenc
If(pagenmin<1) Then pagenmin = 1
If(page>1) Then response.Write ("<a href="""& myself &"Page=1"" title=""回到第一页""><font face=""webdings"" color=""#000000"">9</font></a> ")
If page - (pagenc * 2 + 1)<= 0 Then
    pageprevious = 1
Else
    pageprevious = page - (pagenc * 2 + 1)
End If
If(pagenmin>1) Then response.Write ("<a href="""& myself &"Page="& pageprevious &""" title=""第"& pageprevious &"页""><font face=""webdings"" color=""#000000"">3</font></a> ")
If(pagenmax>pagec) Then pagenmax = pagec
For i = pagenmin To pagenmax
    If(i = page) Then
    response.Write ("&nbsp;<strong style=""color:red"">"& i &"</strong>&nbsp;")
Else
    response.Write ("[<a href="""& myself &"Page="& i &""">"& i &"</a>]")
End If
Next
If page+(pagenc * 2 + 1)>= pagec Then
    pagenext = pagec
Else
    pagenext = page+(pagenc * 2 + 1)
End If
If(pagenmax<pagec) Then response.Write (" <a href="""& myself &"Page="& pagenext &""" title=""跳转到第"&pagenext&"页""><font face=""webdings"" color=""#999999"">:</font></a> ")
If(page<pagec) Then response.Write (" <a href="""& myself &"Page="& pagec &""" title=""跳转到第"&pagec&"页""><font face=""webdings"" color=""#000000"">:</font></a>")
Response.Write "    </td>"&vbCrLf
Response.Write "  </tr>"&vbCrLf
Response.Write "</table>"&vbCrLf
rs.Close
Set rs = Nothing
End Function
%>