<!--#include file="../tgzcm.Cache/tgzcm.Close.asp" -->
<!--#include file="../tgzcm.Cache/tgzcm.Class.asp"-->
<!--#include file="tgzcm.Fso.asp"-->
<!--#include file="tgzcm.Md5.asp"-->
<%
Function GetClassName(class_id)'取分类中文名
	GetClassName=Eval("Class_N_"&class_id)
End Function

Function GetClassEn(class_id)'取分类英文名
	GetClassEn=Eval("Class_E_"&class_id)
End Function
'**************************************************
'函数名：PE_CLng
'作  用：将字符转为整型数值
'参  数：str1 ---- 字符
'返回值：如果传入的参数不是数值，返回0，其他情况返回对应的数值
'**************************************************
Function PE_CLng(ByVal str1)
    If IsNumeric(str1) Then
        PE_CLng = Fix(CDbl(str1))
    Else
        PE_CLng = 0
    End If
End Function

Function tgzcmradio(str1,str2)'单选按钮
    If str1=str2 Then Response.Write"checked"
End Function

'**************************************************
'函数名：tgzcm_Lable_Moban
'作  用：加载模板文件
'返回值：moban
'**************************************************
Function tgzcm_Lable_Html(strurl)
	If IsExists(strurl)=True Then
		Dim url, fso, s
		Dim find 
		url= server.mappath(strurl)
		Set fso = server.createobject("scripting.fileSystemobject")
		Set find = fso.opentextfile(url, 1)
		tgzcm_Lable_Html = find.Readall
		find.close
	Else
		tgzcm_Lable_Html = strurl&"模板文件未找到!"
	End If	
End Function

'**************************************************
'函数名：Max_id
'作  用：初始化ID值　
'参  数：max=表名
'返回值：当前表中最大ID值
'**************************************************
Function Max_id(max)
	Set mrs=Conn.Execute("select max("&max&"_id) from tgzcm_"&max&"")
	If IsNull(mrs(0)) then
	    Max_id = 1  
	Else 
	    Max_id = mrs(0) + 1 
	End if 
	Set mrs = Nothing
End Function

Function isNul(str)
	if isnull(str) or str = "" then isNul = true else isNul = false 
End Function

