<!--#Include File="../conn.asp"-->
<!--#Include File="const.asp"-->
<%
Call Nslove.SiteNav(ChannelID,"","index.asp")
Call Search_Main()
Nslove.PageEnd()

Sub Search_Main()
	dim SortID,KeyWord,ParentID,IBlock:IBlock="Parent"
	SortID=Nslove.ChkNumeric(Request("sortid"))
	KeyWord=Nslove.CheckStr(Request("keyword"))
	StrUrl="?action="&Action
	if Len(KeyWord)>0 then
		if Len(IWhere)=0 Then
			IWhere=" title like '%"& KeyWord &"%' "
		else
			IWhere=IWhere&" and title like '%"& KeyWord &"%' "
		end if
		StrUrl=StrUrl&"&keyword="&KeyWord
	end if
	if SortID>0 then
		if Len(IWhere)=0 Then
			IWhere=" SortID="& SortID &" "
		else
			IWhere=IWhere&" and SortID="& SortID &" "
		end if
		StrUrl=StrUrl&"&sortid="&SortID
	end if
	ParentID=G_Parent(SortID)
	IBlock=IBlock&ParentID
	if Len(IWhere)=0 Then
		IWhere=" ChannelID="& ChannelID &" "
	else
		IWhere=IWhere&" and ChannelID="& ChannelID &" "
	end if
	BodyHtml=Nslove.LoadTemplate("help/search")
	BodyHtml=Nslove.ExReplace(BodyHtml,"Sys.PageTitle","帮助检索列表")
	BodyHtml=Nslove.ExReplace(BodyHtml,"Tag.SortID",SortID)
	BodyHtml=Nslove.ExReplace(BodyHtml,"Tag.SortName",SortName(SortID))
	BodyHtml=Nslove.ExReplace(BodyHtml,"Tag.ParentID",ParentID)
	TempLate.TPL_Html=BodyHtml
	TempLate.TPL_Block=IBlock
	TempLate.TPL_SQL=IWhere
	TempLate.TPL_StrUrl=StrUrl
	TempLate.TPL_Scan()
	TempLate.TPL_Flush()
	TempLate.TPL_Paste()
End Sub

Function SortName(SortID)
	SortName=Nslove.ClassNode(SortID,ChannelID)
End Function

Function G_Parent(ClassID)
	Dim SortID:SortID=0
	if Not IsObject(Application(Nslove.CacheName &"_classlist_" & ChannelID)) then Call Nslove.LoadClassList(ChannelID)
	Set XMLDom=Application(Nslove.CacheName &"_classlist_" & ChannelID)
	If Not XMLDom.documentElement.selectSingleNode("data[@classid='"&ClassID&"']") Is Nothing Then
		Set Node=XMLDom.documentElement.selectSingleNode("data[@classid='"&ClassID&"']")
		If Not (Node is Nothing) Then
			SortID=Node.selectSingleNode("@sortid").text
		End If
		Set Node=Nothing
	End If
	G_Parent=Clng(SortID)
End Function
%>