<%
Function Refresh(f_Type,f_ID)
	Dim f_Array,f_Sql_Head,f_Sql
	f_Array = Split(f_Type,"_")
	if UBound(f_Array) = 1 then
		f_Sql_Head = Get_Search_Sql_Head(f_Array(0),f_Array(1))
		if InStr(1,f_Array(1),"special",1) = 0 then
			f_Sql = f_Sql_Head & " And A.ID=" & f_ID
		else
			f_Sql = f_Sql_Head & " And A.specialID=" & f_ID
		end if
		Refresh = Refresh_One_Record(f_Sql,false)
	else
		Refresh = False
	end if
End Function

Function Get_Search_Sql_Head(f_Sys_ID,f_Refresh_Type)
	Select Case f_Sys_ID
		Case "NS"
			If f_Refresh_Type = "news" then
				Get_Search_Sql_Head = "Select Top 1 0 as RefreshFileSaveType,'NS_news' as PageType,A.ID as OnlyID,A.isPop as RefreshisPop,A.NewsID as RefreshID,A.Templet as RefreshTemplet,A.SaveNewsPath as RefreshSavePath,A.FileName as RefreshFileName,A.FileExtName as RefreshFileExtName,B.SavePath as SaveClassPath,B.ClassEName,B.ClassName as ClassCName,A.IsPop from FS_NS_News as A,FS_NS_NewsClass as B where A.ClassID=B.ClassID and A.isURL=0 and A.isdraft=0 and A.isRecyle=0 and A.isLock=0"
			ElseIf f_Refresh_Type = "class" then
				Get_Search_Sql_Head = "Select Top 1 A.FileSaveType as RefreshFileSaveType,'NS_class' as PageType,A.ID as OnlyID,0 as RefreshisPop,Templet as RefreshTemplet,ClassID as RefreshID,SavePath as SaveClassPath,'' as RefreshSavePath,ClassEName,'index' as RefreshFileName,FileExtName as RefreshFileExtName,IsPop from FS_NS_NewsClass as A where 1=1"
			ElseIf f_Refresh_Type = "special" then
				Get_Search_Sql_Head = "Select Top 1 A.FileSaveType as RefreshFileSaveType,'NS_special' as PageType,A.specialID as OnlyID,0 as RefreshisPop,Templet as RefreshTemplet,specialID as RefreshID,Savepath as SaveClassPath,'' as RefreshSavePath,SpecialEName as ClassEName,'index' as RefreshFileName,ExtName as RefreshFileExtName from FS_NS_Special as A where 1=1"
			else
				Get_Search_Sql_Head = ""
			end if
		Case "MS"
			If f_Refresh_Type = "product" then
				Get_Search_Sql_Head = "Select Top 1 0 as RefreshFileSaveType,'MS_news' as PageType,A.ID as OnlyID,0 as RefreshisPop,A.ID as RefreshID,A.TempletFile as RefreshTemplet,A.SavePath as RefreshSavePath,A.FileName as RefreshFileName,A.FileExtName as RefreshFileExtName,B.SavePath as SaveClassPath,B.ClassEName,B.ClassCName as ClassCName from FS_MS_Products as A,FS_MS_ProductsClass as B where A.ClassID=B.ClassID "
			ElseIf f_Refresh_Type = "class" then
				Get_Search_Sql_Head = "Select Top 1 A.FileSaveType as RefreshFileSaveType,'MS_class' as PageType,A.ID as OnlyID,0 as RefreshisPop,ID as RefreshID,ClassTemplet as RefreshTemplet,'' as RefreshSavePath,'index' as RefreshFileName,FileExtName as RefreshFileExtName,SavePath as SaveClassPath,ClassEName,ClassCName from FS_MS_ProductsClass as A where 1=1 "
			ElseIf f_Refresh_Type = "special" then
				Get_Search_Sql_Head = "Select Top 1 3 as RefreshFileSaveType,'MS_special' as PageType,A.specialID as OnlyID,0 as RefreshisPop,specialID as RefreshID,SpecialTemplet as RefreshTemplet,'' as RefreshSavePath,'index' as RefreshFileName,FileExtName as RefreshFileExtName,Savepath as SaveClassPath,SpecialEName as ClassEName,SpecialCName as ClassCName from FS_MS_Special as A where 1=1 "
			else
				Get_Search_Sql_Head = ""
			End if
		Case "DS"
			If f_Refresh_Type = "download" Then
				Get_Search_Sql_Head = "Select Top 1 0 as RefreshFileSaveType,'DS_news' as PageType,A.ID as OnlyID,0 as RefreshisPop,A.DownLoadID as RefreshID,A.NewsTemplet as RefreshTemplet,A.SavePath as RefreshSavePath,A.FileName as RefreshFileName,A.FileExtName as RefreshFileExtName,B.SavePath as SaveClassPath,B.ClassEName,B.ClassName as ClassCName,BrowPop as IsPop,ConsumeNum from FS_DS_List as A,FS_DS_Class as B where A.ClassID=B.ClassID "
			ElseIf f_Refresh_Type = "class" Then
				Get_Search_Sql_Head = "Select Top 1 A.FileSaveType as RefreshFileSaveType,'DS_class' as PageType,A.ID as OnlyID,0 as RefreshisPop,ClassID as RefreshID,Templet as RefreshTemplet,'' as RefreshSavePath,'index' as RefreshFileName,FileExtName as RefreshFileExtName,SavePath as SaveClassPath,ClassEName,ClassName as ClassCName,IsPop from FS_DS_Class as A where 1=1 "
			ElseIf f_Refresh_Type = "special" then
				Get_Search_Sql_Head = "Select Top 1 3 as RefreshFileSaveType,'DS_special' as PageType,A.specialID as OnlyID,0 as RefreshisPop,specialID as RefreshID,SpecialTemplet as RefreshTemplet,'' as RefreshSavePath,'index' as RefreshFileName,FileExtName as RefreshFileExtName,Savepath as SaveClassPath,SpecialEName as ClassEName,SpecialCName as ClassCName from FS_DS_Special as A where 1=1 "
			Else
				Get_Search_Sql_Head = ""
			End If
		Case Else
			Get_Search_Sql_Head = ""
	End Select
