<%
'**************************************
'* 最后更新 2012-04-13 by 56770.kingdge
'* Copyright www.56770.com
'**************************************
Function NewsMain(DateFormat)
		Dim strFile,RLoadStyle(7),LoadNewsMain,TmpLoadNewsMain,LoadNewsMain_s,TmpLoadNewsMain_s
		Dim url,rs,sql,i,App_NewsMain,DataCount,i_s,App_NewsMain_s,DataCount_s,icon_top,icon_pic
		strFile = Eshop_url& Style_Folder &"Lebi.NewsMain."
		RLoadStyle(0) = splits(LoadStyle(strFile&"0.style"))
		RLoadStyle(1) = splits(LoadStyle(strFile&"1.style"))
		RLoadStyle(2) = splits(LoadStyle(strFile&"2.style"))
		RLoadStyle(3) = splits(LoadStyle(strFile&"3.style"))
		RLoadStyle(4) = splits(LoadStyle(strFile&"4.style"))
		RLoadStyle(5) = splits(LoadStyle(strFile&"5.style"))
		RLoadStyle(6) = splits(LoadStyle(strFile&"6.style"))
		RLoadStyle(7) = splits(LoadStyle(strFile&"7.style"))
		NewsMain = RLoadStyle(0)
		cache.name="NewsMain"& LangTxt
		cache.reloadtime= 5000
		If cache.objisempty() Then
				sql="select classname"& LangTxt &",classid,n_foldername,n_filename from [Lebi_newsclass] where parentid = 0 order by b_order desc"
				set rs = conn.execute(sql)
				If rs.eof Then
				        cache.value = ""
						cache.DataCount = 0
				Else
				        cache.value = rs.getrows
						cache.DataCount = 1
				End If
				rs.close : Set rs = Nothing
		End If
		App_NewsMain = cache.value
		DataCount = cache.DataCount
        if DataCount = 1 Then
                For i = 0 To UBound(App_NewsMain,2)
				        LoadNewsMain = ""
						LoadNewsMain = LoadNewsMain & RLoadStyle(2)
						Select Case show_html
							   Case "0"
									Select Case ISAPI_Rewrite
										   Case "0"
												Select Case Config_Lebi_Eshop(16)
													   Case "0" : url = "zhuanti.asp?action=news_class&classid="& App_NewsMain(1,i)
													   Case "1" : url = "news/"& App_NewsMain(2,i) &"/"
													   Case "2" : url = "news/"& App_NewsMain(2,i) &"/default.asp"
												End Select
										   Case "1" url = "news_class-"& App_NewsMain(1,i) &".html"
									End Select
							   Case "1" : url = Folder(1) & App_NewsMain(3,i)&".1."& Sys_Ext
						End Select
						cache.name="NewsMain_s"& LangTxt & App_NewsMain(1,i)
						cache.reloadtime= 5000
						If cache.objisempty() Then
						        sql="select top 10 id,title"& LangTxt &",infotime,n_tj,pic,strcolor,n_filename from [Lebi_news] where"
								If IsSqlDataBase = 1 Then sql = sql &" charindex(',"&App_NewsMain(1,i)&",',classid)>0"
								If IsSqlDataBase = 0 Then sql = sql &" instr(classid,',"&App_NewsMain(1,i)&",')>0"
								sql = sql &" order by n_tj desc,infotime desc,id desc"
						        set Rs = conn.execute(Sql)
						        If rs.eof Then
										cache.value = ""
										cache.DataCount = 0
								Else
										cache.value = rs.getrows
										cache.DataCount = 1
								End If
								rs.close : Set rs = Nothing
						End If
						App_NewsMain_s = cache.value
						DataCount_s = cache.DataCount
						if DataCount_s = 1 Then
								For i_s = 0 To UBound(App_NewsMain_s,2)
										LoadNewsMain_s = RLoadStyle(3)
										If App_NewsMain_s(3,i_s) = 1 Then
												icon_top = RLoadStyle(6)
										Else
												icon_top = ""
										End If
										If App_NewsMain_s(4,i_s) = "1" Then
												icon_pic = RLoadStyle(7)
										Else
												icon_pic = ""
										End If
										ReplaceStyle "top",icon_top,LoadNewsMain_s
										ReplaceStyle "pic",icon_pic,LoadNewsMain_s
										Select Case show_html
											   Case "0"
													Select Case ISAPI_Rewrite
														   Case "0"
																Select Case Config_Lebi_Eshop(16)
																	   Case "0" : ReplaceStyle "url",LangPath & "zhuanti.asp?action=news_list&id="& App_NewsMain_s(0,i_s),LoadNewsMain_s
																	   Case "1" : ReplaceStyle "url",LangPath & "news/list/?id="& App_NewsMain_s(0,i_s),LoadNewsMain_s
																	   Case "2" : ReplaceStyle "url",LangPath & "news/list/default.asp?id="& App_NewsMain_s(0,i_s),LoadNewsMain_s
																End Select
														   Case "1" ReplaceStyle "url",LangPath & "news_list-"& App_NewsMain_s(0,i_s) &".html",LoadNewsMain_s
													End Select
											   Case "1" : ReplaceStyle "url",LangPath & Folder(1)&"info/"&App_NewsMain_s(6,i_s)&"."& Sys_Ext,LoadNewsMain_s
										End Select
										ReplaceStyle "title",App_NewsMain_s(1,i_s),LoadNewsMain_s
										ReplaceStyle "color",App_NewsMain_s(5,i_s),LoadNewsMain_s
										ReplaceStyle "cut_title",Cutchar(App_NewsMain_s(1,i_s),22),LoadNewsMain_s
										ReplaceStyle "time",Formatdate(App_NewsMain_s(2,i_s),DateFormat),LoadNewsMain_s
										ReplaceStyle "loop_num",i_s+1,LoadNewsMain_s
										TmpLoadNewsMain_s = TmpLoadNewsMain_s & LoadNewsMain_s
								Next
						Else
								TmpLoadNewsMain_s = RLoadStyle(1)
						End If
						ReplaceStyle "name",App_NewsMain(0,i),LoadNewsMain
						ReplaceStyle "url",LangPath & url,LoadNewsMain
						LoadNewsMain = LoadNewsMain & TmpLoadNewsMain_s & RLoadStyle(4)
						TmpLoadNewsMain_s = ""
						TmpLoadNewsMain = TmpLoadNewsMain & LoadNewsMain
                Next
        End If
	    NewsMain = NewsMain & TmpLoadNewsMain & RLoadStyle(5)
End Function
Showpath = "<a href='"& Eshop_url & LangPath &"'>"& Lebi_word(0) &"</a> → <a href='"& Eshop_url & url_7 &"'>"& Lebi_word(18) &"</a>"
If LCase(request("action")) = "news_class" Then
%>
<!--#include file="Item_news_class.asp"-->
<%
End If
If request("action") = "news_list" Then
%>
<!--#include file="Item_news_list.asp"-->
<%
End If
%>