<%
class AppTemplate
    Public html
    Private regEx,where, sql, orderstr, topstr, arr, arrCount, rs, rspage, i, j, k, startnum, num, str, dimlabels
    Private markname, markpar, markval, markdes, markhtml, marktemp, matches1, match1, matches2, match2, matches3, match3
    Public par_type, par_by, par_order, par_parent, par_num, par_table, par_start, par_topic, par_level, par_day, par_state,par_area,par_lang,par_letter,par_tag,par_label,par_maxpage,par_starring,par_similar,par_from,par_year,par_end
    Public page_id, page_name, page_enname, page_addtime, page_size, page_typearr, page_type, page_count, data_count,page_now,page_content
    
    Public Sub Class_initialize()
        num = 0
        startnum = 0
        Set regEx = New RegExp
        regEx.IgnoreCase = True
        regEx.global = True
    End Sub
    
    Public Sub Class_Terminate()
        objdb.C (rspage)
        set page_typearr=nothing
        Set regEx = Nothing
    End Sub
    
    Public Sub freerspage()
    	On Error Resume next
		rspage.close()
		set rspage = Nothing
    End Sub
    
    Public Property Let set_pagetype(ByVal str)
		page_type = str
	End Property
	
    Public Function getIndexLink()
        Select Case app_vodviewtype
        Case 2, 3
            str = "index." & app_vodsuffix
        Case Else
            str = "index.asp"
        End Select
        getIndexLink = app_installdir & str
    End Function
    
    Public Function getArtIndexLink()
        Select Case app_artviewtype
        Case 2, 3
            str = "artindex." & app_artsuffix
        Case Else
            str = "artindex.asp"
        End Select
        getArtIndexLink = app_installdir & str
    End Function
    
    Public Function getMapLink()
        Select Case app_vodviewtype
            Case 2, 3
                str = "map." & app_vodsuffix
            Case Else
                str = "map.asp"
        End Select
        getMapLink = app_installdir &  str
    End Function
    
    Public Function getArtMapLink()
        Select Case app_artviewtype
            Case 2, 3
                str = "artmap." & app_artsuffix
            Case Else
                str = "artmap.asp"
        End Select
        getArtMapLink = app_installdir & str
    End Function
    
    Public Function getArtTypeLink(ByVal id, ByVal name, ByVal enname, ByVal suffix)
        Select Case app_artlistviewtype
        Case 1
            str = "artlist/index.asp?id=" & id
        Case 2
            str = Replace(app_artlistpath, "{id}", id)
            str = Replace(str, "{name}", name)
            str = Replace(str, "{enname}", enname)
            if indexOf(str,"{md5}") then
            	str = Replace(str, "{md5}", md5(id,2))
            end if
            If suffix Then str = str & "." & app_artsuffix : str = Replace(str,"index."&app_artsuffix,"")
        Case 3
            str = Replace(app_artlistpath, "{id}", id)
            If suffix Then str = str & "." & app_artsuffix
        Case Else
            str = "artlist/?" & id
            If suffix Then str = str & "." & app_artsuffix
        End Select
        getArtTypeLink = app_installdir & str
    End Function
    
    Public Function getArtTopicLink(ByVal id, ByVal name, ByVal enname, ByVal suffix)
        Select Case app_arttopicviewtype
        Case 1
            str = "arttopic/index.asp?id=" & id
        Case 2
            str = app_installdir & Replace(app_arttopicpath, "{id}", id)
            str = Replace(str, "{name}", name)
            str = Replace(str, "{enname}", enname)
            if indexOf(str,"{md5}") then
            	str = Replace(str, "{md5}", md5(id,2))
            end if
            If suffix Then str = str & "." & app_artsuffix : str = Replace(str,"index."&app_artsuffix,"")
        Case 3
            str = Replace(app_arttopicpath, "{id}", id)
            If suffix Then str = str & "." & app_artsuffix
        Case Else
            str = "arttopic/?" & id
            If suffix Then str = str & "." & app_artsuffix
        End Select
        getArtTopicLink = app_installdir & str
    End Function
    
    Public Function getArtLink(ByVal id, ByVal name, ByVal enname, byval addtime, ByVal typeid, ByVal typename, ByVal typeenname,byval suffix)
        Select Case app_artcontentviewtype
        Case 1
            str = "art/index.asp?id=" & id
        Case 2
            str = Replace(app_artpath, "{id}", id)
            if indexOf(","&str,"{name}") then str = Replace(str, "{name}", repSpecialChar(name))
            if indexOf(","&str,"{enname}") then str = replaceStr(str, "{enname}", repSpecialChar(enname))
            str = Replace(str, "{typeid}", typeid)
            str = Replace(str, "{typename}", typename)
            str = Replace(str, "{typeenname}", typeenname)
            if indexOf(","&str,"{md5}") then str = Replace(str, "{md5}", md5(id,2))
            if indexOf(","&str,"{year}") then str = Replace(str, "{year}", getDate("yyyy",addtime) )
            if indexOf(","&str,"{month}") then str = Replace(str, "{month}", getDate("mm",addtime) )
            if indexOf(","&str,"{day}") then str = Replace(str, "{day}", getDate("dd",addtime) )
            If suffix Then str = str & "." & app_artsuffix : str = Replace(str,"index."&app_artsuffix,"")
        Case 3
            str = Replace(app_artpath, "{id}", id)
            If suffix Then str = str & "." & app_artsuffix
        Case Else
            str = "art/?" & id
            If suffix Then str = str & "." & app_artsuffix
        End Select
        getArtLink = app_installdir & str
    End Function
	
    Public Function getArtPreNextLink(Byval id,Byval flag)
    	dim rsa,where,str1,str,tarr
    	if flag=0 then str1="上一篇" : where = " and a_id<"&id&" order by a_id desc" else str1="下一篇":where = " and a_id>"&id&" order by a_id asc"
    	set rsa = objdb.db("select top 1 a_id,a_title,a_entitle,a_type,a_addtime from {pre}art where 1=1 and a_hide=0 " & where,"rs1")
    	if rsa.eof then
    		str = "<em>"&str1&":没有了</em> "
    	else
    		tarr = getValueByArray(cachearttype, rsa("a_type"))
    		str = "<em>"&str1&":<a href="&getArtLink(rsa("a_id"),rsa("a_title"),rsa("a_entitle"),rsa("a_addtime"),rsa("a_type"),tarr(1),tarr(2),true)&">"&rsa("a_title")&"</a></em> "
    	end if
    	objdb.c(rsa)
    	getArtPreNextLink = str
    End Function
    
    Public Function getVodTypeLink(ByVal id, ByVal name, ByVal enname, ByVal suffix)
        Select Case app_vodlistviewtype
        Case 1
            str = "vodlist/index.asp?id=" & id
        Case 2
            str = Replace(app_vodlistpath, "{id}", id)
            str = Replace(str, "{name}", name)
            str = Replace(str, "{enname}", enname)
            if indexOf(str,"{md5}") then str = Replace(str, "{md5}", md5(id,2))
            If suffix Then str = str & "." & app_vodsuffix : str = Replace(str,"index."&app_vodsuffix,"")
        Case 3
            str = Replace(app_vodlistpath, "{id}", id)
            If suffix Then str = str & "." & app_vodsuffix
        Case Else
            str = "vodlist/?" & id
            If suffix Then str = str & "." & app_vodsuffix
        End Select
        getVodTypeLink = app_installdir & str
    End Function
    
    Public Function getVodTypeLinkOrder(ByVal id, ByVal name, ByVal enname, ByVal suffix, ByVal order, ByVal by)
        str = getVodTypeLink(id, name, enname, False)
        If isN(order) Then order = "desc"
        If isN(by) Then order = "time"
        Select Case app_vodlistviewtype
        Case 1
            str = "vodlist/index.asp?id=" & id & "&order=" & order & "&by=" & by
        Case 3
            str = Replace(app_vodlistpath, "{id}", id)
            If suffix Then str = str & "-1" & "-" & order & "-" & by & "." & app_vodsuffix
        Case Else
            str = "vodlist/?" & id
            If suffix Then str = str & "-1" & "-" & order & "-" & by & "." & app_vodsuffix
        End Select
        getVodTypeLinkOrder = str
    End Function
    
    Public Function getVodTopicLink(ByVal id, ByVal name, ByVal enname, ByVal suffix)
        Select Case app_vodtopicviewtype
        Case 1
            str = "vodtopic/index.asp?id=" & id
        Case 2
            str = Replace(app_vodtopicpath, "{id}", id)
            str = Replace(str, "{name}", name)
            str = Replace(str, "{enname}", enname)
            if indexOf(str,"{md5}") then str = Replace(str, "{md5}", md5(id,2))
            If suffix Then str = str & "." & app_vodsuffix : str = Replace(str,"index."&app_vodsuffix,"")
        Case 3
            str = Replace(app_vodtopicpath, "{id}", id)
            If suffix Then str = str & "." & app_vodsuffix
        Case Else
            str = "vodtopic/?" & id
            If suffix Then str = str & "." & app_vodsuffix
        End Select
        getVodTopicLink = app_installdir & str
    End Function
    
    Public Function getVodLink(ByVal id, ByVal name, ByVal enname, byval addtime,ByVal typeid, ByVal typename, ByVal typeenname)
    	if app_playtype = 1 then getVodLink = getVodPlayUrl(id,name,enname,addtime,typeid,typename,typeenname,1,1) : exit function
        Select Case app_vodcontentviewtype
        Case 1
            str = "vod/index.asp?id=" & id
        Case 2
            str = Replace(app_vodpath, "{id}", id)
            if indexOf(","&str,"{name}") then str = Replace(str, "{name}", repSpecialChar(name))
            if indexOf(","&str,"{enname}") then str = Replace(str, "{enname}", repSpecialChar(enname))
            str = Replace(str, "{typeid}", typeid)
            str = Replace(str, "{typename}", typename)
            str = Replace(str, "{typeenname}", typeenname)
            if indexOf(","&str,"{md5}") then str = Replace(str, "{md5}", md5(id,2))
            if indexOf(","&str,"{year}") then str = Replace(str, "{year}", getDate("yyyy",addtime) )
            if indexOf(","&str,"{month}") then str = Replace(str, "{month}", getDate("mm",addtime) )
            if indexOf(","&str,"{day}") then str = Replace(str, "{day}", getDate("dd",addtime) )
            str = str & "." & app_vodsuffix : str = Replace(str,"index."&app_vodsuffix,"")
        Case 3
        	str = Replace(app_vodpath, "{id}", id) & "." & app_vodsuffix
        Case Else
            str = "vod/?" & id & "." & app_vodsuffix
        End Select
        getVodLink = app_installdir & str
    End Function
    
    Public Function getVodPreNextLink(Byval id,Byval flag)
    	dim rsa,where,str1,str,tarr
    	if flag=0 then str1="上一篇" : where = " and d_id<"&id&" order by d_id desc" else str1="下一篇":where = " and d_id>"&id&" order by d_id asc"
    	set rsa = objdb.db("select top 1 d_id,d_name,d_enname,d_type,d_addtime from {pre}vod where 1=1 and d_hide=0 " & where,"rs1")
    	if rsa.eof then
    		str = "<em>"&str1&":没有了</em> "
    	else
    		tarr = getValueByArray(cachevodtype, rsa("d_type"))
    		str = "<em>"&str1&":<a href="&getVodLink(rsa("d_id"),rsa("d_name"),rsa("d_enname"),rsa("d_addtime"),rsa("d_type"),tarr(1),tarr(2))&">"&rsa("d_name")&"</a></em> "
    	end if
    	objdb.c(rsa)
    	getVodPreNextLink = str
    End Function
    
    Public Function getVodPlayUrl(ByVal id, ByVal name, ByVal enname, byval addtime, ByVal typeid, ByVal typename, ByVal typeenname, ByVal sort, ByVal num)
        Dim strJSstart, strJSend
        If app_playisopen = 0 Then strJSstart = "": strJSend = "" Else strJSstart = "javascript:OpenWindow1('": strJSend = "',popenW,popenH);"
        
        Select Case app_vodplayviewtype
        Case 1
            str = "vodplay/index.asp?id=" & id & "&sort=" & sort & "&num=" & num
        Case 2
            str = Replace(app_vodplaypath, "{id}", id) & "-" & sort & "-" & num & "." & app_vodsuffix
        Case 3,4,5,6
            str = Replace(app_vodplaypath, "{id}", id)
            if indexOf(","&str,"{name}") then str = Replace(str, "{name}", repSpecialChar(name))
            if indexOf(","&str,"{enname}") then str = Replace(str, "{enname}", repSpecialChar(enname))
            str = Replace(str, "{typeid}", typeid)
            str = Replace(str, "{typename}", typename)
            str = Replace(str, "{typeenname}", typeenname)
            if indexOf(","&str,"{md5}") then str = Replace(str, "{md5}", md5(id,2))
            if indexOf(","&str,"{year}") then str = Replace(str, "{year}", getDate("yyyy",addtime) )
            if indexOf(","&str,"{month}") then str = Replace(str, "{month}", getDate("mm",addtime) )
            if indexOf(","&str,"{day}") then str = Replace(str, "{day}", getDate("dd",addtime) )
            
            If app_vodplayviewtype = 4 Then
                str = str & "-" & sort & "-" & num & "." & app_vodsuffix
            elseif app_vodplayviewtype = 5 then
            	str = str & "-" & sort & "-1." & app_vodsuffix & "?" & id & "-" & sort & "-" & num
            elseif app_vodplayviewtype = 6 then
            	str = "play."  & app_vodsuffix & "?" & id & "-" & sort & "-" & num
            Else
                str = str & "." & app_vodsuffix & "?" & id & "-" & sort & "-" & num
            End If
            str = Replace(str,"index."&app_vodsuffix,"")
        Case Else
            str = "vodplay/?" & id & "-" & sort & "-" & num & "." & app_vodsuffix
        End Select
        getVodPlayUrl = strJSstart & app_installdir & str & strJSend
    End Function
    
    Public Function getVodDownUrl(ByVal id, ByVal name, ByVal enname, byval addtime, ByVal typeid, ByVal typename, ByVal typeenname, ByVal sort, ByVal num)
        
        Select Case app_voddownviewtype
        Case 1
            str = "voddown/index.asp?id=" & id & "&sort=" & sort & "&num=" & num
        Case 2
            str = Replace(app_voddownpath, "{id}", id) & "-" & sort & "-" & num & "." & app_vodsuffix
        Case 3,4,5,6
            str = Replace(app_voddownpath, "{id}", id)
            if indexOf(","&str,"{name}") then str = Replace(str, "{name}", repSpecialChar(name))
            if indexOf(","&str,"{enname}") then str = Replace(str, "{enname}", repSpecialChar(enname))
            str = Replace(str, "{typeid}", typeid)
            str = Replace(str, "{typename}", typename)
            str = Replace(str, "{typeenname}", typeenname)
            if indexOf(","&str,"{md5}") then str = Replace(str, "{md5}", md5(id,2))
            if indexOf(","&str,"{year}") then str = Replace(str, "{year}", getDate("yyyy",addtime) )
            if indexOf(","&str,"{month}") then str = Replace(str, "{month}", getDate("mm",addtime) )
            if indexOf(","&str,"{day}") then str = Replace(str, "{day}", getDate("dd",addtime) )
            
            If app_voddownviewtype = 4 Then
                str = str & "-" & sort & "-" & num & "." & app_vodsuffix
            elseif app_voddownviewtype = 5 then
            	str = str & "-" & sort & "-1." & app_vodsuffix & "?" & id & "-" & sort & "-" & num
            elseif app_voddownviewtype = 6 then
            	str = "down."  & app_vodsuffix & "?" & id & "-" & sort & "-" & num
            Else
                str = str & "." & app_vodsuffix & "?" & id & "-" & sort & "-" & num
            End If
            str = Replace(str,"index."&app_vodsuffix,"")
        Case Else
            str = "voddown/?" & id & "-" & sort & "-" & num & "." & app_vodsuffix
        End Select
        getVodDownUrl = app_installdir & str
    End Function
    
    Public Function getTopicIndexLink(ByVal flag, ByVal suffix)
        Dim viewtype, htmlsuffix
        If flag = "art" Then
            viewtype = app_arttopicviewtype: htmlsuffix = app_artsuffix
        Else
            viewtype = app_vodtopicviewtype: htmlsuffix = app_vodsuffix
        End If
        
        Select Case viewtype
        Case 1
            str = "topicindex/index.asp"
        Case 2
            str = "topicindex/index"
            If suffix Then str = str & "." & htmlsuffix
        Case 3
            str = "topicindex/index"
            If suffix Then str = str & "." & htmlsuffix
        Case Else
            str = "topicindex/index.asp" 
        End Select
        getTopicIndexLink = app_installdir & flag & str
    End Function
    
    Public Function getTopicPageSuffix(ByVal flag, ByVal pagenum)
        Dim viewtype, htmlsuffix
        If flag = "art" Then
            viewtype = app_arttopicviewtype: htmlsuffix = app_artsuffix
        Else
            viewtype = app_vodtopicviewtype: htmlsuffix = app_vodsuffix
        End If
        Select Case viewtype
            Case 0
                str = "?" & pagenum
                If listorder = True Then str = str & "-" & order & "-" & by
                str = str & "." & htmlsuffix
            Case 1
                str = "&page=" & pagenum
                If listorder = True Then str = str & "order=" & order & "&by=" & by
            Case Else
                If pagenum > 1 Then str = "-" & pagenum Else str = ""
                str = str & "." & htmlsuffix
        End Select
        getTopicPageSuffix = str
    End Function
    
    Public Function getTypePageSuffix(ByVal flag,ByVal viewtype, ByVal pagenum)
        Dim htmlsuffix
        If flag = "art" Then
            htmlsuffix = app_artsuffix
        Else
            htmlsuffix = app_vodsuffix
        End If
        
        Select Case viewtype
            Case 0,3
                str = "-" & pagenum
                If listorder = True Then str = str & "-" & searcharea & "-" & searchyear & "-" & order & "-" & by
                str = str & "." & htmlsuffix
            Case 1
                str = "&page=" & pagenum
                If listorder = True Then str = str & "area="& searcharea & "&year=" & searchyear & "&order=" & order & "&by=" & by
            Case Else
                If pagenum > 1 Then str = "-" & pagenum Else str = ""
                str = str & "." & htmlsuffix
        End Select
        getTypePageSuffix = str
    End Function
    
    Public Function getPageSuffix(ByVal flag,ByVal viewtype, ByVal pagenum)
        Dim htmlsuffix
        If flag = "art" Then
            htmlsuffix = app_artsuffix
        Else
            htmlsuffix = app_vodsuffix
        End If
        
        Select Case viewtype
            Case 0,3
                str = "-" & pagenum
                If listorder = True Then str = str & "-" & order & "-" & by
                str = str & "." & htmlsuffix
            Case 1
                str = "&page=" & pagenum
                If listorder = True Then str = str & "order=" & order & "&by=" & by
            Case Else
                If pagenum > 1 Then str = "-" & pagenum Else str = ""
                str = str & "." & htmlsuffix
        End Select
        getPageSuffix = str
    End Function
    
    Public Function getPageLink(ByVal pagenum)
        Dim vodsuffix, artsuffix, fname , suffix, arr
        Select Case page_type
            Case "vodtype":
                getPageLink = getVodTypeLink(page_id, page_name, page_enname, False) & getTypePageSuffix("vod",app_vodlistviewtype, pagenum)
            Case "vodtopic":
                getPageLink = getVodTopicLink(page_id, page_name, page_enname, False) & getPageSuffix("vod",app_vodtopicviewtype, pagenum)
            Case "arttype":
                getPageLink = getArtTypeLink(page_id, page_name, page_enname, False) & getPageSuffix("art",app_artlistviewtype, pagenum)
            Case "arttopic":
                getPageLink = getArtTopicLink(page_id, page_name, page_enname, False) & getPageSuffix("art",app_arttopicviewtype, pagenum)
            Case "vodtopicindex":
                getPageLink = getTopicIndexLink("vod", False) & getTopicPageSuffix("vod", pagenum)
            Case "arttopicindex":
                getPageLink = getTopicIndexLink("art", False) & getTopicPageSuffix("art", pagenum)
            Case "vodsearch":
                getPageLink = app_installdir & "search.asp?page=" & pagenum & "&searchtype=" & searchflag & "&keyword=" & Server.UrlEncode(searchkeyword) & "&ids=" & searchids & "&pinyin=" & searchpinyin & "&starring=" & Server.UrlEncode(searchstarring) & "&directed=" & Server.UrlEncode(searchdirected) & "&area=" & Server.UrlEncode(searcharea) & "&language=" & Server.UrlEncode(searchlanguage) & "&year=" & searchyear & "&letter="& searchletter & "&type="& searchtype & "&order=" & order & "&by=" & by
            Case "artsearch":
                getPageLink = app_installdir & "search.asp?page=" & pagenum & "&searchtype=" & searchflag & "&keyword=" & Server.UrlEncode(searchkeyword) & "&ids=" & searchids &  "&letter="& searchletter & "&type="& searchtype & "&order=" & order & "&by=" & by
            Case "label":
            	if par_label <> "" then
	            	arr = split(par_label,".")
	            	if ubound(arr) >1 then fname=arr(0): suffix = arr(1) else fname=arr(0) : suffix="html"
	            	set arr=nothing
	            	if pagenum > 1 then suffix = pagenum & "." & suffix else suffix = "." & suffix
	            	getPageLink = app_installdir & replaceStr(fname,"$$","/") & suffix
	            end if
            Case "art":
            	getPageLink = getArtLink(page_id, page_name, page_enname,page_addtime,page_typearr(0),page_typearr(1),page_typearr(2),False) & getPageSuffix("art",app_artcontentviewtype, pagenum)
            Case Else
                getPageLink = "?page=" & pagenum
        End Select
        set arr=nothing
    End Function
    
    Public Function getPageListSizeByCache(strtype,flag)
        Dim Match, Matches, tempSize, appName
        appName = strtype & "_" & page_id & "_pagelistsize"
        If chkCache(flag &appName) Then
            tempSize = getCache(flag &appName)
        Else
            regEx.pattern = "\{maccms:" & strtype & "list[\s\S]+?num=([\d]+)[\s\S]*\}"
            Set Matches = regEx.Execute(html)
            For Each Match In Matches
                tempSize = Match.SubMatches(0)
                Exit For
            Next
            If isN(tempSize) Then tempSize = 10
            setCache flag&appName,tempSize
            Set Matches = Nothing
        End If
        getPageListSizeByCache = tempSize
    End Function
    
    Public Function getMark(ByVal str, ByVal pattern)
        regEx.pattern = pattern
        Set getMark = regEx.Execute(str)
    End Function
    
    Public Sub getParam(ByVal regx)
        Dim parname, parval
        par_type = "": par_by = "": par_order = "": par_parent = "": par_num = "": par_table = "": par_start = "": par_topic = "": par_level = "": par_day = ""
        startnum = "": sql = "": where = "": topstr = "": orderstr = "": par_state = "":  par_area ="" : par_lang ="" : par_letter="" : par_tag="" : par_label="" : par_from="" : par_year="" : par_end=""
        par_maxpage = "" : par_starring=""
        num = 0: i = 0
        For Each match3 In regx
            parname = Trim(match3.SubMatches(0))
            parval = Trim(match3.SubMatches(1))
            Select Case parname
                Case "type": par_type = parval
                Case "by": par_by = parval
                Case "order": par_order = parval
                Case "parent": par_parent = parval
                Case "num": par_num = parval
                Case "table": par_table = parval
                Case "start": par_start = parval
                Case "topic": par_topic = parval
                Case "level": par_level = parval
                Case "day": par_day = parval
                Case "state" : par_state = parval
                Case "area" : par_area = parval
                Case "lang" : par_lang = parval
                Case "letter" : par_letter = parval
                Case "tag" : par_tag = parval
                Case "label" : par_label = parval
                Case "maxpage" : par_maxpage = parval
                Case "starring" : par_starring = parval
                Case "from" : par_from = parval
                Case "year" : par_year = parval
                Case "end" : par_end = parval
            End Select
        Next
        
        Select Case par_order
            Case "desc":   par_order = "desc"
            Case Else: par_order = "asc"
        End Select
        If isN(par_table) Then par_table = "vod"
        If isN(par_type) Then par_type = "all"
        
        Set match3 = Nothing
        Set regx = Nothing
    End Sub
    
    Public Function cut(str, start_num, over_num)
        cut = Mid(str, start_num, over_num - start_num)
    End Function
    
    Public Sub run()
        If curviewtype < 2 Then
            html = Replace(html, "{maccms:runtime}", "页面执行时间: " & FormatNumber((Timer() - appTime), 8, -1) & "秒 &nbsp;" & objdb.iquerycount & "次数据查询")
        Else
            html = Replace(html, "{maccms:runtime}", "")
        End If
    End Sub
    
    Public Sub base()
        html = Replace(html, "{maccms:url}", app_siteurl)
        html = Replace(html, "{maccms:path}", app_installdir)
        html = Replace(html, "{maccms:templatepath}", app_installdir & "template/" & app_templatedir & "/")
        html = Replace(html, "{maccms:name}", app_sitename)
        html = Replace(html, "{maccms:keywords}", app_keywords)
        html = Replace(html, "{maccms:description}", app_description)
        html = Replace(html, "{maccms:icp}", app_icp)
        html = Replace(html, "{maccms:qq}", app_qq)
        html = Replace(html, "{maccms:email}", app_email)
        
        html = Replace(html, "{maccms:appid}", appid)
        html = Replace(html, "{maccms:curvodtypeid}", curvodtypeid)
        html = Replace(html, "{maccms:curvodtypepid}", curvodtypepid)
        html = Replace(html, "{maccms:curvodtopicid}", curvodtopicid)
        html = Replace(html, "{maccms:curarttypeid}", curarttypeid)
        html = Replace(html, "{maccms:curarttypepid}", curarttypepid)
        html = Replace(html, "{maccms:curarttopicid}", curarttopicid)
        html = Replace(html, "{maccms:userid}", session("userid"))
        html = Replace(html, "{maccms:username}", session("username"))
        html = Replace(html, "{maccms:usergroupid}", session("usergroup"))
        
        html = Replace(html, "{maccms:username}", session("username"))
        html = Replace(html, "{maccms:desktop}", "<a href=""javascript:void(0)"" onclick=""desktop('');return false;""/>保存到桌面</a>")
        
        html = Replace(html, "{maccms:gbooklink}", app_installdir & "gbook.asp")
        html = Replace(html, "{maccms:searchlink}", app_installdir & "search.asp")
        html = Replace(html, "{maccms:userlink}", app_installdir & "user/login.asp")
        
        html = Replace(html, "{maccms:indexlink}", getIndexLink())
        html = Replace(html, "{maccms:artindexlink}", getArtIndexLink())
        html = Replace(html, "{maccms:vodmaplink}", getMapLink())
        html = Replace(html, "{maccms:artmaplink}", getArtMapLink())
        html = Replace(html, "{maccms:vodtopiclink}", getTopicIndexLink("vod", True))
        html = Replace(html, "{maccms:arttopiclink}", getTopicIndexLink("art", True))
        html = Replace(html, "{maccms:visits}", "<script src=""" & app_installdir & "js/tj.js""></script>")
        
        If indexOf(html, "{maccms:vodallcount}") Then html = replaceStr(html, "{maccms:vodallcount}", getVodCount("all"))
        If indexOf(html, "{maccms:voddaycount}") Then html = replaceStr(html, "{maccms:voddaycount}", getVodCount("day"))
        If indexOf(html, "{maccms:artallcount}") Then html = replaceStr(html, "{maccms:artallcount}", getArtCount("all"))
        If indexOf(html, "{maccms:artdaycount}") Then html = replaceStr(html, "{maccms:artdaycount}", getArtCount("day"))
        If indexOf(html, "{maccms:usercount}") Then html = replaceStr(html, "{maccms:usercount}", getUserCount("all"))
        If indexOf(html, "{maccms:userdaycount}") Then html = replaceStr(html, "{maccms:userdaycount}", getUserCount("day"))
    End Sub
    
    Public Sub headfoot()
        html = Replace(html, "{maccms:head}", getFileByCache("template_head", app_installdir & "template/" & app_templatedir & "/" & app_htmldir & "/head.html"))
        html = Replace(html, "{maccms:foot}", getFileByCache("template_foot", app_installdir & "template/" & app_templatedir & "/" & app_htmldir & "/foot.html"))
    End Sub
    
    Public Sub mark()
        headfoot
        labels
        base
        typematrix
        
        Set matches1 = getMark(html, "{maccms:([\S]+)\s+(.*?)}([\s\S]+?){/maccms:\1}")
        For Each match1 In matches1
            markname = Trim(match1.SubMatches(0))
            markpar = Trim(match1.SubMatches(1))
            markdes = Trim(match1.SubMatches(2))
            markval = match1.Value
            markhtml = ""
            Set matches2 = getMark(markpar, "([a-z0-9]+)=([\u4E00-\u9FFF|a-zA-Z0-9|,]+)")
            getParam matches2
            Select Case markname
                Case "menulist": menulist
                Case "artlist": artlist
                Case "vodlist": vodlist
                Case "topiclist": topiclist
                Case "linklist": linklist
                Case "arealist": arealist
                Case "languagelist": languagelist
                Case "yearlist" : yearlist
            End Select
        Next
        
        Set match1 = Nothing
        Set matches1 = Nothing
    End Sub
    
    Public Sub ifEx()
        If Not indexOf(html, "{if:") Then Exit Sub
        Dim strTemp1, strTemp2, strTemp5, strTemp6, strTemp7, strTemp8, strTemp9, strTemp10, strTemp11, stat, strLen, strLen1, strRule1, strRule2, strRule3, tempArr
        Dim strTemp3, strTemp4
        
        strRule1 = "{if:([\s\S]+?)}([\s\S]*?){end\s+if}"
        strRule2 = "{elseif"
        strRule3 = "{else}"
        regEx.pattern = strRule1
        Set matches1 = regEx.Execute(html)
        For Each match1 In matches1
            stat = False
            strTemp1 = match1.SubMatches(0)
            strTemp2 = match1.SubMatches(1)
            
            If InStr(strTemp2, strRule2) > 0 Then
                On Error Resume Next
                strTemp3 = Split(strTemp2, strRule2)
                strLen = UBound(strTemp3)
                strTemp4 = Split(strTemp3(strLen), strRule3)
                strTemp5 = strTemp4(1)
                
                If Eval(strTemp1) Then
                    strTemp5 = strTemp3(0): stat = True
                End If
                
                If stat = False Then
                    For strLen1 = 1 To strLen - 1
                        strTemp8 = InStr(strTemp3(strLen1), ":") + Len(":"): strTemp9 = InStr(strTemp8, strTemp3(strLen1), "}")
                        strTemp10 = InStr(strTemp3(strLen1), "}") + Len("}"): strTemp11 = Len(strTemp3(strLen1)) + 1
                        strTemp6 = cut(strTemp3(strLen1), strTemp8, strTemp9)
                        strTemp7 = cut(strTemp3(strLen1), strTemp10, strTemp11)
                        
                        If Eval(strTemp6) Then
                            strTemp5 = strTemp7: stat = True
                        End If
                        If stat Then Exit For
                    Next
                End If
                
                If Err Then
                    html = replaceStr(html, match1.Value, Err.Description): Err.Clear
                Else
                    If stat = False Then
                        strTemp8 = InStr(strTemp4(0), ":") + Len(":"): strTemp9 = InStr(strTemp8, strTemp4(0), "}")
                        strTemp10 = InStr(strTemp4(0), "}") + Len("}"): strTemp11 = Len(strTemp4(0)) + 1
                        If Eval(cut(strTemp4(0), strTemp8, strTemp9)) Then
                            strTemp5 = cut(strTemp4(0), strTemp10, strTemp11)
                        End If
                    End If
                    html = replaceStr(html, match1.Value, strTemp5)
                End If
                Err.Clear
                
            Else
                If 1 = -1 Then stat = True Else stat = False
                If InStr(strTemp2, strRule3) > 0 Then
                    strTemp3 = Split(strTemp2, "{else}")(0)
                    strTemp4 = Split(strTemp2, "{else}")(1)
                    On Error Resume Next
                    
                    If Eval(strTemp1) Then
                        stat = True
                    Else
                        stat = False
                    End If
                    If Err Then
                        html = replaceStr(html, match1.Value, "if标签出错"): Err.Clear
                    Else
                        If stat Then html = replaceStr(html, match1.Value, strTemp3) Else html = replaceStr(html, match1.Value, strTemp4)
                    End If
                    Err.Clear
                Else
                    On Error Resume Next
                    
                    If Eval(strTemp1) Then
                        stat = True
                    Else
                        stat = False
                    End If
                    If Err Then
                        html = replaceStr(html, match1.Value, "if标签出错"): Err.Clear
                    Else
                        If stat Then html = replaceStr(html, match1.Value, strTemp2) Else html = replaceStr(html, match1.Value, "")
                    End If
                    Err.Clear
                End If
            End If
        Next
        set strTemp1=nothing
        set strTemp2=nothing
        set strTemp3=nothing
        set strTemp4=nothing
        Set match1 = Nothing
        Set matches1 = Nothing
    End Sub
	
	
    Public Sub labels()
    	dim labelhtml
        Set matches1 = getMark(html, "{label:([\s\S]*?)}")
        For Each match1 In matches1
            markpar = Trim(match1.SubMatches(0))	
            labelhtml = getFileByCache("label_"&markpar, app_installdir & "template/" & app_templatedir & "/" & app_htmldir & "/label_" & markpar)
            html = Replace(html, match1.Value, labelhtml)
        Next
        Set match1 = Nothing
        Set matches1 = Nothing
    End Sub
    
    Public Sub typematrix()
        Set matches1 = getMark(html, "{maccms:typematrix([\s\S]*?)}([\s\S]*?){/maccms:typematrix}")
        For Each match1 In matches1
            markpar = Trim(match1.SubMatches(0))
            markdes = Trim(match1.SubMatches(1))
            markval = match1.Value
            markhtml = ""
            Set matches2 = getMark(markpar, "([a-z0-9]+)=([\u4E00-\u9FFF|a-z0-9|,]+)")
            getParam matches2
            markhtml=""
            
            if par_type="letter" then
            	if isN(par_letter) OR par_letter="all" then par_letter = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"
            	matches2 = split(par_letter,",")
            	for i=0 to ubound(matches2)
            		if matches2(i)<>"" then
            			marktemp = markdes
            			marktemp = replaceStr(marktemp,"[typematrix:num]",i+1)
						marktemp = replaceStr(marktemp,"[typematrix:name]",matches2(i))
						marktemp = replaceStr(marktemp,"[typematrix:link]", app_installdir&"search.asp?letter="& matches2(i) )
						markhtml = markhtml & marktemp
            		end if
            	next
            elseif par_type="tag" then
            	if not isN(par_tag) then
	            	matches2 = split(par_tag,",")
	            	for i=0 to ubound(matches2)
	            		if matches2(i)<>"" then
	            			marktemp = markdes
	            			marktemp = replaceStr(marktemp,"[typematrix:num]",i+1)
							marktemp = replaceStr(marktemp,"[typematrix:name]",matches2(i))
							marktemp = replaceStr(marktemp,"[typematrix:link]", app_installdir&"search.asp?keyword="& Server.UrlEncode( matches2(i))  )
							markhtml = markhtml & marktemp
	            		end if
	            	next
            	end if
            else
	            sql = "SELECT " & topstr & " t_id,t_pid,t_name,t_enname,t_key,t_des FROM {pre}" & par_table & "_type WHERE t_hide=0 "
				where=""
	            if par_type = "all" then
		        elseif par_type= "parent" then
		        	where = where & " AND t_pid =0 "
		        elseif par_type= "child" then
		        	where = where & " AND t_pid >0 "
		        elseif Not isN(par_type) Then 
		        	where = where & " AND t_id IN(" & par_type & ") "
		        end if
		        
		        if par_parent="all" then
	        		where = where & " AND t_pid =0 "
		        elseIf Not isN(par_parent) Then
		        	where = where & " AND t_pid IN(" & par_parent & ") "
		        end if
		        
		        if par_table="vod" and app_user=1 then
					where = where & getTypeByPopedomFilter("menu")
				end if
				
	            Select Case par_by
	                Case "id": orderstr = " ORDER BY t_id " & par_order
	                Case Else: orderstr = " ORDER BY t_sort " & par_order
	            End Select
	            
	            On Error Resume Next
	                Set rs = objdb.DB(sql & where & orderstr, "rs1")
	                If Err Then
	                    html = Replace(html, markval, "typematrix标签出错:" & Err.Description)
	                    Err.Clear: Exit Sub
	                End If
	            On Error GoTo 0
	            
	            Set matches2 = getMark(markdes, "\[typematrix:\s*([0-9a-zA-Z]+)([\s]*[len|style]*)[=]??([\da-zA-Z\-\\\/\:\s]*)\]")
	            Do While Not rs.EOF
	                num = num + 1
	                marktemp = markdes
	                For Each match2 In matches2
	                    marktemp = parse("type", marktemp, match2, rs, num)
	                Next
	                markhtml = markhtml & marktemp
	                rs.movenext
	            Loop
	            objdb.c(rs)
	        end if
            html = Replace(html, markval, markhtml)
        Next
        
        Set match2 = Nothing
        Set matches2 = Nothing
        Set match1 = Nothing
        Set matches1 = Nothing
    End Sub
    
    Public Sub menulist()
        If isN(par_start) Then par_start = 0 Else par_start = CInt(par_start)
        If Not isNum(par_num) Then topstr = "": startnum = par_start Else par_num = CInt(par_num): startnum = par_start: topstr = " top " & par_num + startnum
        
        sql = "SELECT " & topstr & " t_id,t_pid,t_name,t_enname,t_key,t_des FROM {pre}" & par_table & "_type WHERE t_hide=0 "
        
        
        if par_type = "all" then
        	
        elseif par_type= "parent" then
        	where = where & " AND t_pid =0 "
        elseif par_type= "child" then
        	where = where & " AND t_pid >0 "
        elseif par_type= "auto" then
        	if curvodtypeid = -1 then
        		where = where & " AND t_pid =0 "
        	elseif curvodtypepid =0 then
        		where = where & " AND t_pid = " & curvodtypeid
        	elseif curvodtypepid >0 then
        		where = where & " AND t_pid = " & curvodtypepid
        	end if
        elseif Not isN(par_type) Then 
        	where = where & " AND t_id IN(" & par_type & ") "
        else
        end if
        
        if par_parent="all" then
        	where = where & " AND t_pid =0 "
        elseIf Not isN(par_parent) Then
        	where = where & " AND t_pid IN(" & par_parent & ") "
        end if
        
        if par_table="vod" and app_user=1 then
			where = where & getTypeByPopedomFilter("menu")
		end if
        
        Select Case par_by
            Case "id": orderstr = " ORDER BY t_id " & par_order
            Case Else: orderstr = " ORDER BY t_sort " & par_order
        End Select
        On Error Resume Next
            Set rs = objdb.DB(sql & where & orderstr, "rs1")
            If Err Then
                html = Replace(html, markval, "menulist标签出错:" & Err.Description)
                Err.Clear: Exit Sub
            End If
        On Error GoTo 0
        Set matches2 = getMark(markdes, "\[menulist:\s*([0-9a-zA-Z]+)([\s]*[len|style]*)[=]??([\da-zA-Z\-\\\/\:\s]*)\]")
        
        Do While Not rs.EOF
            i = i + 1
            If i >= CInt(startnum) Then
                num = num + 1
                marktemp = markdes
                For Each match2 In matches2
                    marktemp = parse("type", marktemp, match2, rs, num)
                Next
                markhtml = markhtml & marktemp
                If num >= par_num Then Exit Do
            End If
            rs.movenext
        Loop
        html = Replace(html, markval, markhtml)
        objdb.C (rs)
        Set match2 = Nothing
        Set matches2 = Nothing
    End Sub
    
    Public Sub artlist()
        Dim typearr
        If isN(par_start) Then par_start = 0 Else par_start = CInt(par_start)
        If Not isNum(par_num) Then par_num = 12 Else par_num = CInt(par_num)
        startnum = par_start: topstr = " top " & par_num + startnum
        
        sql = "SELECT " & topstr & " a_id,a_title,a_subtitle,a_entitle,a_from,a_type,a_pic,a_content,a_author,a_color,a_hits,a_dayhits,a_weekhits,a_monthhits,a_addtime,a_time,a_level FROM {pre}art WHERE a_hide=0 "
        
        If Not isN(par_level) Then
            If par_level <> "all" Then
                where = where & " and a_level in(" & par_level & ")"
            Else
                where = where & " and a_level >0"
            End If
        End If
        
        where = where & " AND a_type>0 "
        if not isN(par_type) then
	        If par_type <> "all" Then
	            If par_type = "current" And curarttypeid > -1 Then
	                typearr = getValueByArray(cachearttype, curarttypeid)
	                where = where & " and a_type in (" & typearr(10) & ")"
	            Else
	            	if instr(par_type,",")>0 then
	                	where = where & " and a_type in (" & par_type& ")"
	                else
	                	typearr = getValueByArray(cachearttype, cint(par_type))
	                	if isarray(typearr) then
	                		where = where & " and a_type in (" & typearr(10) & ")"
	                	end if
	                end if
	            End If
	        End If
        end if
        
        if not isN(par_topic) then
	        If par_topic <> "all" Then
	            If par_topic = "current" And curarttopicid > -1 Then
	                where = where & " and a_topic in (" & curarttopicid & ")"
	            Else
	                where = where & " and a_topic in (" & par_topic & ")"
	            End If
	        End If
        end if
        
        if isNum(par_day) then
			if app_dbtype = "access" then
				where = where & " and DateDiff('d',a_time,#"&now()&"#)<="&par_day
			else
				where = where & " and DateDiff(day,a_time,getdate())<="&par_day
			end if
		end if
		Randomize
		Dim intRandomNumber: intRandomNumber = Int(1000 * Rnd) + 1
        Select Case par_by
            Case "id": orderstr = " ORDER BY a_id " & par_order
            Case "level": orderstr = " ORDER BY a_level " & par_order
            Case "hits": orderstr = " ORDER BY a_hits " & par_order
            Case "dayhits": orderstr = " ORDER BY a_dayhits " & par_order
            Case "weekhits": orderstr = " ORDER BY a_weekhits " & par_order
            Case "monthhits": orderstr = " ORDER BY a_monthhits " & par_order
            Case "addtime": orderstr = " ORDER BY a_addtime " & par_order
            Case "rnd": If app_dbtype = "access" Then orderstr = " ORDER BY  Rnd(" & -1 * (intRandomNumber) & "*a_id)" Else orderstr = " ORDER BY newid()"
            Case Else: orderstr = " ORDER BY a_time " & par_order
        End Select
        
        On Error Resume Next
            Set rs = objdb.DB(sql & where & orderstr, "rs1")
            If Err Then
                html = Replace(html, markval, "artlist标签出错:" & Err.Description)
                Err.Clear: Exit Sub
            End If
        On Error GoTo 0
        
        Set matches2 = getMark(markdes, "\[artlist:\s*([0-9a-zA-Z]+)([\s]*[len|style]*)[=]??([\da-zA-Z\-\\\/\:\s]*)\]")
        Do While Not rs.EOF
            i = i + 1
            If i >= CInt(startnum) Then
                num = num + 1
                marktemp = markdes
                For Each match2 In matches2
                    marktemp = parse("art", marktemp, match2, rs, num)
                Next
                markhtml = markhtml & marktemp
                If num >= par_num Then Exit Do
            End If
            rs.movenext
        Loop
        html = Replace(html, markval, markhtml)
        objdb.C (rs)
        Set match2 = Nothing
        Set matches2 = Nothing
    End Sub
    
    Public Sub artpagelist()
        Dim typearr
        
        Set matches1 = getMark(html, "{maccms:artpagelist([\s\S]*?)}([\s\S]*?){/maccms:artpagelist}")
        For Each match1 In matches1
            markpar = Trim(match1.SubMatches(0))
            markdes = Trim(match1.SubMatches(1))
            markval = match1.Value
            markhtml = ""
            Set matches2 = getMark(markpar, "([a-z0-9]+)=([a-z0-9|,]+)")
            getParam matches2
            
            sql = "SELECT a_id,a_title,a_subtitle,a_entitle,a_from,a_type,a_pic,a_content,a_author,a_color,a_hits,a_dayhits,a_weekhits,a_monthhits,a_addtime,a_time,a_level FROM {pre}art WHERE a_hide=0 "
           
            If Not isNum(par_num) Then par_num = 12 Else par_num = CInt(par_num)
            
            If Not isN(par_level) Then
                If par_level <> "all" Then
                    where = where & " AND a_level in(" & par_level & ")"
                Else
                    where = where & " AND a_level >0"
                End If
            End If
            
            If not isN(par_topic) then
				if par_topic <> "all" Then
		            If par_topic = "current" And curarttopicid > -1 Then
		                where = where & " and a_topic in (" & curarttopicid & ")"
		            Else
		                where = where & " and a_topic in (" & par_topic & ")"
		            End If
	            end if
	        End If
	        
			if isNum(par_day) then
				if app_dbtype = "access" then
					where = where & " and DateDiff('d',a_time,#"&now()&"#)<="&par_day
				else
					where = where & " and DateDiff(day,a_time,getdate())<="&par_day
				end if
			end if
			
            where = where & " AND a_type>0 "
            If curarttypeid <> -1 Then
                page_id = curarttypeid
                where = where & " AND a_type IN (" & page_typearr(10) & ")"
                page_type = "arttype"
            ElseIf curarttopicid <> -1 Then
                page_id = curarttopicid
                where = where & " AND a_topic IN (" & curarttopicid & ")"
                page_type = "arttopic"
            ElseIf Not isN(searchids) Then
                where = where & " AND a_id IN( " & searchids & " )"
                page_type = "artsearch"
            Else
                where = searchwhere
                If Not isN(searchdes) Then page_type = "artearch"
            End If
            
            Select Case par_by
                Case "id": orderstr = " ORDER BY a_id " & par_order
                Case "level": orderstr = " ORDER BY a_level " & par_order
                Case "hits": orderstr = " ORDER BY a_hits " & par_order
                Case "dayhits": orderstr = " ORDER BY a_dayhits " & par_order
                Case "weekhits": orderstr = " ORDER BY a_weekhits " & par_order
                Case "monthhits": orderstr = " ORDER BY a_monthhits " & par_order
                Case "addtime": orderstr = " ORDER BY a_addtime " & par_order
                Case Else: orderstr = " ORDER BY a_time " & par_order
            End Select
            
            
            On Error Resume Next
                Set rs = objdb.DB(sql & where & orderstr, "rs1")
                If Err Then
                    html = Replace(html, markval, "artpagelist标签出错:" & Err.Description)
                    Err.Clear: Exit Sub
                End If
            On Error GoTo 0
            
            
            If Not isNum(page) Then page = 1: page_now = 1 Else page_now = CInt(page)
            rs.pagesize = par_num: page_size = par_num: page_count = rs.pagecount: data_count = rs.recordcount
            If rs.pagecount > 0 And page_now > rs.pagecount Then page_now = rs.pagecount
            If rs.pagecount > 0 Then rs.absolutePage = page_now
            If data_count = 0 Then
                html = Replace(html, markval, "<font style='font-size:13px'><div align='center'>没有相关记录！</div></font>")
                Exit Sub
            End If
            
            Set matches2 = getMark(markdes, "\[pagelist:\s*([0-9a-zA-Z]+)([\s]*[len|style]*)[=]??([\da-zA-Z\-\\\/\:\s]*)\]")
            Do While Not rs.EOF
                num = num + 1
                marktemp = markdes
                For Each match2 In matches2
                    marktemp = parse("art", marktemp, match2, rs, num)
                Next
                markhtml = markhtml & marktemp
                If num >= CInt(par_num) Then Exit Do
                rs.movenext
            Loop
            html = Replace(html, markval, markhtml)
            objdb.C (rs)
        Next
        
        Set match2 = Nothing
        Set matches2 = Nothing
        Set match1 = Nothing
        Set matches1 = Nothing
    End Sub
    
    Public Sub vodlist()
        Dim typearr, field_des
        
        If indexOf(html, "[vodlist:content") Then field_des = "d_content" Else field_des = "0"
        If isN(par_start) Then par_start = 0 Else par_start = CInt(par_start)
        If Not isNum(par_num) Then par_num = 12 Else par_num = CInt(par_num)
        startnum = par_start: topstr = " top " & par_num + startnum
        
        sql = "SELECT " & topstr & " d_id,d_name,d_subname,d_enname,d_type,d_letter,d_state,d_color,d_pic,d_picthumb,d_picslide,d_starring,d_directed,d_area,"
        sql = sql & "d_year,d_language,d_level,d_stint,d_stintdown,d_hits,d_dayhits,d_weekhits,d_monthhits,d_topic," & field_des & ","
        sql = sql & "d_remarks,d_good,d_bad,d_score,d_scorecount,d_duration,d_addtime,d_time,d_playfrom,d_downfrom FROM {pre}vod WHERE d_hide=0 "
        
        If par_state = "series" Then
        	where = where & " and d_state > 0"
        elseif isNum(par_state) then
        	where = where & " and d_state = " & par_state
        end if
        
        If Not isN(par_level) Then
            If par_level <> "all" Then
                where = where & " and d_level in(" & par_level & ")"
            Else
                where = where & " and d_level >0"
            End If
        End If
        
        where = where & " AND d_type>0 "
        if not isN(par_type) then
	        If par_type <> "all" Then
	            If par_type = "current" And curvodtypeid > -1 Then
	                typearr = getValueByArray(cachevodtype, curvodtypeid)
	                where = where & " and d_type in (" & typearr(12) & ")"
	            Else
	            	if instr(par_type,",") >0 then
	                	where = where & " and d_type in (" & par_type& ")"
	                else
	                	typearr = getValueByArray(cachevodtype, cint(par_type))
	                	if isarray(typearr) then
	                		where = where & " and d_type in (" & typearr(12) & ")"
	                	end if
	                end if
	            End If
	        End If
        end if
        
        if not isN(par_topic) then
	        If par_topic <> "all" Then
	            If par_topic = "current" And curvodtopicid > -1 Then
	                where = where & " and d_topic in (" & curvodtopicid & ")"
	            Else
	                where = where & " and d_topic in (" & par_topic & ")"
	            End If
	        End If
        end if
        
        if not isN(par_area) then
        	where = where & " and d_area ='" & par_area & "' "
        end if
        
        if not isN(par_lang) then
        	where = where & " and d_language ='" & par_lang & "'"
        end if
        
        if not isN(par_letter) then
        	where = where & " and d_letter ='" & par_letter & "'"
        end if
        
        if not isN(par_year) then
        	where = where & " and d_year ='" & par_year & "'"
        end if
        
		if isNum(par_day) then
			if app_dbtype = "access" then
				where = where & " and DateDiff('d',d_time,#"&now()&"#)<="&par_day
			else
				where = where & " and DateDiff(day,d_time,getdate())<="&par_day
			end if
		end if
		
		if app_user=1 then
			where = where & getTypeByPopedomFilter("vod")
		end if
		
		if not isN(par_starring) then
			where = where & " AND d_starring like '%"&par_starring&"%' "
        end if
            
        Randomize
        Dim intRandomNumber: intRandomNumber = Int(1000 * Rnd) + 1
                
        Select Case par_by
            Case "id": orderstr = " ORDER BY d_id " & par_order
            Case "hits": orderstr = " ORDER BY d_hits " & par_order
            Case "dayhits": orderstr = " ORDER BY d_dayhits " & par_order
            Case "weekhits": orderstr = " ORDER BY d_weekhits " & par_order
            Case "monthhits": orderstr = " ORDER BY d_monthhits " & par_order
            Case "addtime": orderstr = " ORDER BY d_addtime " & par_order
            Case "level": orderstr = " ORDER BY d_level " & par_order
            Case "good": orderstr = " ORDER BY d_good " & par_order
            Case "bad": orderstr = " ORDER BY d_bad " & par_order
            Case "score": orderstr = " ORDER BY d_score " & par_order
            Case "scorecount": orderstr = " ORDER BY d_scorecount " & par_order
            Case "rnd": If app_dbtype = "access" Then orderstr = " ORDER BY  Rnd(" & -1 * (intRandomNumber) & "*d_id)" Else orderstr = " ORDER BY newid()"
            Case "similar" : if par_similar<>"" then where = where & " AND " & par_similar 
            Case Else: orderstr = " ORDER BY d_time " & par_order
        End Select
        
        On Error Resume Next
            Set rs = objdb.DB(sql & where & orderstr, "rs1")
            If Err Then
                html = Replace(html, markval, "vodlist标签出错:" & Err.Description)
                Err.Clear: Exit Sub
            End If
        On Error GoTo 0
        
        Set matches2 = getMark(markdes, "\[vodlist:\s*([0-9a-zA-Z]+)([\s]*[len|style]*)[=]??([\da-zA-Z\-\\\/\:\s]*)\]")
        Do While Not rs.EOF
            i = i + 1
            If i >= CInt(startnum) Then
                num = num + 1
                marktemp = markdes
                For Each match2 In matches2
                    marktemp = parse("vod", marktemp, match2, rs, num)
                Next
                markhtml = markhtml & marktemp
                If num >= CInt(par_num) Then Exit Do
            End If
            rs.movenext
        Loop
        objdb.C (rs)
        html = Replace(html, markval, markhtml)
        Set match2 = Nothing
        Set matches2 = Nothing
    End Sub
    
    Public Sub vodpagelist()
        Dim field_des,typearr
        If indexOf(html, "[pagelist:content") Then field_des = "d_content" Else field_des = "0"
        
        Set matches1 = getMark(html, "{maccms:vodpagelist([\s\S]*?)}([\s\S]*?){/maccms:vodpagelist}")
        For Each match1 In matches1
            markpar = Trim(match1.SubMatches(0))
            markdes = Trim(match1.SubMatches(1))
            markval = match1.Value
            markhtml = ""
            Set matches2 = getMark(markpar, "([a-z0-9]+)=([\u4E00-\u9FFF|a-z0-9|,|$|.]+)")
            getParam matches2
        	
            sql = "SELECT d_id,d_name,d_subname,d_enname,d_type,d_letter,d_state,d_color,d_pic,d_picthumb,d_picslide,d_starring,d_directed,d_area,"
            sql = sql & "d_year,d_language,d_level,d_stint,d_stintdown,d_hits,d_dayhits,d_weekhits,d_monthhits,d_topic," & field_des & ","
            sql = sql & "d_remarks,d_good,d_bad,d_score,d_scorecount,d_duration,d_addtime,d_time,d_playfrom,d_downfrom  FROM {pre}vod WHERE d_hide=0 "
            
            If Not isNum(par_num) Then par_num = 12 Else par_num = CInt(par_num)
            If Not isN(order) Then par_order = order: listorder = True
            If Not isN(by) Then par_by = by: listorder = True
            If Not isN(searcharea) Then par_area = searcharea: listorder = True
            If Not isN(searchyear) Then par_year = searchyear: listorder = True
            
            
            If par_state = "series" Then
            	where = where & " and d_state > 0"
            elseif isNum(par_state) then
        		where = where & " and d_state = " & par_state
        	end if
        	
            If Not isN(par_level) Then
                If par_level <> "all" Then
                    where = where & " AND d_level in(" & par_level & ")"
                Else
                    where = where & " AND d_level >0"
                End If
            End If
			
			If not isN(par_topic) then
				if par_topic <> "all" Then
		            If par_topic = "current" And curvodtopicid > -1 Then
		                where = where & " and d_topic in (" & curvodtopicid & ")"
		            Else
		                where = where & " and d_topic in (" & par_topic & ")"
		            End If
	            end if
	        End If
        	
        	if not isN(par_area) then
	        	where = where & " and d_area ='" & par_area & "' "
	        end if
	        
	        if not isN(par_lang) then
	        	where = where & " and d_language ='" & par_lang & "'"
	        end if
	        
	        if not isN(par_letter) then
	        	where = where & " and d_letter ='" & par_letter & "'"
	        end if
	        
	        if not isN(par_year) then
	        	where = where & " and d_year ='" & par_year & "'"
	        end if
	        
        	if isNum(par_day) then
				if app_dbtype = "access" then
					where = where & " and DateDiff('d',d_time,#"&now()&"#)<="&par_day
				else
					where = where & " and DateDiff(day,d_time,getdate())<="&par_day
				end if
			end if
			
            where = where & " AND d_type>0 "
            If curvodtypeid <> -1 Then
                page_id = curvodtypeid
                where = where & " AND d_type IN (" & page_typearr(12) & ")"
                page_type = "vodtype"
            ElseIf curvodtopicid <> -1 Then
                page_id = curvodtopicid
                where = where & " AND d_topic IN(" & curvodtopicid & ")"
                page_type = "vodtopic"
            ElseIf Not isN(searchids) Then
                where = where & " AND d_id IN( " & searchids & " )"
                page_type = "vodsearch"
            ElseIf Not isN(par_label) Then
            	page_type = "label"
            Else
                where = searchwhere
                If Not isN(searchdes) Then page_type = "vodsearch" : par_type=""
            End If
            
            if curvodtypeid=-1 AND not isN(par_type) then
		        If par_type <> "all" Then
		            if instr(par_type,",") >0 then
		               	where = where & " and d_type in (" & par_type& ")"
		            elseif isNum(par_type) then
		            	typearr = getValueByArray(cachevodtype, cint(par_type))
		            	if isarray(typearr) then
		                	where = where & " and d_type in (" & typearr(12) & ")"
		                end if
					end if
		        End If
	        end if
            
            if app_user=1 then
				where = where & getTypeByPopedomFilter("vod")
			end if
            
            if not isN(par_starring) then
            	where = where & " AND d_starring like '%"&par_starring&"%' "
            end if
            
            Select Case par_order
                Case "desc":   par_order = "desc"
                Case Else: par_order = "asc"
            End Select
            Select Case par_by
                Case "id": orderstr = " ORDER BY d_id " & par_order
                Case "hits": orderstr = " ORDER BY d_hits " & par_order
                Case "dayhits": orderstr = " ORDER BY d_dayhits " & par_order
                Case "weekhits": orderstr = " ORDER BY d_weekhits " & par_order
                Case "monthhits": orderstr = " ORDER BY d_monthhits " & par_order
                Case "addtime": orderstr = " ORDER BY d_addtime " & par_order
                Case "level": orderstr = " ORDER BY d_level " & par_order
                Case "good": orderstr = " ORDER BY d_good " & par_order
                Case "bad": orderstr = " ORDER BY d_bad " & par_order
                Case "score": orderstr = " ORDER BY d_score" & par_order
                Case "scorecount": orderstr = " ORDER BY d_scorecount" & par_order
                Case Else: orderstr = " ORDER BY d_time " & par_order
            End Select
    		
            On Error Resume Next
                If IsObject(rspage) and lcase(typeName(rspage)) = "recordset" Then
                	rspage.open
                    Set rs = rspage
                Else
                    Set rs = objdb.DB(sql & where & orderstr, "rs1")
                    Set rspage = rs
                End If
                If Err Then
                    html = Replace(html, markval, "vodpagelist标签出错:" & Err.Description)
                    Err.Clear: Exit Sub
                End If
            On Error GoTo 0
            
            If Not isNum(page) Then page = 1: page_now = 1 Else page_now = CInt(page)
            rs.pagesize = par_num: page_size = par_num: page_count = rs.pagecount: data_count = rs.recordcount
            If rs.pagecount > 0 And page_now > rs.pagecount Then page_now = rs.pagecount
            If rs.pagecount > 0 Then rs.absolutePage = page_now
            If data_count = 0 Then
                html = Replace(html, markval, "<font style='font-size:13px'><div align='center'>没有相关记录！</div></font>")
                Exit Sub
            End If
            
            Set matches2 = getMark(markdes, "\[pagelist:\s*([0-9a-zA-Z]+)([\s]*[len|style]*)[=]??([\da-zA-Z\-\\\/\:\s]*)\]")
            Do While Not rs.EOF
                num = num + 1
                marktemp = markdes
                For Each match2 In matches2
                    marktemp = parse("vod", marktemp, match2, rs, num)
                Next
                markhtml = markhtml & marktemp
                If num >= CInt(par_num) Then Exit Do
                rs.movenext
            Loop
            html = Replace(html, markval, markhtml)
            objdb.C (rs)
        Next
        
        Set match2 = Nothing
        Set matches2 = Nothing
        Set match1 = Nothing
        Set matches1 = Nothing
    End Sub
    
    Public Sub topiclist()
        If isN(par_start) Then par_start = 0 Else par_start = CInt(par_start)
        If Not isNum(par_num) Then topstr = "": startnum = par_start Else par_num = CInt(par_num): startnum = par_start: topstr = " top " & par_num + startnum
        
        sql = "SELECT " & topstr & " t_id,t_name,t_enname,t_pic,t_des FROM {pre}" & par_table & "_topic WHERE 1=1 "
        If Not isN(par_topic) And par_topic <> "all" Then where = where & " AND t_id IN(" & par_topic & ") "
        
        Select Case par_by
            Case "id": orderstr = " ORDER BY t_id " & par_order
            Case Else: orderstr = " ORDER BY t_sort " & par_order
        End Select
        
        
        On Error Resume Next
            Set rs = objdb.DB(sql & where & orderstr, "rs1")
            If Err Then
                html = Replace(html, markval, "topiclist标签出错:" & Err.Description)
                Err.Clear: Exit Sub
            End If
        On Error GoTo 0
        Set matches2 = getMark(markdes, "\[topiclist:\s*([0-9a-zA-Z]+)([\s]*[len|style]*)[=]??([\da-zA-Z\-\\\/\:\s]*)\]")
        Do While Not rs.EOF
            i = i + 1
            If i >= CInt(startnum) Then
                num = num + 1
                marktemp = markdes
                For Each match2 In matches2
                    marktemp = parse("topic", marktemp, match2, rs, num)
                Next
                markhtml = markhtml & marktemp
                If num >= CInt(par_num) Then Exit Do
            End If
            rs.movenext
        Loop
        html = Replace(html, markval, markhtml)
        objdb.C (rs)
        Set match2 = Nothing
        Set matches2 = Nothing
    End Sub
        
    Public Sub topicpagelist()
        Set matches1 = getMark(html, "{maccms:topicpagelist([\s\S]*?)}([\s\S]*?){/maccms:topicpagelist}")
        For Each match1 In matches1
            markpar = Trim(match1.SubMatches(0))
            markdes = Trim(match1.SubMatches(1))
            markval = match1.Value
            markhtml = ""
            Set matches2 = getMark(markpar, "([a-z0-9]+)=([a-z0-9|,]+)")
            getParam matches2
                
            sql = "SELECT t_id,t_name,t_enname,t_sort,t_template,t_pic,t_des FROM {pre}" & par_table & "_topic WHERE 1=1 "
			If Not isNum(par_num) Then par_num = 12 Else par_num = CInt(par_num)
            page_type = par_table & "topicindex"
            Select Case par_by
                Case "id": orderstr = " ORDER BY t_id " & par_order
                Case Else: orderstr = " ORDER BY t_sort " & par_order
            End Select
            
            
            On Error Resume Next
                Set rs = objdb.DB(sql & where & orderstr, "rs1")
                If Err Then
                    html = Replace(html, markval, "topicpagelist标签出错:" & Err.Description)
                    Err.Clear: Exit Sub
                End If
            On Error GoTo 0
            
            page_type = par_table & "topicindex"
            
            If Not isNum(page) Then page = 1: page_now = 1 Else page_now = CInt(page)
            rs.pagesize = par_num: page_size = par_num: page_count = rs.pagecount: data_count = rs.recordcount
            If rs.pagecount > 0 And page_now > rs.pagecount Then page_now = rs.pagecount
            If rs.pagecount > 0 Then rs.absolutePage = page_now
            If data_count = 0 Then
                html = Replace(html, markval, "<font style='font-size:13px'><div align='center'>没有相关记录！</div></font>")
                Exit Sub
            End If
            
            Set matches2 = getMark(markdes, "\[pagelist:\s*([0-9a-zA-Z]+)([\s]*[len|style]*)[=]??([\da-zA-Z\-\\\/\:\s]*)\]")
            Do While Not rs.EOF
                num = num + 1
                
                marktemp = markdes
                For Each match2 In matches2
                    marktemp = parse("topic", marktemp, match2, rs, num)
                Next
                markhtml = markhtml & marktemp
                If num >= CInt(par_num) Then Exit Do
                rs.movenext
            Loop
            
            html = Replace(html, markval, markhtml)
            objdb.C (rs)
        Next
        Set match2 = Nothing
        Set matches2 = Nothing
        Set match1 = Nothing
        Set matches1 = Nothing
    End Sub
    
    Public Sub linklist()
        Dim linktype
        If isN(par_start) Then par_start = 0 Else par_start = CInt(par_start)
        If Not isNum(par_num) Then topstr = "": startnum = par_start Else par_num = CInt(par_num): startnum = par_start: topstr = " top " & par_num + startnum
        
        sql = "SELECT " & topstr & " l_id,l_name,l_type,l_url,l_logo FROM {pre}link WHERE 1=1 "
        If Not isN(par_type) And par_type <> "all" Then where = where & " AND l_type ='" & par_type & "' "
        
        Select Case par_by
            Case "id": orderstr = " ORDER BY l_id " & par_order
            Case Else: orderstr = " ORDER BY l_sort " & par_order
        End Select
        
        On Error Resume Next
            Set rs = objdb.DB(sql & where & orderstr, "rs1")
            If Err Then
                html = Replace(html, markval, "linklist标签出错:" & Err.Description)
                Err.Clear: Exit Sub
            End If
        On Error GoTo 0
        Set matches2 = getMark(markdes, "\[linklist:\s*([0-9a-zA-Z]+)([\s]*[len|style]*)[=]??([\da-zA-Z\-\\\/\:\s]*)\]")
        Do While Not rs.EOF
            i = i + 1
            If i >= CInt(startnum) Then
                num = num + 1
                marktemp = markdes
                For Each match2 In matches2
                	marktemp = parse("link", marktemp, match2, rs, num)
                Next
                markhtml = markhtml & marktemp
                If num >= par_num Then Exit Do
            End If
            rs.movenext
        Loop
        html = Replace(html, markval, markhtml)
        Set match2 = Nothing
        Set matches2 = Nothing
    End Sub
    
    Public Function parse(ByVal mtype, ByVal mdes, ByVal match2, ByVal mrs, ByVal mnum)
        Dim markstr, typearr, topicarr, arr1, arr2, multitypename, multitypelink, rc, numfill, pic, content,slink, where,alink
        If mnum < 10 Then numfill = "0" & mnum Else numfill = mnum
        
        Select Case mtype
            Case "type"
                Select Case match2.SubMatches(0)
                    Case "num":
                        markstr = Replace(mdes, match2.Value, mnum)
                    Case "numfill":
                        markstr = Replace(mdes, match2.Value, numfill)
                    Case "id":
                        markstr = Replace(mdes, match2.Value, mrs("t_id"))
                    Case "pid":
                        markstr = Replace(mdes, match2.Value, mrs("t_pid"))
                    Case "name":
                        markstr = Replace(mdes, match2.Value, mrs("t_name"))
                    Case "enname":
                        markstr = Replace(mdes, match2.Value, mrs("t_enname"))
                    Case "key":
                        markstr = Replace(mdes, match2.Value, mrs("t_key"))
                    Case "des":
                        markstr = Replace(mdes, match2.Value, mrs("t_des"))
                    Case "link":
                        If par_table = "art" Then
                            markstr = Replace(mdes, match2.Value, getArtTypeLink(mrs("t_id"), mrs("t_name"), mrs("t_enname"), True))
                        Else
                            markstr = Replace(mdes, match2.Value, getVodTypeLink(mrs("t_id"), mrs("t_name"), mrs("t_enname"), True))
                        End If
                    Case "linktype":
                    	If par_table = "vod" Then
                    		alink = getVodTypeLink(mrs("t_id"), mrs("t_name"), mrs("t_enname"), False)
				        	Select Case app_vodlistviewtype
					            Case 0,3
					                str = "-" & "1" & "-{area}-{year}-" & order & "-" & by & "." & app_vodsuffix
					            Case 1
					                str = "&page=1" & "&area={area}&year={year}&order=" & order & "&by=" & by
					            Case Else
					                str = "." & app_vodsuffix
					        End Select
					        str = replaceStr(str,"{year}", searchyear)
					        alink = alink & replaceStr(str,"{area}", Server.UrlEncode(searcharea) )
                    		markstr = Replace(mdes, match2.Value, alink)
                    	end if
                    Case "count":
                        If par_table = "art" Then
                        	typearr = getValueByArray(cachearttype, mrs("t_id"))
		                	if isarray(typearr) then
		                		where = " and a_type in (" & typearr(10) & ")"
		                	else
		                		where = " and a_type = " & mrs("t_id")
		                	end if
                            data_count = objdb.DB("SELECT count(*) FROM {pre}art WHERE 1=1 " & where, "exe")(0)
                            markstr = Replace(mdes, match2.Value, data_count)
                        Else
                        	typearr = getValueByArray(cachevodtype, mrs("t_id"))
		                	if isarray(typearr) then
		                		where = " and d_type in (" & typearr(12) & ")"
		                	else
		                		where = " and d_type = " & mrs("t_id")
		                	end if
                            data_count = objdb.DB("SELECT count(*) FROM {pre}vod WHERE 1=1 " & where, "exe")(0)
                            markstr = Replace(mdes, match2.Value, data_count)
                        End If
                    Case Else:
                        markstr = mdes
                End Select
            Case "vod"
                If curvodtypeid = -1 Then
                    typearr = getValueByArray(cachevodtype, mrs("d_type"))
                Else
                    If InStr("," & mrs("d_type"), ","&curvodtypeid&",") > 0 Then
                        typearr = page_typearr
                    Else
                        typearr = getValueByArray(cachevodtype, mrs("d_type"))
                    End If
                End If
                if instr(mdes,"topic") > 0 then
                	topicarr = getValueByArray(cachevodtopic, mrs("d_topic"))
                end if
                
                If Not IsArray(typearr) Then Exit Function
                
                Select Case match2.SubMatches(0)
                    Case "num":
                        markstr = Replace(mdes, match2.Value, mnum)
                    Case "numfill":
                        markstr = Replace(mdes, match2.Value, numfill)
                    Case "numjoin":
                        markstr = Replace(mdes, match2.Value, startnum + mnum - 1)
                    Case "id":
                        markstr = Replace(mdes, match2.Value, mrs("d_id"))
                    Case "name":
                        markstr = ReplaceStr(mdes, match2.Value, getText(match2.SubMatches(2), mrs("d_name")))
                    Case "encodename":
                    	markstr = ReplaceStr(mdes, match2.Value, Server.UrlEncode(mrs("d_name")) )
                    Case "colorname":
                    	if isN(mrs("d_color")) then
                    		markstr = ReplaceStr(mdes, match2.Value, getText(match2.SubMatches(2), mrs("d_name")))
                    	else
                        	markstr = ReplaceStr(mdes, match2.Value, "<font color=""" & mrs("d_color") & """>" & getText(match2.SubMatches(2), mrs("d_name")) & "</font>")
                        end if
                    Case "subname":
                        markstr = ReplaceStr(mdes, match2.Value, getText(match2.SubMatches(2), mrs("d_subname")))
                    Case "enname":
                        markstr = ReplaceStr(mdes, match2.Value, getText(match2.SubMatches(2), mrs("d_enname")))
                    Case "ennamelink":
                    	markstr = ReplaceStr(mdes, match2.Value, getKeysLink(mrs("d_enname"), "pinyin"))
                    Case "letter":
                    	markstr = ReplaceStr(mdes, match2.Value, mrs("d_letter"))
                    Case "letterlink":
                    	markstr = ReplaceStr(mdes, match2.Value, getKeysLink(mrs("d_letter"), "letter"))
                    Case "state":
                        markstr = Replace(mdes, match2.Value, mrs("d_state"))
                    Case "color":
                        markstr = ReplaceStr(mdes, match2.Value, mrs("d_color"))
                    Case "pic":
                        pic = mrs("d_pic")
                        If InStr(","&pic, "http://") <= 0 Then pic = app_installdir & pic else pic=pic&""
                        markstr = Replace(mdes, match2.Value, pic)
                    Case "picthumb":
                        pic = mrs("d_picthumb")
                        If InStr(","&pic, "http://") <= 0 Then pic = app_installdir & pic else pic=pic&""
                        markstr = Replace(mdes, match2.Value, pic)
                    Case "picslide":
                        pic = mrs("d_picslide")
                        If InStr(","&pic, "http://") <= 0 Then pic = app_installdir & pic else pic=pic&""
                        markstr = Replace(mdes, match2.Value, pic)
                    Case "starring":
                        markstr = replaceStr(mdes, match2.Value, getText(match2.SubMatches(2), mrs("d_starring")))
                    Case "starringlink":
                        markstr = replaceStr(mdes, match2.Value, getKeysLink(mrs("d_starring"), "starring"))
                    Case "directed":
                        markstr = replaceStr(mdes, match2.Value, getText(match2.SubMatches(2), mrs("d_directed")))
                    Case "directedlink":
                        markstr = replaceStr(mdes, match2.Value, getKeysLink(mrs("d_directed"), "directed"))
                    Case "area":
                        markstr = ReplaceStr(mdes, match2.Value, mrs("d_area"))
                    Case "arealink":
                        markstr = ReplaceStr(mdes, match2.Value, getKeysLink(mrs("d_area"), "area"))
                    Case "year":
                        markstr = ReplaceStr(mdes, match2.Value, mrs("d_year"))
                    Case "yearlink":
                        markstr = ReplaceStr(mdes, match2.Value, getKeysLink(mrs("d_year"), "year"))
                    Case "language":
                        markstr = ReplaceStr(mdes, match2.Value, mrs("d_language"))
                    Case "languagelink":
                        markstr = ReplaceStr(mdes, match2.Value, getKeysLink(mrs("d_language"), "language"))
                    Case "level":
                        markstr = Replace(mdes, match2.Value, mrs("d_level"))
                    Case "stint":
                        markstr = Replace(mdes, match2.Value, mrs("d_stint"))
                    Case "stintdown":
                        markstr = Replace(mdes, match2.Value, mrs("d_stintdown"))
                    Case "hits":
                        markstr = Replace(mdes, match2.Value, mrs("d_hits"))
                    Case "dayhits":
                        markstr = Replace(mdes, match2.Value, mrs("d_dayhits"))
                    Case "weekhits":
                        markstr = Replace(mdes, match2.Value, mrs("d_weekhits"))
                    Case "monthhits":
                        markstr = Replace(mdes, match2.Value, mrs("d_monthhits"))
                    Case "content":
                        markstr = Replace(mdes, match2.Value, getText(match2.SubMatches(2), repPse(mrs("d_content"),mrs("d_id"))))
                    Case "contenttext":
                        markstr = Replace(mdes, match2.Value, getText(match2.SubMatches(2), htmlFilter(repPse(mrs("d_content"),mrs("d_id")))))
                    Case "remarks":
                        markstr = replaceStr(mdes, match2.Value, mrs("d_remarks"))
                    Case "good":
                        markstr = Replace(mdes, match2.Value, mrs("d_good"))
                    Case "bad":
                        markstr = Replace(mdes, match2.Value, mrs("d_bad"))
                    Case "score":
                        markstr = Replace(mdes, match2.Value, mrs("d_score"))
                    Case "scorecount":
                        markstr = Replace(mdes, match2.Value, mrs("d_scorecount"))
                    Case "scorepjf":
                        If mrs("d_scorecount") = 0 Then
                            markstr = Replace(mdes, match2.Value, "0.0")
                        Else
                            markstr = Replace(mdes, match2.Value, FormatNumber(CDbl(mrs("d_score")) / CDbl(mrs("d_scorecount")), 1, -1, -1, 0))
                        End If
                    Case "duration":
                        markstr = Replace(mdes, match2.Value, mrs("d_duration"))
                    Case "addtime":
                        markstr = Replace(mdes, match2.Value, getDate(match2.SubMatches(2), mrs("d_addtime")))
                    Case "time":
                        markstr = Replace(mdes, match2.Value, getDate(match2.SubMatches(2), mrs("d_time")))
                    Case "from":
                        markstr = Replace(mdes, match2.Value, getVodXmlText("vodplay.xml","players/player",mrs("d_playfrom"),1))
                    Case "link":
                        markstr = Replace(mdes, match2.Value, getVodLink(mrs("d_id"), mrs("d_name"), mrs("d_enname"),mrs("d_addtime"), typearr(0), typearr(1), typearr(2)))
                    Case "playlink":
                        markstr = Replace(mdes, match2.Value, getVodPlayUrl(mrs("d_id"), mrs("d_name"), mrs("d_enname"),mrs("d_addtime"), typearr(0), typearr(1), typearr(2), 1, 1))
                    Case "downlink":
                    	markstr = Replace(mdes, match2.Value, getVodDownUrl(mrs("d_id"), mrs("d_name"), mrs("d_enname"),mrs("d_addtime"), typearr(0), typearr(1), typearr(2), 1, 1))
                    Case "type":
                    	markstr = Replace(mdes, match2.Value, mrs("d_type") )
                    Case "typepid":
                    	markstr = Replace(mdes, match2.Value, typearr(4) )
                    Case "typelink":
                        markstr = Replace(mdes, match2.Value, getVodTypeLink(typearr(0), typearr(1), typearr(2), True))
                    Case "typename":
                        markstr = Replace(mdes, match2.Value, typearr(1))
                    Case "typeenname":
                        markstr = Replace(mdes, match2.Value, typearr(2))
                    Case "typekey":
                    	markstr = Replace(mdes, match2.Value, typearr(5))
                    Case "typedes":
                    	markstr = Replace(mdes, match2.Value, typearr(6))
                    Case "topic":
                    	markstr = Replace(mdes, match2.Value, mrs("d_topic"))
                    Case "topicname":
                    	if isarray(topicarr) then
                    		markstr = Replace(mdes, match2.Value, topicarr(1))
                    	else
                    		markstr = Replace(mdes, match2.Value, "")
                    	end if
                    Case "topiclink":
                    	if isarray(topicarr) then
                    		markstr = Replace(mdes, match2.Value, getVodTopicLink(mrs("d_topic"), topicarr(1), topicarr(2), True))
                    	else
                    		markstr = Replace(mdes, match2.Value, "###")
                    	end if
                    Case "userfav":
                        markstr = Replace(mdes, match2.Value, "<a href=""javascript:void(0)"" onclick=""userFav('" & mrs("d_id") & "');return false;""/>会员收藏</a>")
                    Case "desktop":
                    	 markstr = Replace(mdes, match2.Value, "<a href=""javascript:void(0)"" onclick=""desktop('" & mrs("d_name") & "');return false;""/>保存到桌面</a>")
                    Case Else:
                        markstr = mdes
                End Select
            Case "art"
                If curarttypeid = -1 Then
                    typearr = getValueByArray(cachearttype, mrs("a_type"))
                Else
                    typearr = page_typearr
                End If
                if instr(mdes,"topic") > 0 then
                	topicarr = getValueByArray(cachearttopic, mrs("a_topic"))
                end if
                
                Select Case match2.SubMatches(0)
                    Case "num":
                        markstr = Replace(mdes, match2.Value, mnum)
                    Case "numfill":
                        markstr = Replace(mdes, match2.Value, numfill)
                    Case "numjoin":
                        markstr = Replace(mdes, match2.Value, startnum + mnum - 1)
                    Case "id":
                        markstr = Replace(mdes, match2.Value, mrs("a_id"))
                    Case "title":
                        markstr = Replace(mdes, match2.Value, getText(match2.SubMatches(2), mrs("a_title")))
                    Case "encodetitle":
                    	markstr = Replace(mdes, match2.Value, Server.UrlEncode(mrs("a_title")))
                    Case "colortitle":
                    	if isN( mrs("a_color") ) then
                        	markstr = Replace(mdes, match2.Value, getText(match2.SubMatches(2), mrs("a_title")))
                        else
                        markstr = Replace(mdes, match2.Value, "<font color=""" & mrs("a_color") & """>" & getText(match2.SubMatches(2), mrs("a_title")) & "</font>")
                        end if
                    Case "subtitle":
                        markstr = ReplaceStr(mdes, match2.Value, getText(match2.SubMatches(2), mrs("a_subtitle")))
                    Case "entitle":
                        markstr = ReplaceStr(mdes, match2.Value, getText(match2.SubMatches(2), mrs("a_entitle")))
                    Case "letter":
                        markstr = ReplaceStr(mdes, match2.Value, mrs("a_letter"))
                    Case "from":
                        markstr = ReplaceStr(mdes, match2.Value, getText(match2.SubMatches(2), mrs("a_from")))
                    Case "content":
                    	content = mrs("a_content")
                    	if page_type="art" then content = page_content
                        markstr = Replace(mdes, match2.Value, getText(match2.SubMatches(2), content))
                    Case "contenttext"
                    	content = mrs("a_content")
                    	if page_type="art" then content = page_content
                        markstr = Replace(mdes, match2.Value, getText(match2.SubMatches(2), htmlFilter(content)))
                    Case "author":
                        markstr = ReplaceStr(mdes, match2.Value, getText(match2.SubMatches(2), mrs("a_author")))
                    Case "color":
                        markstr = Replace(mdes, match2.Value, mrs("a_color"))
                    Case "hits":
                        markstr = Replace(mdes, match2.Value, mrs("a_hits"))
                    Case "dayhits":
                        markstr = Replace(mdes, match2.Value, mrs("a_dayhits"))
                    Case "weekhits":
                        markstr = Replace(mdes, match2.Value, mrs("a_weekhits"))
                    Case "monthhits":
                        markstr = Replace(mdes, match2.Value, mrs("a_monthhits"))
                    Case "addtime":
                        markstr = Replace(mdes, match2.Value, getDate(match2.SubMatches(2), mrs("a_addtime")))
                    Case "time":
                        markstr = Replace(mdes, match2.Value, getDate(match2.SubMatches(2), mrs("a_time")))
                    Case "pic":
                    	pic = mrs("a_pic")
                        If InStr(","&pic, "http://") <= 0 Then pic = app_installdir & pic else pic=pic&""
                        markstr = Replace(mdes, match2.Value, pic)
                    Case "link":
                        markstr = Replace(mdes, match2.Value, getArtLink(mrs("a_id"), mrs("a_title"), mrs("a_entitle"), mrs("a_addtime"), mrs("a_type"), typearr(1), typearr(2),true))
                    Case "type":
                    	markstr = Replace(mdes, match2.Value, mrs("a_type") )
                    Case "typepid":
                    	markstr = Replace(mdes, match2.Value, typearr(4) )
                    Case "typelink":
                        markstr = Replace(mdes, match2.Value, getArtTypeLink(typearr(0), typearr(1), typearr(2), True))
                    Case "typename":
                        markstr = Replace(mdes, match2.Value, typearr(1))
                    Case "typeenname":
                        markstr = Replace(mdes, match2.Value, typearr(2))
                    Case "typekey":
                    	markstr = Replace(mdes, match2.Value, typearr(5))
                    Case "typedes":
                    	markstr = Replace(mdes, match2.Value, typearr(6))
                    Case "topic":
                    	markstr = Replace(mdes, match2.Value, mrs("a_topic"))
                    Case "level":
                        markstr = Replace(mdes, match2.Value, mrs("a_level"))
                    Case "topicname":
                    	if isarray(topicarr) then
                    		markstr = Replace(mdes, match2.Value, topicarr(1))
                    	else
                    		markstr = Replace(mdes, match2.Value, "")
                    	end if
                    Case "topiclink":
                    	if isarray(topicarr) then
                    		markstr = Replace(mdes, match2.Value, getArtTopicLink(mrs("a_topic"), topicarr(1), topicarr(2), True))
                    	else
                    		markstr = Replace(mdes, match2.Value, "###")
                    	end if
                    Case Else:
                        markstr = mdes
                End Select
			Case "topic"
                Select Case match2.SubMatches(0)
                    Case "num":
                        markstr = Replace(mdes, match2.Value, mnum)
                    Case "numfill":
                        markstr = Replace(mdes, match2.Value, numfill)
                    Case "id":
                        markstr = Replace(mdes, match2.Value, mrs("t_id"))
                    Case "name":
                        markstr = Replace(mdes, match2.Value, getText(match2.SubMatches(2), mrs("t_name")))
                    Case "enname":
                        markstr = Replace(mdes, match2.Value, getText(match2.SubMatches(2), mrs("t_enname")))
                    Case "sort":
                        markstr = Replace(mdes, match2.Value, mrs("t_sort"))
                    Case "pic":
                    	pic = mrs("t_pic")
                        If InStr(","&pic, "http://") <= 0 Then pic = app_installdir & pic else pic=pic&""
                        markstr = ReplaceStr(mdes, match2.Value, pic)
                    Case "count":
                        If par_table = "art" Then
                            data_count = objdb.DB("SELECT count(a_id) FROM {pre}art WHERE a_topic=" & rs("t_id"), "exe")(0)
                            markstr = Replace(mdes, match2.Value, data_count)
                        Else
                            data_count = objdb.DB("SELECT count(d_id) FROM {pre}vod WHERE d_topic=" & rs("t_id"), "exe")(0)
                            markstr = Replace(mdes, match2.Value, data_count)
                        End If
                    Case "des":
                        markstr = ReplaceStr(mdes, match2.Value, getText(match2.SubMatches(2), mrs("t_des")))
                    Case "link":
                        If par_table = "art" Then
                            markstr = Replace(mdes, match2.Value, getArtTopicLink(mrs("t_id"), mrs("t_name"), mrs("t_enname"), True))
                        Else
                            markstr = Replace(mdes, match2.Value, getVodTopicLink(mrs("t_id"), mrs("t_name"), mrs("t_enname"), True))
                        End If
                    Case Else:
                        markstr = mdes
                End Select
			Case "link":
				Select Case match2.SubMatches(0)
					Case "num":
						markstr = Replace(mdes, match2.Value, num)
					Case "id":
						markstr = Replace(mdes, match2.Value, mrs("l_id"))
					Case "name":
						markstr = Replace(mdes, match2.Value, getText(match2.SubMatches(2), mrs("l_name")) )
					Case "type":
						If mrs("l_type") = "pic" Then linktype = "图片" Else linktype = "文字"
						markstr = Replace(mdes, match2.Value, linktype)
					Case "link":
						markstr = Replace(mdes, match2.Value, mrs("l_url"))
					Case "pic":
						markstr = Replace(mdes, match2.Value, mrs("l_logo"))
					Case Else:
						markstr = mdes
				End Select
        End Select
        parse = markstr
    End Function
    
    Public Sub arealist()
        Dim arr: arr = cachearea
        Dim onstart, onend, onstep,alink,tlink
        
        if isNum(par_type) then
        	alink = app_installdir & "search.asp?type=" & par_type & "&area={area}"
        elseif par_type= "auto" and curvodtypeid>0 then
        	alink = getVodTypeLink(page_id, page_name, page_enname, False)
        	Select Case app_vodlistviewtype
	            Case 0,3
	                str = "-" & "1" & "-{area}-{year}-" & order & "-" & by & "." & app_vodsuffix
	            Case 1
	                str = "&page=1" & "&area={area}&year={year}&order=" & order & "&by=" & by
	            Case Else
	                str = "." & app_vodsuffix
	        End Select
	        alink = alink & replace(str,"{year}",searchyear)
	    else
	    	alink = app_installdir & "search.asp?area={area}"
        end if
        
        If par_order = "desc" Then
            onstart = UBound(arr)
            onend = 0
            onstep = -1
        Else
            onstart = 0
            onend = UBound(arr)
            onstep = 1
        End If
        
        For i = onstart To onend Step onstep
            Set matches2 = getMark(markdes, "\[arealist:\s*([0-9a-zA-Z]+)([\s]*[len|style]*)[=]??([\da-zA-Z\-\\\/\:\s]*)\]")
            num = num + 1
            marktemp = markdes
            For Each match2 In matches2
                Select Case match2.SubMatches(0)
                    Case "num":
                        marktemp = Replace(marktemp, match2.Value, num)
                    Case "name":
                        marktemp = Replace(marktemp, match2.Value, arr(i)(1))
                    Case "link":
                        marktemp = Replace(marktemp, match2.Value, replaceStr(alink,"{area}",Server.UrlEncode(arr(i)(1)) ))
                End Select
            Next
            markhtml = markhtml & marktemp
        Next
        html = Replace(html, markval, markhtml)
        Set match2 = Nothing
        Set matches2 = Nothing
    End Sub
    
    Public Sub yearlist()
        Dim onstart, onend, onstep, alink,tlink
        
        if isNum(par_type) then
        	alink = app_installdir & "search.asp?type=" & par_type & "&year={year}"
        elseif par_type= "auto" and curvodtypeid>0 then
        	alink = getVodTypeLink(page_id, page_name, page_enname, False)
        	Select Case app_vodlistviewtype
	            Case 0,3
	                str = "-" & "1" & "-{area}-{year}-" & order & "-" & by & "." & app_vodsuffix
	            Case 1
	                str = "&page=1" & "&area={area}&year={year}&order=" & order & "&by=" & by
	            Case Else
	                str = "." & app_vodsuffix
	        End Select
	        alink = alink & replace(str,"{area}", Server.UrlEncode(searcharea) )
	    else
	    	alink = app_installdir & "search.asp?year={year}"
        end if
        
        
        if not isNum(par_start) or len(par_start)<4 then par_start=2000 else par_start=cint(par_start)
        if not isNum(par_end) or len(par_end)<4 then par_end=2012 else par_end=cint(par_end)
        
        
        If par_order = "desc" Then
            onstep = -1
            onstart = par_end
            onend = par_start
        Else
            onstep = 1
            onstart = par_start
            onend = par_end
        End If
        
        For i = onstart To onend Step onstep
            Set matches2 = getMark(markdes, "\[yearlist:\s*([0-9a-zA-Z]+)([\s]*[len|style]*)[=]??([\da-zA-Z\-\\\/\:\s]*)\]")
            num = num + 1
            marktemp = markdes
            For Each match2 In matches2
                Select Case match2.SubMatches(0)
                    Case "num":
                        marktemp = Replace(marktemp, match2.Value, num)
                    Case "name":
                        marktemp = Replace(marktemp, match2.Value, i)
                    Case "link":
                        marktemp = Replace(marktemp, match2.Value, replaceStr(alink,"{year}",i))
                End Select
            Next
            markhtml = markhtml & marktemp
        Next
        html = Replace(html, markval, markhtml)
        Set match2 = Nothing
        Set matches2 = Nothing
    End Sub
    
    Public Sub languagelist()
        Dim arr: arr = cachelang
        Dim onstart, onend, onstep, tstr
        
        if isNum(par_type) then
        	tstr = "&type=" & par_type
        end if
        
        If par_order = "desc" Then
            onstart = UBound(arr)
            onend = 0
            onstep = -1
        Else
            onstart = 0
            onend = UBound(arr)
            onstep = 1
        End If
        
        For i = onstart To onend Step onstep
            Set matches2 = getMark(markdes, "\[languagelist:\s*([0-9a-zA-Z]+)([\s]*[len|style]*)[=]??([\da-zA-Z\-\\\/\:\s]*)\]")
            num = num + 1
            marktemp = markdes
            For Each match2 In matches2
                Select Case match2.SubMatches(0)
                    Case "num":
                        marktemp = Replace(marktemp, match2.Value, num)
                    Case "name":
                        marktemp = Replace(marktemp, match2.Value, arr(i)(1))
                    Case "link":
                        marktemp = Replace(marktemp, match2.Value, app_installdir & "search.asp?language=" & Server.UrlEncode(arr(i)(1)) & tstr )
                End Select
            Next
            markhtml = markhtml & marktemp
        Next
        html = Replace(html, markval, markhtml)
        Set match2 = Nothing
        Set matches2 = Nothing
    End Sub
    
    Public Sub pageshow()
        Dim pagenumval, startnum, endnum, strpagenum, pagenum , pagepre, pagefirst, pagenext, pagelast, pagesel
        Set matches2 = getMark(html, "\{maccms:pagenum([\s\S]*?)\}" )
        '"\{maccms:(pagenum)\s*([a-zA-Z=]*)\s*([\d]*)\}"
        For Each match2 In matches2
            pagenumval = match2.Value
            Set matches3 = getMark( match2.SubMatches(0) , "([a-z0-9]+)=([a-z0-9|,]+)")
            For Each match3 In matches3
            	Select Case Trim(match3.SubMatches(0))
            		case "len" : pagenum = match3.SubMatches(1)
            		case "linktype" : page_type = match3.SubMatches(1)
            	End Select
            Next
            Exit For
        Next
        set matches3 = Nothing
        set match3 = Nothing
        Set matches2 = Nothing
        Set match2 = Nothing
        if page_count<1 then page_count=1
        
        pagefirst = getPageLink(1)
        
        If page = 1 And page_count = 1 Then
            pagepre = pagefirst
            pagenext = pagefirst
            pagelast = pagefirst
            
        ElseIf page = page_count And page_count > 1 Then
            pagepre = getPageLink(page - 1)
            pagenext = getPageLink(page_count)
            pagelast = pagenext
        ElseIf page = 1 And page_count > 1 Then
            pagepre = pagefirst
            pagenext = getPageLink(page + 1)
            pagelast = getPageLink(page_count)
        Else
            pagepre = getPageLink(page - 1)
            pagenext = getPageLink(page + 1)
            pagelast = getPageLink(page_count)
        End If
        
        startnum = 1
        endnum = CInt(pagenum)
        If CInt(page) > endnum \ 2 Then
          startnum = page - endnum \ 2
          endnum = page + endnum \ 2
        End If
        For i = startnum To endnum
            If i > page_count Then Exit For
            If i = page Then
                strpagenum = strpagenum & "<em class=""current"">" & i & "</em>&nbsp;"
            Else
                strpagenum = strpagenum & "<a href=""" & getPageLink(i) & """>" & i & "</a>&nbsp;"
            End If
        Next
        
        cacheName = "pageselect_" & page_type & "_" & page_id
        If chkCache(cacheName) Then
            pagesel = getCache(cacheName)
        Else
            pagesel = "<select name=""pagelist"" onchange=javascript:window.location=this.options[this.selectedIndex].value; ><option value="""">请选择页码</option>"
            For i = 1 To page_count
                pagesel = pagesel & "<option value=""" & getPageLink(i) & """>第" & i & "页</option>"
            Next
            pagesel = pagesel & "</select>"
            setCache cacheName, pagesel
        End If
        
        html = Replace(html, pagenumval, strpagenum)
        html = Replace(html, "{maccms:pagenow}", page_now)
        html = Replace(html, "{maccms:pagefirst}", pagefirst)
        html = Replace(html, "{maccms:pagelast}", pagelast)
        html = Replace(html, "{maccms:pagepre}", pagepre)
        html = Replace(html, "{maccms:pagenext}", pagenext)
        html = Replace(html, "{maccms:pagedata}", data_count)
        html = Replace(html, "{maccms:pagesize}", page_size)
        html = Replace(html, "{maccms:pagecount}", page_count)
        html = Replace(html, "{maccms:pageselect}", pagesel)
        html = Replace(html, "{searchpage:count}", data_count)
        
    End Sub
    
    Public Sub playdownlist(flag, id, name, enname,addtime, typeid, typename, typeenname, playfrom, playserver, playurl)
        Dim server, serverdes,servertip,serversort, from, show,oldsort,sort, tip, url, urlarr, urlarrcount,urlone, urlname, urlpath, count, des, arr1
        Dim playurlarr, playfromarr, playserverarr, playurlarrlen, playfromarrlen, playserverarrlen,playlink
        Dim markstr, markslist1, markslist2,markorder
        dim forstartnum,forendnum,forstep,starti,endi,fromrc,playlisthtml,tmp
        
        If isN(playurl) Then playurl = ""
        If isN(playfrom) Then playfrom = ""
        If isN(playserver) Then playserver = ""
        fromrc =true
        oldsort=1 
        
        playurlarr = Split(playurl, "$$$"): playurlarrlen = UBound(playurlarr)
        playfromarr = Split(playfrom, "$$$"): playfromarrlen = UBound(playfromarr)
        playserverarr = Split(playserver, "$$$"): playserverarrlen = UBound(playserverarr)
        
        Set matches1 = getMark(html, "{maccms:"&flag&"list([\s\S]*?)}([\s\S]*?){/maccms:"&flag&"list}")
        
        For Each match1 In matches1
            markpar = Trim(match1.SubMatches(0))
            markdes = Trim(match1.SubMatches(1))
            markval = match1.Value
            markhtml = ""
            playlisthtml=""
            ReDim markslist1(2,0)
            Set matches2 = getMark(markpar, "([a-z0-9]+)=([a-z0-9|,]+)")
            getParam matches2
            
            For i = 0 To playfromarrlen  step 1
                num = num + 1
                
                from = playfromarr(i)
                if flag="play" then
                	show = getVodXmlText("vodplay.xml","players/player", playfromarr(i) , 1)
                	des = getVodXmlText("vodplay.xml","players/player", playfromarr(i) , 2)
                	sort = getVodXmlText("vodplay.xml","players/player", playfromarr(i) , 3)
                	tip = getVodXmlText("vodplay.xml","players/player", playfromarr(i) , 4)
                else
                	show = getVodXmlText("voddown.xml","downs/down", playfromarr(i) , 1)
                	des = getVodXmlText("voddown.xml","downs/down", playfromarr(i) , 2)
                	sort = getVodXmlText("voddown.xml","downs/down", playfromarr(i) , 3)
                	tip = getVodXmlText("voddown.xml","downs/down", playfromarr(i) , 4)
                end if
                
                If playserverarrlen >= i Then
                    server = getVodXmlText("vodserver.xml","servers/server", playserverarr(i) , 1)
                    serverdes = getVodXmlText("vodserver.xml","servers/server", playserverarr(i) , 2)
                    serversort = getVodXmlText("vodserver.xml","servers/server", playserverarr(i) , 3)
                    servertip = getVodXmlText("vodserver.xml","servers/server", playserverarr(i) , 4)
                End If
                
                if flag="play" then
	                if app_vodplayviewtype<>3 and par_from="current" then
	                	if num=cint(cursrc) then fromrc=true else fromrc=false : markhtml=""
	                end if
                elseif flag="down" then
                	if app_voddownviewtype<>3 and par_from="current" then
	                	if num=cint(cursrc) then fromrc=true else fromrc=false : markhtml=""
	                end if
                end if
                
                If fromrc and playurlarrlen >= i Then
                    url = playurlarr(i)
                    urlarr = Split(url, "#")
                    urlarrcount = ubound(urlarr) + 1
                    k=0
                    Set matches2 = getMark(markdes, "{maccms:urllist([\s\S]*?)}([\s\S]*?){/maccms:urllist}")
                    For Each match2 In matches2
                    	markorder = match2.SubMatches(0)
                        marktemp = match2.SubMatches(1)
                        markslist2 = ""
                        
                        if instr(markorder,"desc")>0 then
							forstartnum=ubound(urlarr):forendnum=0:forstep=-1
						else
							forstartnum=0:forendnum=ubound(urlarr):forstep=1
						end if
                        
                        For j = forstartnum To forendnum Step forstep
                            If Not isN(urlarr(j)) Then
                                urlone = Split(urlarr(j), "$")
                                
                                If UBound(urlone) = 1 Then
                                    urlname = urlone(0): urlpath = urlone(1)
                                Else
                                    urlpath = urlone(0)
                                    urlname = "第" & j + 1 & "集"
                                end if
                                markstr = Replace(marktemp, "[urllist:num]", j+1 )
                                markstr = Replace(markstr, "[urllist:name]", urlname)
                                markstr = Replace(markstr, "[urllist:path]", urlpath)
                                if flag="play" then
                                	playlink = getVodPlayUrl(id, name, enname,addtime, typeid, typename, typeenname, i + 1, j + 1)
                                else
                                	playlink = getVodDownUrl(id, name, enname,addtime, typeid, typename, typeenname, i + 1, j + 1)
                                end if
                                markstr = Replace(markstr, "[urllist:link]",playlink )
                                markslist2 = markslist2 & markstr
                            End If
                        Next
                        if app_playisopen=1 then
                        	markslist2 = replace(markslist2,"target=""_blank""","target=""_self""")
                        end if
                        if k =0 then
                        	markhtml = Replace(markdes, match2.Value, markslist2)
                        else
                        	markhtml = Replace(markhtml, match2.Value, markslist2)
                        end if
                        k = k + 1
                    Next
                End If
                
                markhtml = Replace(markhtml, "["&flag&"list:count]", playfromarrlen)
                markhtml = Replace(markhtml, "["&flag&"list:urlcount]", urlarrcount)
                markhtml = Replace(markhtml, "["&flag&"list:num]", num)
                markhtml = Replace(markhtml, "["&flag&"list:from]", from)
                markhtml = Replace(markhtml, "["&flag&"list:show]", show)
                markhtml = Replace(markhtml, "["&flag&"list:des]", des)
                markhtml = Replace(markhtml, "["&flag&"list:sort]", sort)
                markhtml = Replace(markhtml, "["&flag&"list:tip]", tip)
                markhtml = Replace(markhtml, "["&flag&"list:server]", server)
                markhtml = Replace(markhtml, "["&flag&"list:serversort]", serversort)
                markhtml = Replace(markhtml, "["&flag&"list:serverurl]", serverdes)
                markhtml = Replace(markhtml, "["&flag&"list:servertip]", servertip)
                
                if app_vodplayersort=1 then
                	ReDim Preserve markslist1(2,sort)
                	markslist1(0,num) = sort
                	markslist1(1,num) = markhtml
                else
                	ReDim Preserve markslist1(2,num)
                	markslist1(0,num) = num
                	markslist1(1,num) = markhtml
                end if
            Next
            if app_vodplayersort=1 then
            	for i=0 to ubound(markslist1,2)
					for j=i+1 to ubound(markslist1,2)
						if markslist1(0,i) < markslist1(0,j) then
							tmp=markslist1(0,j):markslist1(0,j)=markslist1(0,i):markslist1(0,i)=tmp
							tmp=markslist1(1,j):markslist1(1,j)=markslist1(1,i):markslist1(1,i)=tmp
						end if
					next
				next
            end if
            for i=0 to ubound(markslist1,2)
            	playlisthtml = playlisthtml & markslist1(1,i)
            next
            html = Replace(html, markval, playlisthtml)
        Next
        set tmp=nothing
        set markslist1=nothing
        set urlone=nothing
        set urlarr=nothing
        set playurlarr=nothing
        set playfromarr=nothing
        set playserverarr=nothing
        Set match2 = Nothing
        Set matches2 = Nothing
        Set match1 = Nothing
        Set matches1 = Nothing
    End Sub
    
    Public Sub replaceComment(ByVal c_type, ByVal c_vid)
        Dim str, strLabel
        If c_type = 1 Then strLabel = "vodinfo" Else strLabel = "artinfo"
        
        str = "<div id=""maccms_comment""><div style=""padding:5px;text-align:center;""><img src=""" & app_installdir & "images/loading.gif""/> &nbsp;&nbsp;<strong>评论载入中，请稍候.....</strong></div></div><script language=""javascript"">getComment('" & app_installdir & "plus/comment/?id="& c_vid & "&type=" & c_type & "');</script>"
        
        html = replaceStr(html, "[" & strLabel & ":comment]", str)
    End Sub
    
    Public Sub replaceMood(ByVal m_type, m_vid)
        Dim str, strLabel
        If m_type = 1 Then strLabel = "vodinfo" Else strLabel = "artinfo"
        
        str = "<script type=""text/javascript"" src=""" & app_installdir & "plus/mood/mood.js""></script><script language = ""JavaScript"" src =""" & app_installdir & "plus/mood/?m_vid=" & m_vid & "&m_type=" & m_type & """></script>"
        
        html = replaceStr(html, "[" & strLabel & ":mood]", str)
    End Sub
    
    Public Sub replaceDigg(ByVal d_type, ByVal d_vid)
        Dim str, strLabel
        If d_type = 1 Then strLabel = "vodinfo" Else strLabel = "artinfo"
        str = "<script type=""text/javascript"" src=""" & app_installdir & "plus/digg/digg.js""></script><script language = ""JavaScript"" src =""" & app_installdir & "plus/digg/?d_vid=" & d_vid & "&d_type=" & d_type & """></script>"
        html = replaceStr(html, "[" & strLabel & ":digg]", str)
    End Sub
    
    Public function getTypeText(byval tid,byval tpid,byval tname,byval tlink,byval flag)
		dim typeParr,typePLink
		If not chkCache(flag&"_typetext_"&tid) Then
			if tpid <> 0 then
				If flag = "art" Then
					typeParr =  getValueByArray(cachearttype, tpid)
					typePLink =  getArtTypeLink(tpid, typeParr(1), typeParr(2), True)
				else
					typeParr = getValueByArray(cachevodtype, tpid)
					typePLink = getVodTypeLink(tpid, typeParr(1), typeParr(2), True)
				end if
				getTypeText = "<a href='"& app_installdir &"'>首页</a>&nbsp;&nbsp;&raquo;&nbsp;&nbsp;<a href='"& typePLink &"' >"& typeParr(1) &"</a>" &"&nbsp;&nbsp;&raquo;&nbsp;&nbsp;<a href='"& tlink &"'>"& tname &"</a>"
			else
				getTypeText = "<a href='"& app_installdir &"'>首页</a>&nbsp;&nbsp;&raquo;&nbsp;&nbsp;<a href='"& tlink &"' >"& tname &"</a>"
			end if
		else
			getTypeText = getCache(flag&"_typetext_"&tid)
		end if
	end function
    
    Public Sub loadlist(ByVal flag, ByVal typearr)
        Dim t_pid, t_template, t_key, t_des, cachetemplatename, templatepath, typeLink,viewtype,vlink,alink,blink,linkyear,linkarea,linktype,linkid,str1
        page_typearr = typearr
        
        If flag = "art" Then
            page_id = curarttypeid
            If Not IsArray(page_typearr) Then showMsg "找不到此id的数据", "../index.asp": Exit Sub
            typeLink = getArtTypeLink(page_id, page_typearr(1), page_typearr(2), True)
            viewtype = app_artlistviewtype
        Else
            page_id = curvodtypeid
            If Not IsArray(page_typearr) Then showMsg "找不到此id的数据", "../index.asp": Exit Sub
            typeLink = getVodTypeLink(page_id, page_typearr(1), page_typearr(2), True)
            viewtype = app_vodlistviewtype
        End If
        
        page_name = page_typearr(1): page_enname = page_typearr(2): t_pid = page_typearr(4): t_key = page_typearr(5): t_des = page_typearr(6): t_template = page_typearr(7)
        
        if viewtype <>2 then attemptCacheFile flag & "list", "list" & page_id & page & searcharea & searchyear & order & by
        cacheName = flag & "list_" & page_id
        cachetemplatename = "template_" & flag & "list_" & page_id
        templatepath = app_installdir & "template/" & app_templatedir & "/" & app_htmldir & "/" & t_template
        
        If chkCache(cacheName) Then
            html = getCache(cacheName)
        Else
            html = getFileByCache(cachetemplatename, templatepath)
            html = replaceStr(html, "{typepage:id}", page_id)
            html = replaceStr(html, "{typepage:name}", page_name)
            html = replaceStr(html, "{typepage:enname}", page_enname)
            html = replaceStr(html, "{typepage:pid}", t_pid)
            html = replaceStr(html, "{typepage:key}", t_key)
            html = replaceStr(html, "{typepage:des}", t_des)
            html = replaceStr(html, "{typepage:link}", typeLink)
            html = replaceStr(html, "{typepage:textlink}", getTypeText(page_id,t_pid,page_name,typeLink,flag) )
            mark
            setCache cacheName, html
        End If
        
        html = Replace(html, "{typepage:page}", page)
        html = Replace(html, "{typepage:order}", order)
        html = Replace(html, "{typepage:by}", by)
        html = Replace(html, "{typepage:area}", searcharea)
        html = Replace(html, "{typepage:year}", searchyear)
        
        If flag = "art" Then
        	artpagelist
        Else
        	vlink = getVodTypeLink(page_id, page_typearr(1), page_typearr(2), False)
        	Select Case app_vodlistviewtype
	            Case 0,3
	                str1 = "-" & "1" & "-{area}-{year}-" & order & "-" & by & "." & app_vodsuffix
	            Case 1
	                str1 = "&page=1" & "&area={area}&year={year}&order=" & order & "&by=" & by
	            Case Else
	                str1 = "." & app_vodsuffix
	        End Select
	        alink = vlink & str1
	        
	        linkyear = replace(alink,"{area}", Server.UrlEncode(searcharea) )
	        linkyear = replace(linkyear,"{year}", "" )
        	html = Replace(html, "{typepage:linkyear}", linkyear)
        	
        	linkarea = replace(alink,"{year}", searchyear )
	        linkarea = replace(linkarea,"{area}", "" )
	        html = Replace(html, "{typepage:linkarea}", linkarea)
	        
	        if page_typearr(4)=0 then linkid=page_id else linkid=page_typearr(4)
	        vlink = getVodTypeLink(linkid, page_typearr(1), page_typearr(2), False)
	        
	        blink = vlink & str1
	        linktype = replace(blink,"{area}", Server.UrlEncode(searcharea) )
        	linktype = replace(linktype,"{year}", searchyear )
        	html = Replace(html, "{typepage:linktype}", linktype)
        	
        	vodpagelist
       	end if
        pageshow
        ifEx
        if viewtype <>2 then  setCacheFile flag & "list", "list" & page_id & page & searcharea & searchyear & order & by, html
        run
    End Sub
    
    Public Sub loadtopic(ByVal flag, ByVal typearr)
        Dim t_des, t_template, t_pic, t_sort, cachetemplatename, templatepath, typeLink,viewtype
        page_typearr = typearr
        If flag = "art" Then
            page_id = curarttopicid: typeLink = getArtTopicLink(page_id, page_typearr(1), page_typearr(2), True)
            viewtype = app_arttopicviewtype
        Else
            page_id = curvodtopicid: typeLink = getVodTopicLink(page_id, page_typearr(1), page_typearr(2), True)
            viewtype = app_vodtopicviewtype
        End If
        page_name = page_typearr(1): page_enname = page_typearr(2): t_sort = page_typearr(3): t_template = page_typearr(4): t_pic = page_typearr(5): t_des = page_typearr(6)
        
        if viewtype <>2 then attemptCacheFile flag & "topiclist", "topiclist" & page_id & page
        cacheName = flag & "topiclist_" & page_id
        cachetemplatename = "template_" & flag & "topiclist_" & page_id
        templatepath = app_installdir & "template/" & app_templatedir & "/" & app_htmldir & "/" & t_template
        
        If chkCache(cacheName) Then
            html = getCache(cacheName)
        Else
            html = getFileByCache(cachetemplatename, templatepath)
            html = replaceStr(html, "{topicpage:id}", page_id)
            html = replaceStr(html, "{topicpage:pic}", t_pic)
            html = replaceStr(html, "{topicpage:des}", t_des)
            html = replaceStr(html, "{topicpage:name}", page_name)
            html = replaceStr(html, "{topicpage:enname}", page_enname)
            html = replaceStr(html, "{topicpage:link}", typeLink)
            mark
            setCache cacheName, html
        End If
        html = Replace(html, "{topicpage:page}", page)
        
        If flag = "art" Then
        	artpagelist
        Else
        	vodpagelist
       	end if
        pageshow
        ifEx
        if viewtype <>2 then  setCacheFile flag & "topiclist", "topiclist" & page_id & page, html
        run
    End Sub
    
    Public Sub replacePlayName(flag,from,url,src,num)
    	Dim i, j, urlarr, playurlarr, playurlarrlen,playfromarr,playfromarrlen,urlfrom,urlshow,urlname,urlpath,urlone
    	playfromarr = Split(from,"$$$") : playfromarrlen = Ubound(playfromarr)
	    playurlarr = Split(url, "$$$"): playurlarrlen = UBound(playurlarr)
	    For i = 0 To UBound(playfromarr)
	        If (src-1) = i Then
	        	urlfrom = playfromarr(i)
	        	if flag="play" then
	        		urlshow = getVodXmlText("vodplay.xml","players/player", playfromarr(i) , 1)
                else
                	urlshow = getVodXmlText("voddown.xml","downs/down", playfromarr(i) , 1)
                end if
	            url = playurlarr(i)
	            urlarr = Split(url, "#"): url = ""
	            For j = 0 To UBound(urlarr)
					If Not isN(urlarr(j)) Then
						if j=(num-1) then 
							urlone = Split(urlarr(j), "$")
							If UBound(urlone) = 1 Then
								urlname = urlone(0)
								urlpath = urlone(1)
							else
								urlname = "第" & j + 1 & "集"
								urlpath = urlone(0)
							end if
							html = replaceStr(html,"["&flag&"info:from]",urlfrom)
							html = replaceStr(html,"["&flag&"info:fromshow]",urlshow)
							html = replaceStr(html,"["&flag&"info:name]",urlname)
							html = replaceStr(html,"["&flag&"info:urlpath]",urlpath)
							exit sub
						end if
	                End If
	            Next
	        End If
	    Next
	    set urlone=nothing
	    set urlarr=nothing
	    set playfromarr=nothing
	    set playurlarr=nothing
    end sub
    
    Public Sub loadvod(ByVal rs,ByVal typearr ,ByVal flag)
        Dim cachetemplatename, templatepath, playtemplatefile, typeid, typelink
        Dim slink, score, scorecount, starring,arr1,i,rc,playstr,playfile,pdviewtype
        'If Not IsArray(page_typearr) Then page_typearr = getValueByArray(cachevodtype, curvodtypeid)
        
        page_typearr = typearr
        curvodtypepid = page_typearr(4)
        If flag = "view" Then
            cacheName = "vod_" & curvodtypeid
            cachetemplatename = "template_vod" & curvodtypeid
            templatepath = app_installdir & "template/" & app_templatedir & "/" & app_htmldir & "/" & page_typearr(8)
        Elseif flag = "play" then
            If app_playisopen = 1 Then playtemplatefile = "vodplayopen.html" Else playtemplatefile = page_typearr(9)
            cacheName = "vodplay_" & curvodtypeid
            cachetemplatename = "template_vodplay" & curvodtypeid
            templatepath = app_installdir & "template/" & app_templatedir & "/" & app_htmldir & "/" & playtemplatefile
        elseif flag = "down" then
        	cacheName = "voddown_" & curvodtypeid
            cachetemplatename = "template_voddown" & curvodtypeid
            templatepath = app_installdir & "template/" & app_templatedir & "/" & app_htmldir & "/" & page_typearr(10)
        End If
        
        If chkCache(cacheName) Then
            html = getCache(cacheName)
        Else
            html = getFileByCache(cachetemplatename, templatepath)
            setCache cacheName, html
        End If
        
        slink = getVodLink(rs("d_id"), rs("d_name"), rs("d_enname"),rs("d_addtime"), curvodtypeid, page_typearr(1), page_typearr(2))
        score = rs("d_score")
        scorecount = rs("d_scorecount")
        If Not isNum(score) Then score = 0
        If Not isNum(scorecount) Then scorecount = 0
        
        html = Replace(html, "[vodinfo:hits]", "<em id=""hit"">加载中</em><script>getHit('vod','" & rs("d_id") & "')</script>")
        html = Replace(html, "[vodinfo:fav]", "<a href=""javascript:void(0)"" onclick=""sitefav('http://" & app_siteurl & slink & "','" & rs("d_name") & "在线看');return false;""/>我要收藏</a>")
        html = Replace(html, "[vodinfo:share]", "<a href=""javascript:void(0)"" onclick=""copyData(document.title +'   ' + window.location.href);return false;""/>我要分享</a>")
        html = Replace(html, "[vodinfo:error]", "<a href=""javascript:void(0)"" onclick=""vodError('"& rs("d_id") &"','" & rs("d_name") & "');return false;""/>我要报错</a>")
        html = Replace(html, "[vodinfo:error2]", "<a href=""javascript:void(0)"" onclick=""vodError2('"& rs("d_id") &"','" & rs("d_name") & "');return false;""/>我要报错</a>")
        
        html = Replace(html, "[vodinfo:goodmark]", "<em id=""good_num""><script>getGoodBad('good','" & rs("d_id") & "')</script></em><a href=""javascript:void(0)"" onclick=""vodGood(" & rs("d_id") & ",'good_num');return false;""/>顶一下</a>")
        html = Replace(html, "[vodinfo:badmark]", "<em id=""bad_num""><script>getGoodBad('bad','" & rs("d_id") & "')</script></em><a href=""javascript:void(0)"" onclick=""vodBad(" & rs("d_id") & ",'bad_num');return false;""/>踩一下</a>")
        
        html = Replace(html, "[vodinfo:scorenummark]", "<em id=""score_num""></em><script>getScore('','" & rs("d_id") & "')</script>")
        html = Replace(html, "[vodinfo:scorepjfmark]", "<em id=""scorepjf_num""></em><script>getScore('pjf','" & rs("d_id") & "')</script>")
        html = Replace(html, "[vodinfo:scorecountmark]", "<em id=""scorecount_num""></em><script>getScore('count','" & rs("d_id") & "')</script>")
        
        html = Replace(html, "[vodinfo:history]", "<script>history_New(window.location.href,'" & rs("d_name") & "');</script>")
            
        html = Replace(html, "[vodinfo:scoremark]", "<link rel=""stylesheet"" href=""" & app_installdir & "images/rater.css"" type=""text/css""  /><script src=""" & app_installdir & "js/jquery.rater.js""></script> <script>vodScoreMark(" & rs("d_id") & "," & scorecount & "," & score & ");</script>")
        html = Replace(html, "[vodinfo:scoremark1]", "<script>vodScoreMark1(" & rs("d_id") & "," & scorecount & "," & score & ");</script>")
        
        if indexOf(html,"[vodinfo:textlink]") then
        	typelink = getVodTypeLink(page_typearr(0), page_typearr(1), page_typearr(2), True)
        	html = Replace(html, "[vodinfo:textlink]", getTypeText(curvodtypeid,page_typearr(4),page_typearr(1),typelink,"vod")&"&nbsp;&nbsp;&raquo;&nbsp;&nbsp;<a href='"& slink &"'>"&rs("d_name")&"</a>" )
        end if
        
        if indexOf(html,"[vodinfo:prelink]") then
			html = Replace(html, "[vodinfo:prelink]", getVodPreNextLink(rs("d_id"),0))
        end if
        
        if  indexOf(html,"[vodinfo:nextlink]") then 
       		html = Replace(html, "[vodinfo:nextlink]", getVodPreNextLink(rs("d_id"),1))
        end if
        
        replaceComment 1, rs("d_id")
        replaceMood 1, rs("d_id")
        replaceDigg 1, rs("d_id")
        
        Set matches2 = getMark(html, "\[vodinfo:\s*([0-9a-zA-Z]+)([\s]*[len|style]*)[=]??([\da-zA-Z\-\\\/\:\s]*)\]")
        For Each match2 In matches2
            marktemp = parse("vod", match2.Value, match2, rs, num)
            html = Replace(html, match2.Value, marktemp)
        Next
        Set match2 = Nothing
        Set matches2 = Nothing
        
        If flag = "play" or flag = "down" Then
        	if flag = "play" then
        		pdviewtype = app_vodplayviewtype : 
        		html = Replace(html, "["&flag&"info:"&flag&"er]", getPlayer())
        	else
        		pdviewtype = app_voddownviewtype : 
        		html = Replace(html, "["&flag&"info:"&flag&"er]", getDowner())
        	end if
        	
            if pdviewtype <3 then
            	html = Replace(html,"["&flag&"info:num]",curnum)
            	replacePlayName flag,rs("d_"&flag&"from"),rs("d_"&flag&"url"),cursrc,curnum
            	html = Replace(html, "["&flag&"info:info]", "<script>" & vbCrLf & getAddressInfo(flag,rs("d_name"), rs("d_"&flag&"from"), rs("d_"&flag&"server"), rs("d_"&flag&"url"))& vbCrLf & " </script>" & vbCrLf )
            else
            	playstr =  getAddressInfo(flag,rs("d_name"), rs("d_"&flag&"from"), rs("d_"&flag&"server"), rs("d_"&flag&"url"))
            	playfile = "upload/"&flag&"data/"&  rs("d_id") & "/"& rs("d_id") &".js"
            	objFile.createFilePath "../" & playfile
            	objFile.createFile "../" &  playfile,playstr
            	html = Replace(html, "["&flag&"info:info]", "<script src="""& app_installdir & playfile &"""></script>")
            end if
            
        End If
        
        if not (flag="play" and app_vodplayviewtype>2) then
        	playdownlist "play",rs("d_id"), rs("d_name"), rs("d_enname"), rs("d_addtime"),rs("d_type"), page_typearr(1), page_typearr(2), rs("d_playfrom"), rs("d_playserver"), rs("d_playurl")
        end if
        if not (flag="down" and app_voddownviewtype>2) then
        	playdownlist "down",rs("d_id"), rs("d_name"), rs("d_enname"),rs("d_addtime"), rs("d_type"), page_typearr(1), page_typearr(2), rs("d_downfrom"), rs("d_downserver"), rs("d_downurl")
        end if
        
        rc=false
        par_similar=""
        starring = replaceStr(rs("d_starring"),","," ")
        arr1 = split(starring," ")
        for i=0 to ubound(arr1)
        	if not isN( arr1(i) ) then
        		if rc then par_similar = par_similar & " or "
         		par_similar = par_similar & " d_starring like '%"& replace(arr1(i),"'","''") &"%' "
         		rc=true
         	end if
        next
        set arr1=nothing
        if rc then par_similar = " (" & par_similar & ") "
        
        mark
        if flag="view" then ifEx
        run
    End Sub
    
    Public Sub loadart(ByVal rs,ByVal typearr)
		Dim cachetemplatename, templatepath,typelink,contentarr,slink
        'page_typearr = getValueByArray(cachearttype, rs("a_type"))
        page_typearr = typearr
        cacheName = "art_" & curarttypeid
        cachetemplatename = "template_art"
        templatepath = app_installdir & "template/" & app_templatedir & "/" & app_htmldir & "/" & page_typearr(8)
        curarttypepid = page_typearr(4)
        If chkCache(cacheName) Then
            html = getCache(cacheName)
        Else
            html = getFileByCache(cachetemplatename, templatepath)
            setCache cacheName, html
        End If
        
        html = Replace(html,"[artinfo:page]",page)
        page_type = "art"
        contentarr = split(rs("a_content"),"[artinfo:page]")
        if ((page-1) <= ubound(contentarr)) then page_content = contentarr(page-1)
		page_now = page
		page_id = rs("a_id")
		page_name = rs("a_title")
		page_enname = rs("a_entitle")
		page_addtime = rs("a_addtime")
		page_size = 1
		data_count = ubound(contentarr) + 1
		page_count = ubound(contentarr) + 1
		pageshow
        set contentarr=nothing
        
        slink = getArtLink(rs("a_id"), rs("a_title"), rs("a_entitle"), rs("a_addtime"),curarttypeid, page_typearr(1), page_typearr(2),true)
        html = Replace(html, "[artinfo:hits]", "<em id=""hit"">加载中</em><script>getHit('art','" & rs("a_id") & "')</script>")
        html = Replace(html, "[artinfo:fav]", "<a href=""javascript:void(0)"" onclick=""sitefav('http://" & app_siteurl & slink & "','" & rs("a_title") & "在线看');return false;""/>我要收藏</a>")
        html = Replace(html, "[artinfo:share]", "<a href=""javascript:void(0)"" onclick=""copyData(document.title +'   ' + window.location.href);return false;""/>我要分享</a>")
        if indexOf(html,"[artinfo:textlink]") then
        	typelink = getArtTypeLink(page_typearr(0), page_typearr(1), page_typearr(2), True)
        	html = Replace(html, "[artinfo:textlink]", getTypeText(curvodtypeid,page_typearr(4),page_typearr(1),typelink,"art")&"&nbsp;&nbsp;&raquo;&nbsp;&nbsp;<a href='"& slink &"'>"&rs("a_title")&"</a>" )
        end if
        
        if indexOf(html,"[artinfo:prelink]") then
			html = Replace(html, "[artinfo:prelink]", getArtPreNextLink(rs("a_id"),0))
        end if
        
        if indexOf(html,"[artinfo:nextlink]") then 
       		html = Replace(html, "[artinfo:nextlink]", getArtPreNextLink(rs("a_id"),1))
        end if
        
        replaceComment 2, rs("a_id")
        replaceMood 2, rs("a_id")
        
        Set matches2 = getMark(html, "\[artinfo:\s*([0-9a-zA-Z]+)([\s]*[len|style]*)[=]??([\da-zA-Z\-\\\/\:\s]*)\]")
        For Each match2 In matches2
            marktemp = parse("art", match2.Value, match2, rs, num)
            html = Replace(html, match2.Value, marktemp)
        Next
        Set match2 = Nothing
        Set matches2 = Nothing
        mark
        ifEx
        run
    End Sub
end class
%>