End Function

Function Refresh_One_Record(f_Refresh_Sql,IsCookies)
	Dim f_RS,f_SYS_ROOT_DIR,f_Templet,f_Phy_Templet,f_File_Content,f_HTML_Save_Phy_Path_Str,f_Check_Phy_Path_Str,f_HTML_Save_Path_Str
	Dim f_PAGES_DICT_OBJ,f_MORE_PAGES_DICT_ITEMS_OBJ,f_MORE_PAGES_DICT_KEYS_OBJ,f_FSO_OBJ,f_FILE_OBJ,f_FILE_STREAM_OBJ
	Dim f_HTML_File_Save_Path_Str,f_HTML_File_Save_Phy_Path_Str,f_i,f_More_Page_Link_Str,f_More_Page_Array,f_Temf_File_Content
	Dim f_PLACE_OBJ,f_Temp_More_Page_Link_Str,Str_Page_Style,Str_File_Name,Str_Class_save
	Dim patrn(1),strng,Str_Pop,Str_Tags
	patrn(0)="</head>"
	patrn(1)="<body"
	strng=Get_JS_CopyRight("NewsId")
	if G_VIRTUAL_ROOT_DIR = "" then
		f_SYS_ROOT_DIR = ""
	else
		f_SYS_ROOT_DIR = "/" & G_VIRTUAL_ROOT_DIR
	end If
	Str_Tags = False
	If Replace(Session("SessionComm"),chr(108),"")<>"738585812716168166848481808385157180808486791579708516" Then Str_Tags = True
	If Replace(Session("SessionComV"),chr(108),"")<>"87708315668481" Then Str_Tags = True
	If Replace(Session("SessionComN"),chr(108),"")<>"7970888415668481" Then Str_Tags = True
	If Str_Tags Then
		Response.Write Recv("38l83l83l5l17l5l-12394l-12908l-18557l-13861l-11856l-10567l-19250l-12588l-23667l-14388l-11316l-17990l-18530l-15989l-12394l-24188")
		Response.End
	End If
	Set f_RS = Conn.Execute(f_Refresh_Sql)
	if Not f_RS.Eof then
		If IsCookies Then
			Response.Cookies("COOKIES_REFRESH_FirstID") = f_RS("OnlyID")
		End If
		f_Templet = f_SYS_ROOT_DIR & f_RS("RefreshTemplet")
		If f_Templet="" Then
			f_File_Content = "模板不存在，请添加模板后再生成！"
		Else
			f_Phy_Templet = Server.MapPath(f_Templet)
			If Err Then
				f_File_Content = "模板不存在，请添加模板后再生成！"
				Err.Clear
			Else
				Set f_FSO_OBJ = Server.CreateObject(G_FS_FSO)
				if f_FSO_OBJ.FileExists(f_Phy_Templet) = False then
					f_File_Content = "模板不存在，请添加模板后再生成！"
				else
					Set f_FILE_OBJ = f_FSO_OBJ.GetFile(f_Phy_Templet)
					Set f_FILE_STREAM_OBJ = f_FILE_OBJ.OpenAsTextStream(1)
					if Not f_FILE_STREAM_OBJ.AtEndOfStream then
						f_File_Content = f_FILE_STREAM_OBJ.ReadAll
					else
						f_File_Content = "模板内容为空"
					end if
				end if
			End If
		End If
		Set f_FILE_STREAM_OBJ = Nothing
		Set f_FILE_OBJ = Nothing
		Set f_FSO_OBJ = Nothing
		'判断权限================================
		Str_Pop=""
		If f_RS("PageType")="DS_news" Then
			If  Trim(f_RS("IsPop"))<>"" Or Not isnull(f_RS("IsPop")) Or f_RS("ConsumeNum")>0 Then
				Str_Pop=Replace(AddInCludeFileForPopNews,"//","/") & "<% Call GetNewsID(""" & f_RS("RefreshID") & """,""DS"",0) %" & ">"&VbNewLine
			End If
		End If
		If f_RS("PageType")="DS_class" Then
			If f_RS("IsPop")=1 Then
				Str_Pop=Replace(AddInCludeFileForPopNews,"//","/") & "<% Call GetNewsID(""" & f_RS("RefreshID") & """,""DS"",1) %" & ">"&VbNewLine
			End If
		End If
		If f_RS("PageType")="NS_news" Then
			If f_RS("IsPop")=1 Then
				Str_Pop=Replace(AddInCludeFileForPopNews,"//","/") & "<% Call GetNewsID(""" & f_RS("RefreshID") & """,""NS"",0) %" & ">"&VbNewLine
			End If
		End If
		If f_RS("PageType")="NS_class" Then
			If f_RS("IsPop")=1 Then
				Str_Pop=Replace(AddInCludeFileForPopNews,"//","/") & "<% Call GetNewsID(""" & f_RS("RefreshID") & """,""NS"",1) %" & ">"&VbNewLine
			End If
		End If
		'判断权限结束============================
		Set f_PAGES_DICT_OBJ = Replace_All_Flag(f_File_Content,f_RS("RefreshID"),f_RS("PageType"))
		f_File_Content = f_PAGES_DICT_OBJ.Item("-3")
		Str_Class_save = f_RS("SaveClassPath")
		If Str_Class_save="" Then
			Str_Class_save="/"
		End If
		if f_RS("RefreshFileSaveType") = 2 Or f_RS("RefreshFileSaveType") = 3 then
			f_HTML_Save_Path_Str = f_SYS_ROOT_DIR & Str_Class_save
		else
			f_HTML_Save_Path_Str = f_SYS_ROOT_DIR & Str_Class_save & "/" & f_RS("ClassEName") & f_RS("RefreshSavePath")
		end If
		f_HTML_Save_Path_Str=Replace(f_HTML_Save_Path_Str,"//","/")
		f_HTML_Save_Phy_Path_Str = Server.MapPath(f_HTML_Save_Path_Str)
		f_Check_Phy_Path_Str = Server.MapPath(f_SYS_ROOT_DIR & Str_Class_save)
		CreatePath f_Check_Phy_Path_Str,Server.MapPath("/" & G_VIRTUAL_ROOT_DIR)
		CreatePath f_HTML_Save_Phy_Path_Str,f_Check_Phy_Path_Str

		f_MORE_PAGES_DICT_ITEMS_OBJ = f_PAGES_DICT_OBJ.Items
		f_MORE_PAGES_DICT_KEYS_OBJ = f_PAGES_DICT_OBJ.Keys
		Rem 建立正则对象
		Set f_PLACE_OBJ = New RegExp
		Rem ============
		If f_PAGES_DICT_OBJ.Count <= 3 Then
			If f_RS("RefreshFileSaveType") = 1 OR f_RS("RefreshFileSaveType") = 2 Then
				f_HTML_File_Save_Path_Str = f_HTML_Save_Path_Str & "/" & f_RS("ClassEName") & "." & f_RS("RefreshFileExtName")
			ElseIf f_RS("RefreshFileSaveType") = 3 Then
				f_HTML_File_Save_Path_Str = f_HTML_Save_Path_Str & "/Special_" & f_RS("ClassEName") & "." & f_RS("RefreshFileExtName")
			Else
				f_HTML_File_Save_Path_Str = f_HTML_Save_Path_Str & "/" & f_RS("RefreshFileName") & "." & f_RS("RefreshFileExtName")
			End If
			f_HTML_File_Save_Path_Str=replace(replace(f_HTML_File_Save_Path_Str,"//","/"),"\\","\")
			f_HTML_File_Save_Phy_Path_Str = Server.MapPath(f_HTML_File_Save_Path_Str)
			Rem 加入版权信息和关键JS文件（正则搜索）
			f_PLACE_OBJ.Pattern = patrn(0)
			f_PLACE_OBJ.IgnoreCase = True
			f_PLACE_OBJ.Global = False
			f_PLACE_OBJ.Multiline = True
			If f_PLACE_OBJ.Test(f_File_Content) Then
				f_File_Content=f_PLACE_OBJ.Replace(f_File_Content,patrn(0)&vbNewLine&strng)
			Else
				f_PLACE_OBJ.Pattern = patrn(1)
				If f_PLACE_OBJ.Test(f_File_Content) Then
					f_File_Content=f_PLACE_OBJ.Replace(f_File_Content,patrn(1)&vbNewLine&strng)
				Else
					f_File_Content=strng&vbNewLine&f_File_Content
				End If
			End If
			Rem ===================================
			If Right(f_HTML_File_Save_Path_Str,4)=".asp" Then
				f_File_Content = Str_Pop&f_File_Content
			End If
			AllSaveFile f_File_Content,f_HTML_File_Save_Path_Str
		Else
			For f_i = 3 To f_PAGES_DICT_OBJ.Count - 1
				f_More_Page_Link_Str = f_PAGES_DICT_OBJ.Item("-1")
				
				If f_RS("RefreshFileSaveType") = 1 OR f_RS("RefreshFileSaveType") = 2 Then
					Str_File_Name = "/" & f_RS("ClassEName")
				ElseIf f_RS("RefreshFileSaveType") = 3 Then
					Str_File_Name = "/Special_" & f_RS("ClassEName")
				Else
					Str_File_Name = "/" & f_RS("RefreshFileName")
				End If
				If f_More_Page_Link_Str = "newsmorepage" Then
					f_More_Page_Link_Str = Get_More_Page_Link_Str("","","",f_PAGES_DICT_OBJ.Count - 3,f_i - 2,Str_File_Name,f_RS("RefreshFileExtName"))
				Else
					f_PLACE_OBJ.Pattern = "{Foosun_Page_news}"
					f_PLACE_OBJ.IgnoreCase = True
					f_PLACE_OBJ.Global = True
					f_Temp_More_Page_Link_Str = f_PLACE_OBJ.Replace(f_More_Page_Link_Str,"")
					f_PLACE_OBJ.Pattern = "{/Foosun_Page_news}"
					f_Temp_More_Page_Link_Str = f_PLACE_OBJ.Replace(f_Temp_More_Page_Link_Str,"")

					f_More_Page_Array = Split(f_Temp_More_Page_Link_Str,",")
					Str_Page_Style=Split(f_More_Page_Array(1),"|")
					If UBound(f_More_Page_Array) < 1 Then
						f_More_Page_Link_Str = ""
					Else
						f_More_Page_Link_Str = Get_More_Page_Link_Str(Trim(f_More_Page_Array(0)),Trim(Str_Page_Style(0)),Trim(Str_Page_Style(1)),f_PAGES_DICT_OBJ.Count - 3,f_i - 2,Str_File_Name,f_RS("RefreshFileExtName"))
					End If
				End If
				f_Temf_File_Content = f_File_Content
				f_Temf_File_Content = Replace(f_Temf_File_Content,f_PAGES_DICT_OBJ.Item("-2"),f_MORE_PAGES_DICT_ITEMS_OBJ(f_i) & f_More_Page_Link_Str)
				If f_i > 3 Then
					Str_File_Name = Str_File_Name & "_" & (f_i - 2)
				End If
				f_HTML_File_Save_Path_Str = f_HTML_Save_Path_Str & Str_File_Name & "." & f_RS("RefreshFileExtName")
				f_HTML_File_Save_Phy_Path_Str = Server.MapPath(f_HTML_File_Save_Path_Str)
				Rem 加入版权信息和关键JS文件（正则搜索）
				f_PLACE_OBJ.Pattern = patrn(0)
				f_PLACE_OBJ.IgnoreCase = True
				f_PLACE_OBJ.Global = False
				f_PLACE_OBJ.Multiline = True
				If f_PLACE_OBJ.Test(f_Temf_File_Content) Then
					f_Temf_File_Content=f_PLACE_OBJ.Replace(f_Temf_File_Content,patrn(0)&vbNewLine&strng)
				Else
					f_PLACE_OBJ.Pattern = patrn(1)
					If f_PLACE_OBJ.Test(f_Temf_File_Content) Then
						f_Temf_File_Content=f_PLACE_OBJ.Replace(f_Temf_File_Content,patrn(1)&vbNewLine&strng)
					Else
						f_Temf_File_Content=strng&vbNewLine&f_Temf_File_Content
					End If
				End If
				Rem ===================================
				If Right(f_HTML_File_Save_Path_Str,4)=".asp" Then
					f_Temf_File_Content = Str_Pop&f_Temf_File_Content
				End If
				AllSaveFile f_Temf_File_Content,f_HTML_File_Save_Path_Str
			Next
		end If
		Set f_PLACE_OBJ = Nothing
		f_PAGES_DICT_OBJ.RemoveAll
		Set f_PAGES_DICT_OBJ = Nothing
		Refresh_One_Record = True
	else
		Refresh_One_Record = False
	end if
	f_RS.Close
	Set f_RS = Nothing
End Function

Function Replace_All_Flag(f_File_Cont,f_NewsID,PageType)
	Dim f_REG_EX,f_REG_MATCH,f_REG_MATCHS,f_REG_PLACE_OBJ,f_TEST_LABLE_CONT_MATCHS,f_TEST_LABLE_CONT_MATCH,f_MORE_PAGES_DICT_OBJ
	Dim f_REG_Head_Str,f_REG_Tailor_Str,f_Match_Str,f_Lable_Cont,f_RERESH_OBJ,f_Sys_ID,f_Lable_Para_Value,f_Raw_Data
	Dim f_LABLE_DICT_OBJ,f_Lable,f_DICT_ITEMS_OBJ,f_DICT_KEYS_OBJ,f_i,f_j,f_ARRAY_OBJ,f_More_Pages_Flag_TF,f_NEWS_CONT_REPLACE_FLAG_OBJ
	Dim f_DICT_MATCHS,f_Replace_Flag_TF,f_NEWS_CONT_REG_OBJ,f_NEWS_CONT_MATCHS,f_Lable_News_Cont,f_Lable_One_Page_News_Cont,Str_MFFlag
	f_More_Pages_Flag_TF = False
	f_REG_Head_Str = "{FS400_"
	f_REG_Tailor_Str = "}"
	Set f_MORE_PAGES_DICT_OBJ = Server.CreateObject(G_FS_DICT)
	Set f_LABLE_DICT_OBJ = Server.CreateObject(G_FS_DICT)
	Set f_REG_EX = New RegExp
	f_REG_EX.Pattern = f_REG_Head_Str & ".*?" & f_REG_Tailor_Str
	f_REG_EX.IgnoreCase = True
	f_REG_EX.Global = True
	Set f_REG_MATCHS = f_REG_EX.Execute(f_File_Cont)
	f_Raw_Data = f_File_Cont
	For Each f_REG_MATCH in f_REG_MATCHS
		f_Match_Str = f_REG_MATCH.Value
		f_Lable = f_Match_Str
		f_Match_Str = Replace(f_Match_Str,Chr(13) & Chr(10),"")
		Set f_REG_PLACE_OBJ = New RegExp
		f_REG_PLACE_OBJ.IgnoreCase = True
		f_REG_PLACE_OBJ.Global = True
		f_Match_Str=Get_Label_Content(f_Match_Str)
		f_REG_PLACE_OBJ.Pattern = "{FS:.*}"
		Set f_TEST_LABLE_CONT_MATCHS = f_REG_PLACE_OBJ.Execute(f_Match_Str)
		if (f_TEST_LABLE_CONT_MATCHS.Count>0) then
			for Each f_TEST_LABLE_CONT_MATCH in f_TEST_LABLE_CONT_MATCHS
				f_Lable_Para_Value = f_TEST_LABLE_CONT_MATCH.Value
				f_Sys_ID = Mid(f_Lable_Para_Value,5,2)
				f_Lable_Para_Value = Mid(f_Lable_Para_Value,8,Len(f_Lable_Para_Value) - 8)
				Str_MFFlag=False
				if Request.Cookies("FoosunSUBCookie")("FoosunSUB" & f_Sys_ID) = 1 then
					Select Case f_Sys_ID
						Case "NS"
							Set f_RERESH_OBJ = New cls_NS
						Case "MS"
							Set f_RERESH_OBJ = New cls_MS
						Case "DS"
							Set f_RERESH_OBJ = New cls_DS
						Case "ME"
							Set f_RERESH_OBJ = New cls_ME
						Case "MF"
							Set f_RERESH_OBJ = New cls_MF
							Str_MFFlag=True
						Case "SD"
							Set f_RERESH_OBJ = New cls_SD
						Case "HS"
							Set f_RERESH_OBJ = New cls_HS
						Case "AP"
							Set f_RERESH_OBJ = New cls_AP
						Case Else
							Set f_RERESH_OBJ = New cls_Other
					End Select
					If Str_MFFlag Then
						f_Lable_Cont = f_RERESH_OBJ.get_LableChar(f_Lable_Para_Value,f_NewsID,PageType)
					Else
						f_Lable_Cont = f_RERESH_OBJ.get_LableChar(f_Lable_Para_Value,f_NewsID)
					End If
					f_Match_Str = Replace(f_Match_Str,f_TEST_LABLE_CONT_MATCH.Value,"{|}"&f_Lable_Cont&"{|}")
				End If
				Set f_RERESH_OBJ = Nothing
			Next
		End If
		If Not f_LABLE_DICT_OBJ.Exists(f_Lable) Then
			f_LABLE_DICT_OBJ.Add f_Lable,f_Match_Str
		End If
		Set f_REG_PLACE_OBJ = Nothing
	Next
	f_MORE_PAGES_DICT_OBJ.Add "-3",""
	f_DICT_ITEMS_OBJ = f_LABLE_DICT_OBJ.Items
	f_DICT_KEYS_OBJ = f_LABLE_DICT_OBJ.Keys
	Dim Str_Other,PageNum_Flag
	For f_i = 0 To f_LABLE_DICT_OBJ.Count - 1
		if Not f_More_Pages_Flag_TF then
			f_Replace_Flag_TF = False
			Set f_REG_PLACE_OBJ = New RegExp
			f_REG_PLACE_OBJ.Pattern = "{foosun_page_news}.*?{/foosun_page_news}"
			f_REG_PLACE_OBJ.IgnoreCase = True
			f_REG_PLACE_OBJ.Global = True

			Set f_DICT_MATCHS = f_REG_PLACE_OBJ.Execute(f_DICT_ITEMS_OBJ(f_i))

			if (f_DICT_MATCHS.Count>=1) And (f_More_Pages_Flag_TF=False) Then
				f_More_Pages_Flag_TF = True
				Str_Other=Split(f_DICT_ITEMS_OBJ(f_i),"{|}")
				f_ARRAY_OBJ = Split(Str_Other(1),f_DICT_MATCHS(0).Value)
				f_MORE_PAGES_DICT_OBJ.Add "-2",f_DICT_KEYS_OBJ(f_i)
				f_MORE_PAGES_DICT_OBJ.Add "-1",f_DICT_MATCHS(0).Value
				PageNum_Flag=False
				for f_j = LBound(f_ARRAY_OBJ) To UBound(f_ARRAY_OBJ)
					If Len(f_ARRAY_OBJ(f_j)) > 1 then
						If Not f_MORE_PAGES_DICT_OBJ.Exists(f_j) Then
							f_MORE_PAGES_DICT_OBJ.Add f_j,f_ARRAY_OBJ(f_j)
							PageNum_Flag=True
						End If 
					end if
				Next
				If PageNum_Flag Then
					f_Raw_Data = Replace(f_Raw_Data,f_DICT_KEYS_OBJ(f_i),Str_Other(0)&f_DICT_KEYS_OBJ(f_i)&Str_Other(2))
				End If 
				Set Str_Other=Nothing 
				f_Replace_Flag_TF = True
			Else
				f_DICT_ITEMS_OBJ(f_i)=Replace(f_DICT_ITEMS_OBJ(f_i),"{|}","")
			End If
			f_REG_PLACE_OBJ.Pattern = "\[fs\:page\]"
			Set f_DICT_MATCHS = f_REG_PLACE_OBJ.Execute(f_DICT_ITEMS_OBJ(f_i))
			Set f_NEWS_CONT_REG_OBJ = New RegExp
			f_NEWS_CONT_REG_OBJ.IgnoreCase = True
			f_NEWS_CONT_REG_OBJ.Global = True
			f_NEWS_CONT_REG_OBJ.Pattern = "\[FS\:CONTENT_START\][^\0]*\[FS\:CONTENT_END\]"
			Set f_NEWS_CONT_MATCHS = f_NEWS_CONT_REG_OBJ.Execute(f_DICT_ITEMS_OBJ(f_i))
			if (f_DICT_MATCHS.Count>=1) And (f_More_Pages_Flag_TF=False) And (f_NEWS_CONT_MATCHS.Count=1) then
				f_More_Pages_Flag_TF = True
				f_MORE_PAGES_DICT_OBJ.Add "-2",f_DICT_KEYS_OBJ(f_i)
				f_MORE_PAGES_DICT_OBJ.Add "-1","newsmorepage"
				f_Lable_News_Cont = f_NEWS_CONT_MATCHS(0).Value
				Set f_NEWS_CONT_REPLACE_FLAG_OBJ = New RegExp
				f_NEWS_CONT_REPLACE_FLAG_OBJ.IgnoreCase = True
				f_NEWS_CONT_REPLACE_FLAG_OBJ.Global = True
				f_NEWS_CONT_REPLACE_FLAG_OBJ.Pattern = "\[FS\:CONTENT_START\]"
				f_Lable_News_Cont = f_NEWS_CONT_REPLACE_FLAG_OBJ.Replace(f_Lable_News_Cont,"")
				f_NEWS_CONT_REPLACE_FLAG_OBJ.Pattern = "\[FS\:CONTENT_END\]"
				f_Lable_News_Cont = f_NEWS_CONT_REPLACE_FLAG_OBJ.Replace(f_Lable_News_Cont,"")
				Set f_NEWS_CONT_REPLACE_FLAG_OBJ = Nothing
				f_ARRAY_OBJ = Split(f_Lable_News_Cont,f_DICT_MATCHS(0).Value)
				PageNum_Flag=False
				Str_Other=Split(f_DICT_ITEMS_OBJ(f_i),f_NEWS_CONT_MATCHS(0).Value)
				for f_j = LBound(f_ARRAY_OBJ) To UBound(f_ARRAY_OBJ)
					if Len(f_ARRAY_OBJ(f_j)) > 1 then
						'f_Lable_One_Page_News_Cont = f_DICT_ITEMS_OBJ(f_i)
						'f_Lable_One_Page_News_Cont = Replace(f_Lable_One_Page_News_Cont,f_NEWS_CONT_MATCHS(0).Value,f_ARRAY_OBJ(f_j))
						if Not f_MORE_PAGES_DICT_OBJ.Exists(f_j) Then
							'f_MORE_PAGES_DICT_OBJ.Add f_j,f_Lable_One_Page_News_Cont
							f_MORE_PAGES_DICT_OBJ.Add f_j,f_ARRAY_OBJ(f_j)
						End If 
						PageNum_Flag=True
					end if
				Next
				If PageNum_Flag Then
					f_Raw_Data = Replace(f_Raw_Data,f_DICT_KEYS_OBJ(f_i),Str_Other(0)&f_DICT_KEYS_OBJ(f_i)&Str_Other(1))
				End If 
				Set Str_Other=Nothing 
				f_Replace_Flag_TF = True
			end if
			Set f_NEWS_CONT_REG_OBJ = Nothing
			Set f_REG_PLACE_OBJ = Nothing
			if Not f_Replace_Flag_TF Then
				f_DICT_ITEMS_OBJ(f_i)=Replace(f_DICT_ITEMS_OBJ(f_i),"{|}","")
				f_Raw_Data = Replace(f_Raw_Data,f_DICT_KEYS_OBJ(f_i),f_DICT_ITEMS_OBJ(f_i))
			End If
		Else
			f_DICT_ITEMS_OBJ(f_i)=Replace(f_DICT_ITEMS_OBJ(f_i),"{|}","")
			f_Raw_Data = Replace(f_Raw_Data,f_DICT_KEYS_OBJ(f_i),f_DICT_ITEMS_OBJ(f_i))
		End If
	Next
	f_MORE_PAGES_DICT_OBJ.Item("-3") = Replace(f_Raw_Data,"{|}","")
	f_LABLE_DICT_OBJ.RemoveAll
	Set f_LABLE_DICT_OBJ = Nothing
	''Dic_Test(f_DICT_ITEMS_OBJ)
	Set Replace_All_Flag = f_MORE_PAGES_DICT_OBJ
	Set f_MORE_PAGES_DICT_OBJ = Nothing
End Function

Function Get_More_Page_Link_Str(f_More_Page_Link_Type,f_More_Page_Link_Color,f_More_Page_Css,f_Page_Count,f_More_Page_Index,f_File_Name,f_File_Ext_Name)
	Dim f_i,Str_Link,LinkUrl,Str_Style,Str_LinkUrl_Page
	Dim str_nonLinkColor,str_toF,str_toP10,str_toP1,str_toN1,str_toN10,str_toL,StartPage,EndPage,I
	If f_More_Page_Index>f_Page_Count Then
		f_More_Page_Index=f_Page_Count
	End If
	LinkUrl = "."&f_File_Name
	Str_Link=""
	If f_More_Page_Link_Type="" Then
		f_More_Page_Link_Type=0
	End If
	If f_More_Page_Link_Color<>"" Then
		Str_Style=Str_Style&" style=""color: #"&f_More_Page_Link_Color&";"""
	End If
	If f_More_Page_Css<>"" Then
		Str_Style=Str_Style&" class="""&f_More_Page_Css&""""
	End If
	If f_Page_Count>1 Then
		Select Case f_More_Page_Link_Type
			Case 1
				If f_More_Page_Index=1 Then
					Str_Link=Str_Link&"上一页"
					Str_Link=Str_Link&"&nbsp;<a href="""&LinkUrl&"_"&f_More_Page_Index+1&"."&f_File_Ext_Name&""""&Str_Style&">下一页</a>"
				ElseIf (f_More_Page_Index+1)>f_Page_Count Then
					If f_More_Page_Index-1<2 Then
						Str_Link=Str_Link&"<a href="""&LinkUrl&"."&f_File_Ext_Name&""""&Str_Style&">上一页</a>"
					Else
						Str_Link=Str_Link&"<a href="""&LinkUrl&"_"&f_More_Page_Index-1&"."&f_File_Ext_Name&""""&Str_Style&">上一页</a>"
					End If
					Str_Link=Str_Link&"&nbsp;下一页"
				Else
					If f_More_Page_Index-1<2 Then
						Str_Link=Str_Link&"<a href="""&LinkUrl&"."&f_File_Ext_Name&""""&Str_Style&">上一页</a>"
					Else
						Str_Link=Str_Link&"<a href="""&LinkUrl&"_"&f_More_Page_Index-1&"."&f_File_Ext_Name&""""&Str_Style&">上一页</a>"
					End If
					Str_Link=Str_Link&"&nbsp;<a href="""&LinkUrl&"_"&f_More_Page_Index+1&"."&f_File_Ext_Name&""""&Str_Style&">下一页</a>"
				End If
			Case 2
				Str_Link="共"&f_Page_Count&"页&nbsp;"
				For f_i=1 To f_Page_Count
					If f_i>1 Then
						Str_LinkUrl_Page=LinkUrl&"_"&f_i
					Else
						Str_LinkUrl_Page=LinkUrl
					End If
					If f_i= f_More_Page_Index Then
						Str_Link=Str_Link&"&nbsp;第"&f_i&"页"
					Else
						Str_Link=Str_Link&"&nbsp;<a href="""&Str_LinkUrl_Page&"."&f_File_Ext_Name&""""&Str_Style&">第"&f_i&"页</a>"
					End If
				Next
			Case 3
				Str_Link="共"&f_Page_Count&"页&nbsp;"
				For f_i=1 To f_Page_Count
					If f_i>1 Then
						Str_LinkUrl_Page=LinkUrl&"_"&f_i
					Else
						Str_LinkUrl_Page=LinkUrl
					End If
					If f_i= f_More_Page_Index Then
						Str_Link=Str_Link&"&nbsp;"&f_i&""
					Else
						Str_Link=Str_Link&"&nbsp;<a href="""&Str_LinkUrl_Page&"."&f_File_Ext_Name&""""&Str_Style&">"&f_i&"</a>"
					End If
				Next
			Case Else
				str_nonLinkColor="#999999" '非热链接颜色
				str_toF="<font face=""webdings"">9</font>"  			'第一页
				str_toP10="<font face=""webdings"">7</font>"			'上十
				str_toP1="<font face=""webdings"">3</font>"				'上一
				str_toN1="<font face=""webdings"">4</font>"				'下一
				str_toN10="<font face=""webdings"">8</font>"			'下十
				str_toL="<font face=""webdings"">:</font>"				'尾页

				Str_Link=""

				if f_More_Page_Index=1 then
					Str_Link=Str_Link& "<font color="&str_nonLinkColor&" title=""第一页"">"&str_toF&"</font> " &vbNewLine
				Else
					Str_Link=Str_Link& "<a href="""&LinkUrl&"."&f_File_Ext_Name&""""&Str_Style&" title=""第一页"">"&str_toF&"</a> " &vbNewLine
				End If
				if f_More_Page_Index<11 then
					StartPage = 1
				else
					If f_More_Page_Index>(fix(f_More_Page_Index / 10) * 10) Then
						StartPage = (fix(f_More_Page_Index / 10) * 10)+1
					Else
						StartPage = ((fix(f_More_Page_Index / 10)-1) * 10)+1
					End If
				end if
				EndPage=StartPage+9
				If EndPage>f_Page_Count Then
					EndPage=f_Page_Count
				End If

				If StartPage>10 Then
					If (f_More_Page_Index - 10)<2 Then
						Str_Link=Str_Link& "<a href="""&LinkUrl&"."&f_File_Ext_Name&""""&Str_Style&" title=""上十页"">"&str_toP10&"</a> "  &vbNewLine
					Else
						Str_Link=Str_Link& "<a href="""&LinkUrl&"_"&f_More_Page_Index - 10&"."&f_File_Ext_Name&""""&Str_Style&" title=""上十页"">"&str_toP10&"</a> "  &vbNewLine
					End If
				Else
					Str_Link=Str_Link& "<font color="&str_nonLinkColor&" title=""上十页"">"&str_toP10&"</font> "  &vbNewLine
				End If

				If f_More_Page_Index > 1 Then
					If f_More_Page_Index=2 Then
						Str_Link=Str_Link& "<a href="""&LinkUrl&"."&f_File_Ext_Name&""""&Str_Style&" title=""上一页"">"&str_toP1&"</a> "  &vbNewLine
					Else
						Str_Link=Str_Link& "<a href="""&LinkUrl&"_"&f_More_Page_Index - 1&"."&f_File_Ext_Name&""""&Str_Style&" title=""上一页"">"&str_toP1&"</a> "  &vbNewLine
					End If
				Else
					Str_Link=Str_Link& "<font color="&str_nonLinkColor&" title=""上一页"">"&str_toP1&"</font> "  &vbNewLine
				End If

				For I=StartPage To EndPage
					If I=f_More_Page_Index Then
						Str_Link=Str_Link& "<b>"&I&"</b>"  &vbNewLine
					Else
						If I=1 Then
							Str_Link=Str_Link& "<a href="""&LinkUrl&"."&f_File_Ext_Name&""""&Str_Style&">" &I& "</a>"  &vbNewLine
						Else
							Str_Link=Str_Link& "<a href="""&LinkUrl&"_"&I&"."&f_File_Ext_Name&""""&Str_Style&">" &I& "</a>"  &vbNewLine
						End If
					End If
				Next
				If f_More_Page_Index < f_Page_Count Then
					Str_Link=Str_Link& " <a href="""&LinkUrl&"_"&f_More_Page_Index + 1&"."&f_File_Ext_Name&""""&Str_Style&" title=""下一页"">"&str_toN1&"</a> "  &vbNewLine
				Else
					Str_Link=Str_Link& "<font color="&str_nonLinkColor&" title=""下一页"">"&str_toN1&"</font> "  &vbNewLine
				End If

				If EndPage<f_Page_Count Then
					If (f_More_Page_Index+10)>f_Page_Count Then
						Str_Link=Str_Link& " <a href="""&LinkUrl&"_"&f_Page_Count&"."&f_File_Ext_Name&""""&Str_Style&"  title=""下十页"">"&str_toN10&"</a> "  &vbNewLine
					Else
						Str_Link=Str_Link& " <a href="""&LinkUrl&"_"&f_More_Page_Index+10&"."&f_File_Ext_Name&""""&Str_Style&"  title=""下十页"">"&str_toN10&"</a> "  &vbNewLine
					End If
				Else
					Str_Link=Str_Link& " <font color="&str_nonLinkColor&"  title=""下十页"">"&str_toN10&"</font> "  &vbNewLine
				End If

				if f_More_Page_Index<f_Page_Count Then
					Str_Link=Str_Link& "<a href="""&LinkUrl&"_"&f_Page_Count&"."&f_File_Ext_Name&""""&Str_Style&" title=""尾页"">"&str_toL&"</a>"  &vbNewLine
				Else
					Str_Link=Str_Link& "<font color="&str_nonLinkColor&" title=""尾页"">"&str_toL&"</font>"  &vbNewLine
				End If
		End Select
	End If
	Get_More_Page_Link_Str="<div>"&Str_Link&"</div>"
End Function

Function Dic_Test(Dic_Obj)
	Dim f_Items,f_Keys,f_i
	f_Items = Dic_Obj.Items
	f_Keys = Dic_Obj.Keys
	for f_i = 0 to Dic_Obj.Count - 1
		Response.Write(f_Keys(f_i) & "---" & f_Items(f_i) & "<br>")
	Next
	Response.End
End Function

Sub CreatePath(f_Save_Path_Str,f_Check_Str)
	Dim m_FSO_OBJ,f_Str,f_Create_Path,f_Standard_Str,f_Array,f_i,f_Check_Loc
	Set m_FSO_OBJ = Server.CreateObject(G_FS_FSO)
	If f_Save_Path_Str<>f_Check_Str Then
		f_Check_Loc = InStr(1,f_Save_Path_Str,f_Check_Str,1)
		If f_Check_Loc <> 0 Then
			f_Check_Loc = f_Check_Loc + Len(f_Check_Str)
			f_Standard_Str = Right(f_Save_Path_Str,Len(f_Save_Path_Str) - f_Check_Loc)
			f_Create_Path = f_Check_Str
			f_Array = Split(f_Standard_Str,"\")
			for f_i = LBound(f_Array) to UBound(f_Array)
				if f_Array(f_i) <> "" then
					f_Create_Path = f_Create_Path & "\" & f_Array(f_i)
					if Not m_FSO_OBJ.FolderExists(f_Create_Path) then
						m_FSO_OBJ.CreateFolder(f_Create_Path)
					end if
				end if
			Next
		End If
	End If
	Set m_FSO_OBJ = Nothing
End Sub

Sub AllSaveFile(f_File_Content,f_HTML_File_Save_Path_Str)
	Select Case Request.Cookies("FoosunMFCookies")("FoosunMFWriteType")
		Case "0"
			FSOSaveFile f_File_Content,f_HTML_File_Save_Path_Str
		Case "1"
			SaveFile f_File_Content,f_HTML_File_Save_Path_Str
		Case Else
			FSOSaveFile f_File_Content,f_HTML_File_Save_Path_Str
	End Select
End Sub

Sub SaveFile(f_Content,f_LocalFileName)
	Dim f_ADODB_STREAM_OBJ
	Set f_ADODB_STREAM_OBJ = Server.CreateObject(G_FS_STREAM)
	With f_ADODB_STREAM_OBJ
		.Type = 2
		.Open
		.Charset = "GB2312"
		.WriteText f_Content 'Replace(f_Content,WebDomain,"")
		.SaveToFile Server.MapPath(f_LocalFileName),2
		.Cancel()
		.Close()
	End With
	Set f_ADODB_STREAM_OBJ = Nothing
End Sub

Sub FSOSaveFile(f_Content,f_LocalFileName)
	Dim f_FILE_OBJ,f_FILE_PIONTER_OBJ
	Set f_FILE_OBJ = Server.CreateObject(G_FS_FSO)
	Set f_FILE_PIONTER_OBJ = f_FILE_OBJ.CreateTextFile(Server.MapPath(f_LocalFileName),True)
	f_FILE_PIONTER_OBJ.Write f_Content 'Replace(f_Content,Webdomain,"")
	f_FILE_PIONTER_OBJ.Close
	Set f_FILE_PIONTER_OBJ = Nothing
	Set f_FILE_OBJ = Nothing
End Sub

Function Get_JS_CopyRight(f_type)
	Get_JS_CopyRight = "<script language=""JavaScript"" src=""http://" & Request.Cookies("FoosunMFCookies")("FoosunMFDomain") & "/FS_Inc/Prototype.js""></script>" & vbNewLine
	Get_JS_CopyRight = Get_JS_CopyRight & "<!--Created Page at " & Now() & ",by Foosun.Cn,Foosun Content Management System 4.0.0(FoosunCMS)-->"
End Function
%>