'**************************************************
'函数名：tgzcm_replace
'作  用：过滤特殊符号　
'**************************************************
Function tgzcm_replace(replace_content)
	replace_content=Trim(replace_content)
	replace_content=replace(replace_content,"""","")
	replace_content=replace(replace_content,";","")
	replace_content=replace(replace_content,"''","")
	replace_content=replace(replace_content,"'","")
	tgzcm_replace=replace_content
End Function

'****************************************************
'函数名：PicCode
'作  用：转换图片非正常路径
'参  数：fString ----字符串
'****************************************************
Function PicCode(fString)
       fString=fString
       fString = Replace(fString,"../../"," ")
       fString = Replace(fString,"\","/")
	   fString = Replace(fString,"..\..\"," ")
	   fString = Replace(fString,"../"," ")
       fString=Trim(fString)
       PicCode=fString
End Function

'****************************************************
'函数名：htmlActor
'作  用：转换主演导演连接分割指定内容
'参  数：str ----字符串
'****************************************************
Function htmlActor(str)
	code_content=Trim(str)
	code_content=replace(code_content,"&nbsp;",",")
	code_content=replace(code_content,"、",",")
	code_content=replace(code_content," ",",")
	code_content=replace(code_content,"|",",")
	code_content=replace(code_content,"||",",")
	code_content=replace(code_content,"$",",")
	code_content=replace(code_content,"$$",",")
	htmlActor=code_content
End Function

'****************************************************
'函数名：htmlclose
'作  用：清理过滤非法指定关键定内容
'参  数：str ----字符串
'****************************************************
Function htmlclose(str)
     Dim code_close
	code_close=Trim(str)
	closed=split(htmlcd,"$$")
    cd=ubound(closed)
	   For i=0 to cd
	      if code_close=closed(i) then
		    htmlclosed="<div id='err'>根据相关法律法规和政策，此查询搜索结果未予显示>>><a href='#' onClick='javascript:history.back();'>点击返回</a></div>"
			Response.Write htmlclosed
			Response.End()
		  Exit for
		  Else
		    htmlclosed =code_close 
		  End if 
	   Next 
	   htmlclose =htmlclosed
End Function

Function tgzcm_Time(s_Time, n_Flag) '转化时间显示类型 1=2009-08-08:48:48 2=2009-08-8 3=8月8日 4=2009年8月8日 等等
   Dim y, m, d, h, mi, s 
   tgzcm_Time = "" 
   If IsDate(s_Time) = False Then Exit Function 
   y = cstr(year(s_Time)) 
   m = cstr(month(s_Time)) 
   If len(m) = 1 Then m = "0" & m 
   d = cstr(day(s_Time)) 
   If len(d) = 1 Then d = "0" & d 
   h = cstr(hour(s_Time)) 
   If len(h) = 1 Then h = "0" & h 
   mi = cstr(minute(s_Time)) 
   If len(mi) = 1 Then mi = "0" & mi 
   s = cstr(second(s_Time)) 
   If len(s) = 1 Then s = "0" & s 
   select Case n_Flag 
   Case 1 
     tgzcm_Time = y & "-" & m & "-" & d & " " & h & ":" & mi & ":" & s 
   Case 2 
     tgzcm_Time = y & "-" & m & "-" & d
   Case 3 
     tgzcm_Time = m & "月" & d & "日" 
   Case 4 
     tgzcm_Time = y & "年" & m & "月" & d & "日" 
   Case 5 
     tgzcm_Time = right(y,2) &"/"&m&"/"& d
   Case 6
     tgzcm_Time = m & "-" & d 	 
   End select 
End Function

'****************************************************
'函数名：htmlclose
'作  用：清理过滤非法指定内容
'参  数：str ----字符串
'****************************************************
Function htmlclose(str)
     Dim code_close
	code_close=Trim(str)
	closed=split(htmlcd,"$$")
    cd=ubound(closed)
	   For i=0 to cd
	      if code_close=closed(i) then
		    htmlclosed="<div id='err'>根据相关法律法规和政策，<font color='red'>"&left(code_close,3)&"******</font> 搜索结果未予显示>>><a href='#' onClick='javascript:history.back();'>点击返回</a></div>"
			Response.Write htmlclosed
			Response.End()
		  Exit for
		  Else
		    htmlclosed =code_close 
		  End if 
	   Next 
	   htmlclose =htmlclosed
End Function

'**************************************************
'函数名：GetFirstSeparatorToEnd
'作  用：截取从第一个分隔符到结尾的字符串
'参  数：str   ----原字符串
'        separator ----分隔符
'返回值：截取后的字符串
'**************************************************
Function GetFirstSeparatorToEnd(ByVal str, separator)
    GetFirstSeparatorToEnd = Right(str, Len(str) - InStr(str, separator))
End Function

'**************************************************
'作  用：JS一般提示框
'**************************************************
Sub tgzcm_err_a(ErrMsg)
Response.Write("<script language=javascript>alert('"&ErrMsg&"');</script>")
End Sub

'**************************************************
'作  用：JS提示框，确认后转向
'**************************************************
Sub tgzcm_err_b(ErrMsg,Url)
Response.Write("<script language=""javascript"">")
Response.Write("var con;")
Response.Write("con=confirm('"&ErrMsg&"');")
Response.Write("if (con==true) window.location='"&Url&"';")
Response.Write("</script>")
End Sub

'**************************************************
'作  用：JS提示框，确认后后退一页
'**************************************************
Sub tgzcm_err_c(ErrMsg)
Response.Write("<script language=""javascript"">")
Response.Write("alert('"&ErrMsg&"');history.back()")
Response.Write("</script>")
Response.End
End Sub

Function GetReplace(str)'替换空字符
	If str="" or IsNull(str) Then str="未知" End If
	GetReplace=str
End Function

Function GetColor(dataname,datacolor)'取得颜色值
    Dim str
	If len(datacolor)<>0 Then str="<font color="""&datacolor&""">"&dataname&"</font>" Else str=dataname End If
	GetColor=str
End Function

Function GetCu(dataname,datacu)'取得标题加粗属性
    Dim str
	If datacu<>0 Then str="<b>"&dataname&"</b>" Else str=dataname End If
	GetCu=str
End Function

Function GetActor(StrActor) '2.0新增演员查询功能
	On Error Resume Next:dim StrActorr
	StrActor=htmlActor(StrActor)
    If StrActor<>"" Then
	  Str=split(StrActor,",")
	  For x=0 To ubound(Str)
	   StrActorr=StrActorr&" <a href='"&tgzcm(1)&"/search.asp?Action=actor&keyword="&server.urlencode(Str(x))&"' target='_blank' title='查询《"&Str(x)&"》所有影片!'>"&Str(x)&"</a>"
	  Next	
	Else
	    StrActorr="未知"
	End If
	GetActor=StrActorr
End Function 

Function GetDirector(StrDirector) '2.0新增导演查询功能
    On Error Resume Next:dim StrDirectorr
    StrDirector=htmlActor(StrDirector)
	If StrDirector<>"" Then
	  Strr=split(StrDirector,",")
	  For y=0 To ubound(Strr)
	    StrDirectorr=StrDirectorr&" <a href='"&tgzcm(1)&"/search.asp?Action=director&keyword="&server.urlencode(Strr(y))&"' target='_blank' title='查看《"&Strr(y)&"》导演的电影!'>"&Strr(y)&"</a>"
	  Next
	Else
	  StrDirectorr="未知"
	End If  	
	GetDirector=StrDirectorr
End Function 

Function Ranks_Css(Ranks)'列表多选项功能
  Rankid=Cstr(Ranks)
  If Rankid=1 or Rankid=0 Then
    Rhtml=Rhtml&"<li id=""ron""><a href=""../ListByType.asp?Type_Id="&list_id&"&Ranks=1"">按时间排序</a></li>"
    Rhtml=Rhtml&"<li><a href=""../ListByType.asp?Type_Id="&list_id&"&Ranks=2"">按人气排序</a></li>"
    Rhtml=Rhtml&"<li><a href=""../ListByType.asp?Type_Id="&list_id&"&Ranks=3"">按推荐排序</a></li>"
  ElseIf Rankid=2 Then 
    Rhtml=Rhtml&"<li><a href=""../ListByType.asp?Type_Id="&list_id&"&Ranks=1"">按时间排序</a></li>"
    Rhtml=Rhtml&"<li id=""ron""><a href=""../ListByType.asp?Type_Id="&list_id&"&Ranks=2"">按人气排序</a></li>"
    Rhtml=Rhtml&"<li><a href=""../ListByType.asp?Type_Id="&list_id&"&Ranks=3"">按推荐排序</a></li>"
  ElseIf Rankid=3 Then 
    Rhtml=Rhtml&"<li><a href=""../ListByType.asp?Type_Id="&list_id&"&Ranks=1"">按时间排序</a></li>"
    Rhtml=Rhtml&"<li><a href=""../ListByType.asp?Type_Id="&list_id&"&Ranks=2"">按人气排序</a></li>"
    Rhtml=Rhtml&"<li id=""ron""><a href=""../ListByType.asp?Type_Id="&list_id&"&Ranks=3"">按推荐排序</a></li>"		
  End If	
  Ranks_Css=Rhtml
End Function


Function LzReplace(LzName,class_id)'启用自定义显示集数功能
    LzId=Cstr(class_id)
    Bbid=tgzcmId(27)
    FlId=split(Bbid,",")
	For q=0 To ubound(FlId)
	  If LzId=FlId(q) Then
	  LZ=LzName
	  Exit For
	  Else
	  LZ=""
	  End if
	Next
	LzReplace=LZ
End Function

Function ProdStar(Str)'处理发货状态
   if Str=1 then
	starhtml="<font color='red'>奖品已发√</font>"
   Else
    starhtml= "等待发货×"
   End if	
   ProdStar=starhtml
End Function

Function UserSv()'验证会员服务
   If uvip<=date() Then
     Uhtml="会员等级：免费用户"
   Else
     Uhtml="服务到期还有<font color=""red"">"&uvip-date()&"</font>天"
   End If	
   UserSv=Uhtml 	 
End Function

Function tgzcmVip(UserName,Uid,uvip)'验证收费播放影片
   If UserName="" or Uid<0 Then
     Call tgzcm_err_b("会员收费影片,请先登录后观看","../ui/UserLogin.Asp")
     Response.End() 
   Elseif uvip<=date() Then	
     Call tgzcm_err_b("您是免费会员,无法观看VIP影片,请观看其它免费影片！","index.asp")
     Response.End()  
   End If
End Function

Function GetNewsPage(list_id,page,Ranks)'处理新闻分页标签链接
    List_Page=ShowPage("NewsType.asp?", m, tgzcm(18), page, True, True, "条", False)
End Function

Function GetProductPage(list_id,page,Ranks)'处理奖品分页标签链接
    List_Page=ShowPage("ProductType.asp?", m, tgzcm(19), page, True, True, "个", False)
End Function

'***************************************
'参   数：list_id 待转化的分类ID
'         page 待转化的分页数
'         处理分页标签的链接	
'****************************************
Function GetLinkPage(list_id,page,Ranks)
    If tgzcm(17)="asp" Then    'asp运行模式
			List_Page=ShowPage("ListByType.asp?Type_Id="&list_id&"&Ranks="&Ranks&"", m, tgzcm(11), page, True, True, "条", False)
	ElseIf tgzcm(17)="html" Then'静态运行模式
			If HtmlId(2)="1" Then                   '全部生成方式
			  If HtmlId(3)="2" Then
			   List_Page=ShowPage_Html(tgzcmPath&GetClassEn(list_id)&"/", 0, "."&HtmlId(7), "", m, tgzcm(11), page, True, True, "条")         'Xj/index.html
			  Else
			   List_Page=ShowPage_Html(tgzcmPath&"List/", list_id, "."&HtmlId(7), "", m, tgzcm(11), page, True, True, "条") 'List/List_2_5.html
			  End If
			ElseIf HtmlId(2)="2" Then               '栏目页不生成
			   List_Page=ShowPage("ListByType.asp?Type_Id="&list_id&"&Ranks="&Ranks&"", m, tgzcm(11), page, True, True, "条", False)            'List.asp?Classid
			End If			
	ElseIf tgzcm(17)="asphtml" Then'伪静态
		'List_Page=ShowPage_Html(tgzcmPath, list_id, ".html", "", m, tgzcm(11), page, True, True, "条") 
		List_Page=ShowPage_AspHtml(tgzcmPath, list_id, m, tgzcm(11), page, True, True, "条", False)'List/List_2_5.html
	Else
         List_Page=""						
	End If
End Function					

'***************************************
'参   数：Link_listid 待转化的分类ID
'         Link_dataid 待转化的影片ID
'返回参数:ListUrl 内部分类链接
'         DataUrl 内部影片链接
'****************************************
Function GetLinkPath(Link_listid,Link_dataid)
	If tgzcm(17)="asp" Then    'asp运行模式
		DataUrl=tgzcmPath&"Details.asp?Name_Id="&Link_dataid
		ListUrl=tgzcmPath&"../ListByType.asp?Type_Id="&Link_listid
	ElseIf tgzcm(17)="html" Then'静态运行模式
		If HtmlId(2)="1" Then                   '全部生成方式
		    If HtmlId(3)="2" Then
			ListUrl=tgzcmPath&GetClassEn(Link_listid)&"/index."&HtmlId(7)    'Xj/index.html
			Else
			ListUrl=tgzcmPath&"../List/List_"&Link_listid&"."&HtmlId(7)         'List/List_2_5.html
			End If
		ElseIf HtmlId(2)="2" Then               '栏目页不生成
		    ListUrl=tgzcmPath&"../ListByType.asp?Type_Id="&Link_listid               'ListByType?Type_Id
		End If
		'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
		If HtmlId(5)="2" Then
		    DataUrl=MD5(Link_dataid, 16)&"."&HtmlId(8)                       'Md5(dataid).html
		ElseIf HtmlId(5)="3" Then
		    DataUrl=GetClassEn(Link_listid)&"_"&Link_dataid&"."&HtmlId(8)    'Xj_1358.html			
		Else
		    DataUrl=Link_dataid&"."&HtmlId(8)                                '1358.html    	
		End If
		'
		If HtmlId(4)="2" Then
		    DataUrl=tgzcmPath&GetClassEn(Link_listid)&"/"&DataUrl                 'XJ/1358.html
		ElseIf HtmlId(4)="3" Then
		    DataUrl=tgzcmPath&GetClassEn(Link_listid)&"/"&Link_dataid&"/"         'XJ/1358/			
		Else
		    DataUrl=tgzcmPath&"Html/"&DataUrl                                     'Html/1358.html    	
		End If				
	ElseIf tgzcm(17)="asphtml" Then'伪静态
	    ListUrl=tgzcmPath&"../List_"&Link_listid&"_1.html"	
	    DataUrl=tgzcmPath&"Data_"&Link_dataid&".html"
	Else
	    DataUrl="?"
		ListUrl="?"							
	End If
End Function

'***************************************
'函数名：GetPlayUrl
'作  用：处理显示所有与QVOD播放地址相关的标签
'参  数: url_type 1=@QvodA@'新窗口 2=@QvodB@'弹出窗口 3=@QvodC@ '播放页当前窗口
'****************************************
Function GetPlayUrl(name_id,data_name,url_type)
    Dim Ser_Sql,PlayList
	Ser_Sql=""
	If url_type=4 or url_type=4 Then Ser_Sql="Top 1"
	Set rss = Server.CreateObject("adodb.recordset")
	sql = "Select "&Ser_Sql&" url_id,nameid,url_txt from tgzcm_url where nameid="&name_id&" and url_sv=0 order by url_id asc"
	rss.Open sql, Conn, 1, 1
	If Not(rss.bof And rss.eof) Then
		Select Case url_type
		Case 1'@QvodA@
			Do while not rss.eof
			PlayList=PlayList&"<li class=""PlayList""><a href="""&tgzcmPath&"Qplayer.asp?name_id="&name_id&"&url_id="&Trim(rss("url_id"))&"&url_txt="&server.urlencode(rss("url_txt"))&""" target=""_blank"">"&rss("url_txt")&"</a></li>"
			rss.movenext
			Loop
		Case 2'@QvodB@
			Do while not rss.eof
			PlayList=PlayList&"<li class=""PlayList""><a href=""#""onclick=""$tgzcmPlayer('"&tgzcmPath&"Qplayer.asp?name_id="&name_id&"&url_id="&Trim(rss("url_id"))&"&url_txt="&server.urlencode(rss("url_txt"))&"',"&tgzcmId(24)&","&tgzcmId(25)&");"">"&rss("url_txt")&"</a></li>"
			rss.movenext
			Loop	
		Case 3'@QvodC@
			Do while not rss.eof
			PlayList=PlayList&"<li class=""PlayList""><a href="""&tgzcmPath&"Qplayer.asp?name_id="&name_id&"&url_id="&Trim(rss("url_id"))&"&url_txt="&server.urlencode(rss("url_txt"))&""">"&rss("url_txt")&"</a></li>"
			rss.movenext
			Loop		
		End Select
	Else
		PlayList="<li>暂无播放</li>"
	End If
	rss.Close:Set rss=nothing:GetPlayUrl=PlayList
End Function

'***************************************
'函数名：GetPlayUrlG
'作  用：处理显示所有与GOVD播放地址相关的标签
'参  数: url_type 1=@GvodA@'新窗口 2=@GvodB@'弹出窗口 3=@GvodC@ '播放页当前窗口
'****************************************
Function GetPlayUrlG(name_id,data_name,url_type)
    Dim Ser_Sql,PlayList
	Ser_Sql=""
	If url_type=4 or url_type=4 Then Ser_Sql="Top 1"
	Set rss = Server.CreateObject("adodb.recordset")
	sql = "Select "&Ser_Sql&" url_id,nameid,url_txt from tgzcm_url where nameid="&name_id&" and url_sv=1 order by url_id asc"
	rss.Open sql, Conn, 1, 1
	If Not(rss.bof And rss.eof) Then
		Select Case url_type
		Case 1'@GvodA@
			Do while not rss.eof
			PlayList=PlayList&"<li class=""PlayList""><a href="""&tgzcmPath&"Gplayer.asp?name_id="&name_id&"&url_id="&Trim(rss("url_id"))&"&url_txt="&server.urlencode(rss("url_txt"))&""" target=""_blank"">"&rss("url_txt")&"</a></li>"
			rss.movenext
			Loop
		Case 2'@GvodB@
			Do while not rss.eof
			PlayList=PlayList&"<li class=""PlayList""><a href=""#""onclick=""$tgzcmPlayer('"&tgzcmPath&"Gplayer.asp?name_id="&name_id&"&url_id="&Trim(rss("url_id"))&"&url_txt="&server.urlencode(rss("url_txt"))&"',"&tgzcmId(24)&","&tgzcmId(25)&");"">"&rss("url_txt")&"</a></li>"
			rss.movenext
			Loop	
		Case 3'@GvodC@
			Do while not rss.eof
			PlayList=PlayList&"<li class=""PlayList""><a href="""&tgzcmPath&"Gplayer.asp?name_id="&name_id&"&url_id="&Trim(rss("url_id"))&"&url_txt="&server.urlencode(rss("url_txt"))&""">"&rss("url_txt")&"</a></li>"
			rss.movenext
			Loop		
		End Select
	Else
		PlayList="<li>暂无播放</li>"
	End If
	rss.Close:Set rss=nothing:GetPlayUrlG=PlayList
End Function

Function GetNewsLinkPath(Link_dataid)'转化新闻连接
		DataUrl=tgzcmPath&"News.asp?Id="&Link_dataid
End Function

Function GetProductLinkPath(Link_dataid)'转化奖品连接
		DataUrl=tgzcmPath&"product.asp?pid="&Link_dataid
End Function

'**************************************************
'函数名：ShowPage
'作  用：显示“上一页 下一页”等信息
'参  数：sFileName  ----链接地址
'        TotalNumber ----总数量
'        MaxPerPage  ----每页数量
'        CurrentPage ----当前页
'        ShowTotal   ----是否显示总数量
'        ShowAllPages ---是否用下拉列表显示所有页面以供跳转。
'        strUnit     ----计数单位
'        ShowMaxPerPage  ----是否显示每页信息量选项框
'返回值：“上一页 下一页”等信息的HTML代码
'**************************************************
Function ShowPage(sfilename, totalnumber, MaxPerPage, CurrentPage, ShowTotal, ShowAllPages, strUnit, ShowMaxPerPage)
    Dim TotalPage, strTemp, strUrl, i

    If totalnumber = 0 Or MaxPerPage = 0 Or IsNull(MaxPerPage) Then
        ShowPage = ""
        Exit Function
    End If
    If totalnumber Mod MaxPerPage = 0 Then
        TotalPage = totalnumber \ MaxPerPage
    Else
        TotalPage = totalnumber \ MaxPerPage + 1
    End If
    If CurrentPage > TotalPage Then CurrentPage = TotalPage
        
    'strTemp = "<div class=""show_page"">"
    If ShowTotal = True Then
        strTemp = "页次：<strong><font color=red>" & CurrentPage & "</font>/" & TotalPage & "</strong>页 共" & totalnumber & "" & strUnit & "&nbsp;&nbsp;"
    End If
    If ShowMaxPerPage = True Then
        strUrl = JoinChar(sfilename) & "MaxPerPage=" & MaxPerPage & "&"
    Else
        strUrl = JoinChar(sfilename)
    End If
    If CurrentPage = 1 Then
        strTemp = strTemp &"<span class=""PageBox"">首页</span> <span class=""PageBox"">上一页</span>"
    Else
        strTemp = strTemp & "<a href='" & strUrl & "page=1' title=""首页"" class=""PageBox"">首页</a> "
        strTemp = strTemp & "<a href='" & strUrl & "page=" & (CurrentPage - 1) & "' title=""上一页"" class=""PageBox"">上一页</a> "
    End If
    strTemp = strTemp & " <span>"
    If ShowAllPages = True Then
        Dim Jmaxpages
        If (CurrentPage - 4) <= 0 Or TotalPage < 10 Then
            Jmaxpages = 1
            Do While (Jmaxpages < 10)
                If Jmaxpages = CurrentPage Then
                    strTemp = strTemp & "<font color=""FF0000"" class=""PageCss"">" & Jmaxpages & "</font> "
                Else
                    If strUrl <> "" Then
                        strTemp = strTemp & "<a href=""" & strUrl & "page=" & Jmaxpages & """>" & Jmaxpages & "</a> "
                    End If
                End If
                If Jmaxpages = TotalPage Then Exit Do
                Jmaxpages = Jmaxpages + 1
            Loop
        ElseIf (CurrentPage + 4) >= TotalPage Then
            Jmaxpages = TotalPage - 8
            Do While (Jmaxpages <= TotalPage)
                If Jmaxpages = CurrentPage Then
                    strTemp = strTemp & "<font color=""FF0000"" class=""PageCss"">" & Jmaxpages & "</font> "
                Else
                    If strUrl <> "" Then
                        strTemp = strTemp & "<a href=""" & strUrl & "page=" & Jmaxpages & """>" & Jmaxpages & "</a> "
                    End If
                End If
                Jmaxpages = Jmaxpages + 1
            Loop
        Else
            Jmaxpages = CurrentPage - 4
            Do While (Jmaxpages < CurrentPage + 5)
                If Jmaxpages = CurrentPage Then
                    strTemp = strTemp & "<font color=""FF0000"" class=""PageCss"">" & Jmaxpages & "</font> "
                Else
                    If strUrl <> "" Then
                        strTemp = strTemp & "<a href=""" & strUrl & "page=" & Jmaxpages & """>" & Jmaxpages & "</a> "
                    End If
                End If
                Jmaxpages = Jmaxpages + 1
            Loop
        End If
    End If	
	strTemp = strTemp & "</span>"
    If CurrentPage >= TotalPage Then
        strTemp = strTemp & "<span  class=""PageBox"">下一页</span> <span class=""PageBox"">尾页</span>"
    Else
        strTemp = strTemp & " <a href='" & strUrl & "page=" & (CurrentPage + 1) & "' title=""下一页"" class=""PageBox"">下一页</a>"
        strTemp = strTemp & " <a href='" & strUrl & "page=" & TotalPage & "' title=""尾页"" class=""PageBox"">尾页</a>"
    End If
    If ShowMaxPerPage = True Then
        strTemp = strTemp & "&nbsp;<Input type='text' name='MaxPerPage' size='3' maxlength='4' value='" & MaxPerPage & "' onKeyPress=""if (event.keyCode==13) window.location='" & JoinChar(sfilename) & "page=" & CurrentPage & "&MaxPerPage=" & "'+this.value;"">" & strUnit & "/页"
    Else
        strTemp = strTemp & "&nbsp;" & MaxPerPage & "" & strUnit & "/页"
    End If
    If ShowAllPages = True Then
            strTemp = strTemp & "&nbsp;&nbsp;转到第<Input type='text' name='page' size='3' maxlength='5' value='" & CurrentPage & "' onKeyPress=""if (event.keyCode==13) window.location='" & strUrl & "page=" & "'+this.value;"">页"
    End If	
    'strTemp = strTemp & "</div>"
    ShowPage = strTemp
End Function

'**************************************************
'函数名：ShowPage_Html
'作  用：显示“上一页 下一页”等信息
'参  数：strPath ----HTMl文件的路径
'        iType_Id  ----栏目ID
'        FileExt ----- 扩展名
'        sfilename  ---- 文件名
'        TotalNumber ----总数量
'        MaxPerPage  ----每页数量
'        ShowTotal   ----是否显示总数量
'        ShowAllPages ---是否用下拉列表显示所有页面以供跳转。有某些页面不能使用，否则会出现JS错误。
'        strUnit     ----计数单位
'返回值：“上一页 下一页”等信息的HTML代码
'**************************************************
Function ShowPage_Html(ByVal strPath, iType_Id, FileExt, sfilename, totalnumber, MaxPerPage, CurrentPage, ShowTotal, ShowAllPages, strUnit)
    Dim NextPage, PrevPage, EndPage
    Dim TotalPage, strTemp, strUrl, i
    If totalnumber = 0 Or MaxPerPage = 0 Or IsNull(MaxPerPage) Then
        ShowPage_Html = ""
        Exit Function
    End If
    If totalnumber Mod MaxPerPage = 0 Then
        TotalPage = totalnumber \ MaxPerPage
    Else
        TotalPage = totalnumber \ MaxPerPage + 1
    End If
    If CurrentPage > TotalPage Then CurrentPage = TotalPage

    PrevPage = TotalPage - CurrentPage + 2
    NextPage = TotalPage - CurrentPage
    EndPage = 1

    If sfilename <> "" Then
        strUrl = JoinChar(sfilename)
    Else
        strUrl = ""
    End If
    
    If Right(strPath, 1) = "/" Then
        strPath = Left(strPath, Len(strPath) - 1)
    End If
    
    strTemp = "<!-- 分页开始 -->"
    'strTemp = strTemp & "<div class=""show_page"">"
    If ShowTotal = True Then
        strTemp = "页次：<strong><font color=red>" & CurrentPage & "</font>/" & TotalPage & "</strong>页 共 <b>" & totalnumber & "</b> " & strUnit & "&nbsp;&nbsp;"
    End If
    If CurrentPage = 1 Then
        strTemp = strTemp & "<span  class=""PageBox"">首页</span> <span class=""PageBox"">上一页</span>"
    Else
        If iType_Id > 0 Then
            strTemp = strTemp & "<a href='" & strPath & "/List_" & iType_Id & FileExt & "' title=""首页"" class=""PageBox"">首页</a> "
        Else
            strTemp = strTemp & "<a href='" & strPath & "/index" & FileExt & "' title=""首页"" class=""PageBox"">首页</a> "
        End If
        If CurrentPage = 2 Then
            If iType_Id > 0 Then
                strTemp = strTemp & "<a href='" & strPath & "/List_" & iType_Id & FileExt & "'  title=""上一页"" class=""PageBox"">上一页</a> "
            Else
                strTemp = strTemp & "<a href='" & strPath & "/index" & FileExt & "' title=""上一页"" class=""PageBox"">上一页</a> "
            End If
        Else
            If strUrl <> "" Then
                strTemp = strTemp & "<a href='" & strUrl & "page=" & (CurrentPage - 1) & "'title=""上一页"" class=""PageBox"">上一页</a> "
            Else
                If iType_Id > 0 Then
                    strTemp = strTemp & "<a href='" & strPath & "/List_" & iType_Id & "_" & PrevPage & FileExt & "'  title=""上一页"" class=""PageBox"">上一页</a> "
                Else
                    strTemp = strTemp & "<a href='" & strPath & "/List_" & PrevPage & FileExt & "'  title=""上一页"" class=""PageBox"">上一页</a> "
                End If
            End If
        End If
    End If
    strTemp = strTemp & " <span>"
    If ShowAllPages = True Then
        Dim Jmaxpages
        If (CurrentPage - 4) <= 0 Or TotalPage < 10 Then
            Jmaxpages = 1
            Do While (Jmaxpages < 10)
                If Jmaxpages = CurrentPage Then
                    strTemp = strTemp & "<font color=""FF0000"" class=""PageCss"">" & Jmaxpages & "</font> "
                ElseIf Jmaxpages = 1 Then
                    If iType_Id > 0 Then
                        strTemp = strTemp & "<a href=""" & strPath & "/List_" & iType_Id & FileExt & """>" & Jmaxpages & "</a> "
                    Else
                        strTemp = strTemp & "<a href=""" & strPath & "/" & """>" & Jmaxpages & "</a> "
                    End If
                Else
                    If strUrl <> "" Then
                        strTemp = strTemp & "<a href=""" & strUrl & "page=" & Jmaxpages & """>" & Jmaxpages & "</a> "
                    Else
                        If iType_Id > 0 Then
                            strTemp = strTemp & "<a href=""" & strPath & "/List_" & iType_Id & "_" & TotalPage - Jmaxpages + 1 & FileExt & """>" & Jmaxpages & "</a> "
                        Else
                            strTemp = strTemp & "<a href=""" & strPath & "/List_" & TotalPage - Jmaxpages + 1 & FileExt & """>" & Jmaxpages & "</a> "
                        End If
                    End If
                End If
                If Jmaxpages = TotalPage Then Exit Do
                Jmaxpages = Jmaxpages + 1
            Loop
        ElseIf (CurrentPage + 4) >= TotalPage Then
            Jmaxpages = TotalPage - 8
            Do While (Jmaxpages <= TotalPage)
                If Jmaxpages = CurrentPage Then
                    strTemp = strTemp & "<font color=""FF0000"" class=""PageCss"">" & Jmaxpages & "</font> "
                ElseIf Jmaxpages = 1 Then
                    If iType_Id > 0 Then
                        strTemp = strTemp & "<a href=""" & strPath & "/List_" & iType_Id & FileExt & """>" & Jmaxpages & "</a> "
                    Else
                        strTemp = strTemp & "<a href=""" & strPath & "/" & """>" & Jmaxpages & "</a> "
                    End If
                Else
                    If strUrl <> "" Then
                        strTemp = strTemp & "<a href=""" & strUrl & "page=" & Jmaxpages & """>" & Jmaxpages & "</a> "
                    Else
                        If iType_Id > 0 Then
                            strTemp = strTemp & "<a href=""" & strPath & "/List_" & iType_Id & "_" & TotalPage - Jmaxpages + 1 & FileExt & """>" & Jmaxpages & "</a> "
                        Else
                            strTemp = strTemp & "<a href=""" & strPath & "/List_" & TotalPage - Jmaxpages + 1 & FileExt & """>" & Jmaxpages & "</a> "
                        End If
                    End If
                End If
                Jmaxpages = Jmaxpages + 1
            Loop
        Else
            Jmaxpages = CurrentPage - 4
            Do While (Jmaxpages < CurrentPage + 5)
                If Jmaxpages = CurrentPage Then
                    strTemp = strTemp & "<font color=""FF0000"" class=""PageCss"">" & Jmaxpages & "</font> "
                ElseIf Jmaxpages = 1 Then
                    If iType_Id > 0 Then
                        strTemp = strTemp & "<a href=""" & strPath & "/List_" & iType_Id & FileExt & """>" & Jmaxpages & "</a> "
                    Else
                        strTemp = strTemp & "<a href=""" & strPath & "/" & """>" & Jmaxpages & "</a> "
                    End If
                Else
                    If strUrl <> "" Then
                        strTemp = strTemp & "<a href=""" & strUrl & "page=" & Jmaxpages & """>" & Jmaxpages & "</a> "
                    Else
                        If iType_Id > 0 Then
                            strTemp = strTemp & "<a href=""" & strPath & "/List_" & iType_Id & "_" & TotalPage - Jmaxpages + 1 & FileExt & """>" & Jmaxpages & "</a> "
                        Else
                            strTemp = strTemp & "<a href=""" & strPath & "/List_" & TotalPage - Jmaxpages + 1 & FileExt & """>" & Jmaxpages & "</a> "
                        End If
                    End If
                End If
                Jmaxpages = Jmaxpages + 1
            Loop
        End If
    End If
	strTemp = strTemp & "</span>"
    If CurrentPage >= TotalPage Then
        strTemp = strTemp & "<span  class=""PageBox"">下一页</span> <span class=""PageBox"">下一页</span>"
    Else
        If strUrl <> "" Then
            strTemp = strTemp & "<a href='" & strUrl & "page=" & (CurrentPage + 1) & "'title=""下一页"" class=""PageBox"">下一页</a> "
            strTemp = strTemp & "<a href='" & strUrl & "page=" & TotalPage & "' title=""尾页"" class=""PageBox"">尾页</a>"
        Else
            If iType_Id > 0 Then
                strTemp = strTemp & "<a href='" & strPath & "/List_" & iType_Id & "_" & NextPage & FileExt & "' title=""下一页"" class=""PageBox"">下一页</a> "
                strTemp = strTemp & "<a href='" & strPath & "/List_" & iType_Id & "_" & EndPage & FileExt & "'  title=""尾页"" class=""PageBox"">尾页</a>"
            Else
                strTemp = strTemp & "<a href='" & strPath & "/List_" & NextPage & FileExt & "'title=""下一页"" class=""PageBox"">下一页</a> "
                strTemp = strTemp & "<a href='" & strPath & "/List_" & EndPage & FileExt & "'title=""尾页"" class=""PageBox"">尾页</a>"
            End If
        End If
    End If
    'strTemp = strTemp & "&nbsp;页次：<strong><font color=red>" & CurrentPage & "</font>/" & TotalPage & "</strong>页 "
    strTemp = strTemp & "&nbsp;<b>" & MaxPerPage & "</b>" & strUnit & "/页"
    If ShowAllPages = True Then
        If TotalPage > 10000 Then
            strTemp = strTemp & "&nbsp;&nbsp;转到第<Input type='text' name='page' size='3' maxlength='5' value='" & CurrentPage & "' onKeyPress='gopage(this.value," & TotalPage & ");'>页"
        Else
            strTemp = strTemp & "&nbsp;转到：<select name='page' size='1' onchange=""javascript:window.location=this.options[this.selectedindex].value;"">"
            If iType_Id > 0 Then
                strTemp = strTemp & "<option value='" & strPath & "/List_" & iType_Id & FileExt & "'>第1页</option>"
            Else
                strTemp = strTemp & "<option value='" & strPath & "/index" & FileExt & "'>第1页</option>"
            End If
            For i = 2 To TotalPage
                If strUrl <> "" Then
                   strTemp = strTemp & "<option value='" & strUrl & "page=" & i & "'"
                Else
                    If iType_Id > 0 Then
                        strTemp = strTemp & "<option value='" & strPath & "/List_" & iType_Id & "_" & TotalPage - i + 1 & FileExt & "'"
                    Else
                        strTemp = strTemp & "<option value='" & strPath & "/List_" & TotalPage - i + 1 & FileExt & "'"
                    End If
                End If
                If CurrentPage = i Then strTemp = strTemp & " selected "
                strTemp = strTemp & ">第" & i & "页</option>"
            Next
            strTemp = strTemp & "</select>"
        End If
    End If
    'strTemp = strTemp & "</div>" & vbCrLf
    If ShowAllPages = True And TotalPage > 10 Then
        strTemp = strTemp & "<script language='javascript'>" & vbCrLf
        strTemp = strTemp & "function gopage(page,totalpage){" & vbCrLf
        strTemp = strTemp & "  if (event.keyCode==13){" & vbCrLf
        strTemp = strTemp & "    if(Math.abs(page)>totalpage) page=totalpage;" & vbCrLf
        If iType_Id > 0 Then
            If strUrl <> "" Then
                strTemp = strTemp & "    if(Math.abs(page)>1) window.location='" & strUrl & "page='" & "+Math.abs(page);" & vbCrLf
            Else
                strTemp = strTemp & "    if(Math.abs(page)>1) window.location='" & strPath & "/List_" & iType_Id & "_'" & "+(totalpage-Math.abs(page)+1)+'" & FileExt & "';" & vbCrLf
            End If
            strTemp = strTemp & "    else  window.location='" & strPath & "/List_" & iType_Id & FileExt & "';" & vbCrLf
        Else
            If strUrl <> "" Then
                strTemp = strTemp & "    if(Math.abs(page)>1) window.location='" & strUrl & "page='" & "+Math.abs(page);" & vbCrLf
            Else
                strTemp = strTemp & "    if(Math.abs(page)>1) window.location='" & strPath & "/List_'+(totalpage-Math.abs(page)+1)+'" & FileExt & "';" & vbCrLf
            End If
            strTemp = strTemp & "    else  window.location='" & strPath & "/index" & FileExt & "';" & vbCrLf
        End If
        strTemp = strTemp & "  }" & vbCrLf
        strTemp = strTemp & "}" & vbCrLf
        strTemp = strTemp & "</script>" & vbCrLf
    End If
    'strTemp = strTemp & "<!-- 分页结束 -->"
    ShowPage_Html = strTemp
End Function


'**************************************************
'函数名：ShowPage_AspHtml
'作  用：显示“上一页 下一页”等信息
'参  数：strPath----文件路径
'        sfilename  ----栏目ID
'        TotalNumber ----总数量
'        MaxPerPage  ----每页数量
'        CurrentPage ----当前页
'        ShowTotal   ----是否显示总数量
'        ShowAllPages ---是否用下拉列表显示所有页面以供跳转。
'        strUnit     ----计数单位
'        ShowMaxPerPage  ----是否显示每页信息量选项框
'返回值：“上一页 下一页”等信息的HTML代码
'**************************************************
Function ShowPage_AspHtml(ByVal strPath, sfilename, totalnumber, MaxPerPage, CurrentPage, ShowTotal, ShowAllPages, strUnit, ShowMaxPerPage)
    Dim TotalPage, strTemp, strUrl, i

    If totalnumber = 0 Or MaxPerPage = 0 Or IsNull(MaxPerPage) Then
        ShowPage = ""
        Exit Function
    End If
    If totalnumber Mod MaxPerPage = 0 Then
        TotalPage = totalnumber \ MaxPerPage
    Else
        TotalPage = totalnumber \ MaxPerPage + 1
    End If
    If CurrentPage > TotalPage Then CurrentPage = TotalPage
    'strTemp = "<div class=""show_page"">"
    If ShowTotal = True Then
        strTemp = "页次：<strong><font color=red>" & CurrentPage & "</font>/" & TotalPage & "</strong>页 共 <b>" & totalnumber & "</b> " & strUnit & "&nbsp;&nbsp;"
    End If
    If CurrentPage = 1 Then
        strTemp = strTemp & "<span style=""font-family:webdings;color:#999"" class=""PageBox"">9</span> <span style=""font-family:webdings;color:#999"" class=""PageBox"">7</span>"
    Else
        strTemp = strTemp & "<a href='" & strPath & "List_" & sfilename & "_1.html' title=""首页"" class=""PageBox"">首页</a> "
        strTemp = strTemp & "<a href='" & strPath & "List_" & sfilename & "_" & (CurrentPage - 1) & ".html' title=""上一页"" class=""PageBox"">上一页</a> "
    End If
    strTemp = strTemp & " <span>"
    If ShowAllPages = True Then
        Dim Jmaxpages
        If (CurrentPage - 4) <= 0 Or TotalPage < 10 Then
            Jmaxpages = 1
            Do While (Jmaxpages < 10)
                If Jmaxpages = CurrentPage Then
                    strTemp = strTemp & "<font color=""FF0000"" class=""PageCss"">" & Jmaxpages & "</font> "
                Else
                    strTemp = strTemp & "<a href=""" & strPath & "List_" & sfilename & "_" & Jmaxpages & ".html"">" & Jmaxpages & "</a> "
                End If
                If Jmaxpages = TotalPage Then Exit Do
                Jmaxpages = Jmaxpages + 1
            Loop
        ElseIf (CurrentPage + 4) >= TotalPage Then
            Jmaxpages = TotalPage - 8
            Do While (Jmaxpages <= TotalPage)
                If Jmaxpages = CurrentPage Then
                    strTemp = strTemp & "<font color=""FF0000"" class=""PageCss"">" & Jmaxpages & "</font> "
                Else
                    strTemp = strTemp & "<a href=""" & strPath & "List_" & sfilename & "_" & Jmaxpages & ".html"">" & Jmaxpages & "</a> "
                End If
                Jmaxpages = Jmaxpages + 1
            Loop
        Else
            Jmaxpages = CurrentPage - 4
            Do While (Jmaxpages < CurrentPage + 5)
                If Jmaxpages = CurrentPage Then
                    strTemp = strTemp & "<font color=""FF0000"" class=""PageCss"">" & Jmaxpages & "</font> "
                Else
                    strTemp = strTemp & "<a href=""" & strPath & "List_" & sfilename & "_" & Jmaxpages & ".html"">" & Jmaxpages & "</a> "
                End If
                Jmaxpages = Jmaxpages + 1
            Loop
        End If
    End If
	strTemp = strTemp & "</span>"	
    If CurrentPage >= TotalPage Then
        strTemp = strTemp & "<span style=""font-family:webdings;color:#999"" class=""PageBox"">8</span> <span style=""font-family:webdings;color:#999"" class=""PageBox"">:</span>"
    Else
        strTemp = strTemp & "<a href='" & strPath & "List_" & sfilename & "_" & (CurrentPage + 1) & ".html'  style=""font-family:webdings;"" title=""下一页"" class=""PageBox"">8</a> "
        strTemp = strTemp & "<a href='" & strPath & "List_" & sfilename & "_" & TotalPage & ".html' style=""font-family:webdings;"" title=""尾页"" class=""PageBox"">:</a>"
    End If
    'strTemp = strTemp & "&nbsp;页次：<strong><font color=red>" & CurrentPage & "</font>/" & TotalPage & "</strong>页 "
    If ShowMaxPerPage = True Then
        strTemp = strTemp & "&nbsp;<Input type='text' name='MaxPerPage' size='3' maxlength='4' value='" & MaxPerPage & "' onKeyPress=""if (event.keyCode==13) window.location='" & JoinChar(sfilename) & "page=" & CurrentPage & "&MaxPerPage=" & "'+this.value;"">" & strUnit & "/页"
    Else
        strTemp = strTemp & "&nbsp;" & MaxPerPage & "" & strUnit & "/页"
    End If	
    If ShowAllPages = True Then
            strTemp = strTemp & "&nbsp;&nbsp;转到第<Input type='text' name='page' size='3' maxlength='5' value='" & CurrentPage & "' onKeyPress=""if (event.keyCode==13) window.location='" & strPath & "List_" & sfilename & "_'+this.value+'.html';"">页"
    End If	
    'strTemp = strTemp & "</div>"
    ShowPage_AspHtml = strTemp
End Function

'**************************************************
'函数名：JoinChar
'作  用：向地址中加入 ? 或 &
'参  数：strUrl  ----网址
'返回值：加了 ? 或 & 的网址
'**************************************************
Function JoinChar(ByVal strUrl)
    If strUrl = "" Then
        JoinChar = ""
        Exit Function
    End If
    If InStr(strUrl, "?") < Len(strUrl) Then
        If InStr(strUrl, "?") > 1 Then
            If InStr(strUrl, "&") < Len(strUrl) Then
                JoinChar = strUrl & "&"
            Else
                JoinChar = strUrl
            End If
        Else
            JoinChar = strUrl & "?"
        End If
    Else
        JoinChar = strUrl
    End If
End Function



'**************************************************
'函数名：GetSubStr
'作  用：截字符串，汉字一个算两个字符，英文算一个字符
'参  数：str   ----原字符串
'        strlen ----截取长度
'        bShowPoint ---- 是否显示省略号
'返回值：截取后的字符串
'**************************************************
Function GetSubStr(ByVal str, ByVal strlen, bShowPoint)
    If str = "" Then
        GetSubStr = ""
        Exit Function
    End If
    Dim l, t, c, i, strTemp
    str = Replace(Replace(Replace(Replace(str, "&nbsp;", " "), "&quot;", Chr(34)), "&gt;", ">"), "&lt;", "<")
    l = Len(str)
    t = 0
    strTemp = str
    strlen = PE_CLng(strlen)
    For i = 1 To l
        c = Abs(Asc(Mid(str, i, 1)))
        If c > 255 Then
            t = t + 2
        Else
            t = t + 1
        End If
        If t >= strlen Then
            strTemp = Left(str, i)
            Exit For
        End If
    Next
    strTemp = Replace(Replace(Replace(Replace(strTemp, " ", "&nbsp;"), Chr(34), "&quot;"), ">", "&gt;"), "<", "&lt;")
    If strTemp <> str And bShowPoint = True Then
        strTemp = strTemp & "…"
    End If
    GetSubStr = strTemp
End Function


'将调用的地址编码
Function bytes2BSTR(vIn)
Dim i,strReturn,ThisCharCode,NextCharCode
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function
'获取当前地址路径
Function keyurl()
keyurl="http://" & Request.ServerVariables("HTTP_HOST") & Mid(Request.ServerVariables("URL"),1,InStrRev(Request.ServerVariables("URL"),"/"))
End Function

'评论留言时间限制
Function GetTimeSpan(sessionName)
	dim lastTime : lastTime=session(sessionName)
	if isNul(lastTime) then lastTime=0
	GetTimeSpan=DateDiff("s",lasttime,now())
End Function

Sub SetSessionTime(sessionName,sessionValue)
	session(sessionName)=sessionValue
End Sub
%>