<% 
	Private Function regExp_showNews(strContent)
		If strContent = "" Then
			Exit Function
		End If
		Dim regEx, Key, Matchs, arrRegExp, str, s
		str = strContent
		Set regEx = New RegExp
			regEx.IgnoreCase = True
			regEx.Global = True
			regEx.Pattern = "<!--showNews:([\S\s]*?)-->"
			Set Matchs = regEx.Execute(str)
			If Matchs.Count > 0 Then
				For Each Key In Matchs
					arrRegExp = Split(Key.SubMatches(0), "|")
					'Response.Write(Key.SubMatches(0)) & "<br>"
					s = Mesky.showNews(arrRegExp(0), arrRegExp(1), arrRegExp(2), arrRegExp(3))
					str = Replace(str, "<!--showNews:" & Key.SubMatches(0) & "-->", s)
					s = Null
					arrRegExp = Null
				Next
				Key = Null
			End If
			Set Matchs = Nothing
		Set regEx = Nothing
		regExp_showNews = str
		str = Null
	End Function
	Private Function regExp_showDownRes(strContent)
		If strContent = "" Then
			Exit Function
		End If
		Dim regEx, Key, Matchs, arrRegExp, str, s
		str = strContent
		Set regEx = New RegExp
			regEx.IgnoreCase = True
			regEx.Global = True
			regEx.Pattern = "<!--showDownRes:([\S\s]*?)-->"
			Set Matchs = regEx.Execute(str)
			If Matchs.Count > 0 Then
				For Each Key In Matchs
					arrRegExp = Split(Key.SubMatches(0), "|")
					'Response.Write(Key.SubMatches(0)) & "<br>"
					s = Mesky.showDownRes(arrRegExp(0), arrRegExp(1), arrRegExp(2), arrRegExp(3), arrRegExp(4), arrRegExp(5))
					str = Replace(str, "<!--showDownRes:" & Key.SubMatches(0) & "-->", s)
					s = Null
					arrRegExp = Null
				Next
				Key = Null
			End If
			Set Matchs = Nothing
		Set regEx = Nothing
		regExp_showDownRes = str
		str = Null
	End Function
	Private Function regExp_showCmsRes(strContent)
		If strContent = "" Then
			Exit Function
		End If
		Dim regEx, Key, Matchs, arrRegExp, str, s
		str = strContent
		Set regEx = New RegExp
			regEx.IgnoreCase = True
			regEx.Global = True
			regEx.Pattern = "<!--showCmsRes:([\S\s]*?)-->"
			Set Matchs = regEx.Execute(str)
			If Matchs.Count > 0 Then
				For Each Key In Matchs
					arrRegExp = Split(Key.SubMatches(0), "|")
					'Response.Write(Key.SubMatches(0)) & "<br>"
					s = Mesky.showCmsRes(arrRegExp(0), arrRegExp(1), arrRegExp(2), arrRegExp(3), arrRegExp(4), arrRegExp(5))
					str = Replace(str, "<!--showCmsRes:" & Key.SubMatches(0) & "-->", s)
					s = Null
					arrRegExp = Null
				Next
				Key = Null
			End If
			Set Matchs = Nothing
		Set regEx = Nothing
		regExp_showCmsRes = str
		str = Null
	End Function
	Private Function regExp_AdvshowDownRes(strContent)
		If strContent = "" Then
			Exit Function
		End If
		Dim regEx, Key, Matchs, arrRegExp, str, s
		str = strContent
		Set regEx = New RegExp
			regEx.IgnoreCase = True
			regEx.Global = True
			regEx.Pattern = "<!--AdvshowDownRes:([\S\s]*?)-->"
			Set Matchs = regEx.Execute(str)
			If Matchs.Count > 0 Then
				For Each Key In Matchs
					arrRegExp = Split(Key.SubMatches(0), "|")
					'Response.Write(Key.SubMatches(0)) & "<br>"
					s = Mesky.showDownResAdv(arrRegExp(0), arrRegExp(1), arrRegExp(2), arrRegExp(3), arrRegExp(4), arrRegExp(5), arrRegExp(6), arrRegExp(7))
					str = Replace(str, "<!--AdvshowDownRes:" & Key.SubMatches(0) & "-->", s)
					s = Null
					arrRegExp = Null
				Next
				Key = Null
			End If
			Set Matchs = Nothing
		Set regEx = Nothing
		regExp_AdvshowDownRes = str
		str = Null
	End Function
	Private Function regExp_AdvshowCmsRes(strContent)
		If strContent = "" Then
			Exit Function
		End If
		Dim regEx, Key, Matchs, arrRegExp, str, s
		str = strContent
		Set regEx = New RegExp
			regEx.IgnoreCase = True
			regEx.Global = True
			regEx.Pattern = "<!--AdvshowCmsRes:([\S\s]*?)-->"
			Set Matchs = regEx.Execute(str)
			If Matchs.Count > 0 Then
				For Each Key In Matchs
					arrRegExp = Split(Key.SubMatches(0), "|")
					'Response.Write(Key.SubMatches(0)) & "<br>"
					s = Mesky.showCmsResAdv(arrRegExp(0), arrRegExp(1), arrRegExp(2), arrRegExp(3), arrRegExp(4), arrRegExp(5), arrRegExp(6), arrRegExp(7))
					str = Replace(str, "<!--AdvshowCmsRes:" & Key.SubMatches(0) & "-->", s)
					s = Null
					arrRegExp = Null
				Next
				Key = Null
			End If
			Set Matchs = Nothing
		Set regEx = Nothing
		regExp_AdvshowCmsRes = str
		str = Null
	End Function
	Private Function regExp_showDownResImages(strContent)
		If strContent = "" Then
			Exit Function
		End If
		Dim regEx, Key, Matchs, arrRegExp, str, s
		str = strContent
		Set regEx = New RegExp
			regEx.IgnoreCase = True
			regEx.Global = True
			regEx.Pattern = "<!--showDownResImages:([\S\s]*?)-->"
			Set Matchs = regEx.Execute(str)
			If Matchs.Count > 0 Then
				For Each Key In Matchs
					arrRegExp = Split(Key.SubMatches(0), "|")
					'Response.Write(Key.SubMatches(0)) & "<br>"
					s = Mesky.showDownResImages(arrRegExp(0), arrRegExp(1), arrRegExp(2), arrRegExp(3), arrRegExp(4), arrRegExp(5), arrRegExp(6))
					str = Replace(str, "<!--showDownResImages:" & Key.SubMatches(0) & "-->", s)
					s = Null
					arrRegExp = Null
				Next
				Key = Null
			End If
			Set Matchs = Nothing
		Set regEx = Nothing
		regExp_showDownResImages = str
		str = Null
	End Function
	Private Function regExp_showCmsResImages(strContent)
		If strContent = "" Then
			Exit Function
		End If
		Dim regEx, Key, Matchs, arrRegExp, str, s
		str = strContent
		Set regEx = New RegExp
			regEx.IgnoreCase = True
			regEx.Global = True
			regEx.Pattern = "<!--showCmsResImages:([\S\s]*?)-->"
			Set Matchs = regEx.Execute(str)
			If Matchs.Count > 0 Then
				For Each Key In Matchs
					arrRegExp = Split(Key.SubMatches(0), "|")
					'Response.Write(Key.SubMatches(0)) & "<br>"
					s = Mesky.showCmsResImages(arrRegExp(0), arrRegExp(1), arrRegExp(2), arrRegExp(3), arrRegExp(4), arrRegExp(5), arrRegExp(6))
					str = Replace(str, "<!--showCmsResImages:" & Key.SubMatches(0) & "-->", s)
					s = Null
					arrRegExp = Null
				Next
				Key = Null
			End If
			Set Matchs = Nothing
		Set regEx = Nothing
		regExp_showCmsResImages = str
		str = Null
	End Function
	Private Function regExp_showCmsResExcerptImages(strContent)
		If strContent = "" Then
			Exit Function
		End If
		Dim regEx, Key, Matchs, arrRegExp, str, s
		str = strContent
		Set regEx = New RegExp
			regEx.IgnoreCase = True
			regEx.Global = True
			regEx.Pattern = "<!--showCmsResExcerptImages:([\S\s]*?)-->"
			Set Matchs = regEx.Execute(str)
			If Matchs.Count > 0 Then
				For Each Key In Matchs
					arrRegExp = Split(Key.SubMatches(0), "|")
					'Response.Write(Key.SubMatches(0)) & "<br>"
					s = Mesky.showCmsResExcerptImages(arrRegExp(0), arrRegExp(1), arrRegExp(2), arrRegExp(3), arrRegExp(4), arrRegExp(5), arrRegExp(6), arrRegExp(7))
					str = Replace(str, "<!--showCmsResExcerptImages:" & Key.SubMatches(0) & "-->", s)
					s = Null
					arrRegExp = Null
				Next
				Key = Null
			End If
			Set Matchs = Nothing
		Set regEx = Nothing
		regExp_showCmsResExcerptImages = str
		str = Null
	End Function
	
	Private Function regExp_showDownResStat(strContent)
		If strContent = "" Then
			Exit Function
		End If
		Dim regEx, Key, Matchs, arrRegExp, str, s
		str = strContent
		Set regEx = New RegExp
			regEx.IgnoreCase = True
			regEx.Global = True
			regEx.Pattern = "<!--showDownResStat:([\S\s]*?)-->"
			Set Matchs = regEx.Execute(str)
			If Matchs.Count > 0 Then
				For Each Key In Matchs
					arrRegExp = Split(Key.SubMatches(0), "|")
					'Response.Write(Key.SubMatches(0)) & "<br>"
					s = showDownResStat(arrRegExp(0), arrRegExp(1), arrRegExp(2))
					str = Replace(str, "<!--showDownResStat:" & Key.SubMatches(0) & "-->", s)
					s = Null
					arrRegExp = Null
				Next
				Key = Null
			End If
			Set Matchs = Nothing
		Set regEx = Nothing
		regExp_showDownResStat = str
		str = Null
	End Function
	Private Function showDownResStat(strStat, strWhere, divisor)
		If strStat = "" Then strStat = "count(*)"
		If divisor = "" Or CLng(divisor) = 0 Then divisor = 1
		If strWhere = "" Then
			showDownResStat = Mesky.Execute("select " & strStat & " from Mesky_Down_Resource")(0) \ divisor
		Else
			showDownResStat = Mesky.Execute("select " & strStat & " from Mesky_Down_Resource where " & strWhere & "")(0) \ divisor
		End If
	End Function
	Private Function regExp_showCmsResStat(strContent)
		If strContent = "" Then
			Exit Function
		End If
		Dim regEx, Key, Matchs, arrRegExp, str, s
		str = strContent
		Set regEx = New RegExp
			regEx.IgnoreCase = True
			regEx.Global = True
			regEx.Pattern = "<!--showCmsResStat:([\S\s]*?)-->"
			Set Matchs = regEx.Execute(str)
			If Matchs.Count > 0 Then
				For Each Key In Matchs
					arrRegExp = Split(Key.SubMatches(0), "|")
					'Response.Write(Key.SubMatches(0)) & "<br>"
					s = showCmsResStat(arrRegExp(0), arrRegExp(1), arrRegExp(2))
					str = Replace(str, "<!--showCmsResStat:" & Key.SubMatches(0) & "-->", s)
					s = Null
					arrRegExp = Null
				Next
				Key = Null
			End If
			Set Matchs = Nothing
		Set regEx = Nothing
		regExp_showCmsResStat = str
		str = Null
	End Function
	Private Function showCmsResStat(strStat, strWhere, divisor)
		If strStat = "" Then strStat = "count(*)"
		If divisor = "" Or CLng(divisor) = 0 Then divisor = 1
		If strWhere = "" Then
			showCmsResStat = Mesky.Execute("select " & strStat & " from Mesky_Cms_Resource")(0) \ divisor
		Else
			showCmsResStat = Mesky.Execute("select " & strStat & " from Mesky_Cms_Resource where " & strWhere & "")(0) \ divisor
		End If
	End Function
	Private Function regExp_showSiteLinks(strContent)
		If strContent = "" Then
			Exit Function
		End If
		Dim regEx, Key, Matchs, arrRegExp, str, s
		str = strContent
		Set regEx = New RegExp
			regEx.IgnoreCase = True
			regEx.Global = True
			regEx.Pattern = "<!--showSiteLinks:([\S\s]*?)-->"
			Set Matchs = regEx.Execute(str)
			If Matchs.Count > 0 Then
				For Each Key In Matchs
					arrRegExp = Split(Key.SubMatches(0), "|")
					'Response.Write(Key.SubMatches(0)) & "<br>"
					s = showSiteLinks(arrRegExp(0), arrRegExp(1))
					str = Replace(str, "<!--showSiteLinks:" & Key.SubMatches(0) & "-->", s)
					s = Null
					arrRegExp = Null
				Next
				Key = Null
			End If
			Set Matchs = Nothing
		Set regEx = Nothing
		regExp_showSiteLinks = str
		str = Null
	End Function
	Public Function showSiteLinks(showType,showNum)
		dim tRs,s,link_i,link_ii
		link_i=0
		s = "<table width=""100%"" border=""0"" align=""center"" cellpadding=""3"" cellspacing=""1""><tr align=""center"" bgcolor=""#F6F6F6""> "& vbcrlf
		if showType=1 then
			set tRs = Mesky.Execute("select top "&showNum&" * from Mesky_SiteLinks where LinkType=1 order by isHot Desc,orders asc,Hits Desc")
			If Not(tRs.eof and tRs.bof) then
				do while not tRs.eof
				s = s & "<td><a href="""&tRs("SiteURL")&""" target=_blank title="""&Trim(tRs("Description"))&"""><img src="""&tRs("SiteLogo")&""" width=""88"" height=""31"" border=""0""></a></td>"& vbcrlf
				link_i = link_i + 1
				if link_i mod 8 = 0 then  s = s & "</tr><tr align=""center"" bgcolor=""#F6F6F6"">"& vbcrlf
				tRs.movenext
				loop 
				If link_i mod 8 > 0 then 
					for link_ii = 1 to (8 - (link_i mod 8))
						s = s & "<td><img src=""../images/link.gif"" width=""88"" height=""31"" border=""0""></td>"& vbcrlf
					next
				End if
			End if
			Set tRs = Nothing 
		Else
			Set tRs = Mesky.Execute("select top "&showNum&" * from Mesky_SiteLinks where LinkType=0 order by isHot Desc,orders asc,Hits Desc")
			If Not(tRs.eof and tRs.bof) then
				do while not tRs.eof
					s = s & "<td><a href="""&tRs("SiteURL")&""" target=_blank title="""&Trim(tRs("Description"))&""">"&tRs("SiteName")&"</a></td>"& vbcrlf
					link_i = link_i + 1
					if link_i mod 8 = 0 then  s = s & "</tr><tr align=""center"" bgcolor=""#F6F6F6"">"& vbcrlf
				tRs.movenext
				loop 
				if link_i mod 8 > 0 then 
					for link_ii = 1 to (8 - (link_i mod 8))
						s = s & "<td>ÄúµÄÁ´½Ó</td>"& vbcrlf
					next
				end if
			end if
			Set tRs = Nothing
		End if
		s = s & "</tr></table>"
		showSiteLinks = s
		s = Null
	End function
%>