<%
'	************************************************************************
'	* ASP-Nuke: Free web portal in ASP                                     *
'	************************************************************************
'	* Copyright (c) 2002-2003 by Gaetan Bouveret (webmaster@asp-nuke.net)  *
'	* http://www.asp-nuke.net                                              *
'	*                                                                      *
'	* This program is free software. You can redistribute it and/or modify *
'	* it under the terms of the GNU General Public License as published by *
'	* the Free Software Foundation; either version 2 of the License, or    *
'	* (at your option) any later version.                                  *
'	*                                                                      *
'	************************************************************************
%>
<%
	' Display a news
	' IN  : iID (int) : news' id (table news, field nID)
	' OUT : -
	Sub DisplayAdminNews(iID)
		Dim oRs, oRs2, rSQL, sURL, tURL

		rSQL = "SELECT nID, nTitle, nAuthor, nDate, nHeader, nText, nImage, nURL, nRead, cTitle, vCode FROM news, categories, versions WHERE nCategory=cID AND nVersion=vID AND nID=" & iID

		Set oRs = DBRecordSet(oCnMain, rSQL)
		If Not oRs.EOF Then
			Response.Write "	  <a name=""news_" & oRs("nID") & """></a>" & vbCRLF
			CreateTopTable "news_" & oRs("nID"), CodeMessage(oRs("nTitle"), False)
			Response.Write "<span class=""small"">" & Replace(Replace(GetTranslation("LANG_POST_DATE_BY"), _
							"%1%", GetDateLitteralDDMMYYYYHHMMSS(GMT2Local(StringToDate(oRs("nDate"))))), _
							"%2%", "<a href=""" & GLOBAL_SITE_PATH & GLOBAL_SITE_PROFILE_PAGE & "?id=" & Server.URLEncode(oRs("nAuthor")) & """>" & oRs("nAuthor") & "</a>")
			Response.Write " " & oRs("vCode") & " - " & oRs("cTitle")
			If oRs("nURL") <> "" Then
				sURL = Replace(LCase(oRs("nURL")), "http://", "")
				rSQL = "SELECT uTitle FROM urls WHERE uURL LIKE '%" & SQLEncrypt(sURL) & "%'"
				Set oRs2 = DBRecordSet(oCnMain, rSQL)
				Response.Write "<br>" & GetTranslation("LANG_SOURCE") & " : <a href=""" & GLOBAL_SITE_PATH & GLOBAL_SITE_GOTOURL_PAGE & "?url=http://" & Server.URLEncode(sURL) & """ target=_blank>"
				If Not oRs2.EOF Then
					Response.Write oRs2("uTitle")
				Else
					tURL = Split(sURL, "/")
					Response.Write tURL(0)
				End If
				Response.Write "</a>" & vbCRLF
			End If
			Response.Write "</span><br><br>" & vbCRLF

			If oRs("nImage") <> "" Then 
				Response.Write "<img src="""
				If Left(LCase(oRs("nImage")), 7) <> "http://" Then Response.Write GLOBAL_SITE_IMAGES_NEWS_PATH 
				Response.Write oRs("nImage") & """ align=""left"" border=""0"">" & vbCRLF
			End If

			Response.Write CodeMessage(oRs("nHeader"), False) & vbCRLF
			Response.Write "<br><br>" & vbCRLF
			Response.Write CodeMessage(oRs("nText"), False) & vbCRLF
			rSQL = "SELECT Count(cID) FROM Comments WHERE cItem=" & iID & " AND cType=" & CATEGORY_TYPE_NEWS & " AND cValid=True"
			Set oRs2 = DBRecordSet(oCnMain, rSQL)
			CreateBottomTable GetTranslation("LANG_COMMENTS") & " : " & oRs2(0) & " | " & GetTranslation("LANG_READ") & " : " & oRs("nRead") & vbCRLF
		End If

		Set oRs = Nothing		
	End Sub

	' Display the navigation bar for news (previous and next day)
	' IN  : dDate (datetime) : actual date
	' OUT : -
	Sub DisplayNewsNavigation(dDate)
		Dim oRs, rSQL, jPrec, jSuiv, X

		rSQL = "SELECT " & SQLtop(1) & " nDate FROM news WHERE (nDate < '" & DateToString(dDate) & "') AND (nValid=True) ORDER BY nDate DESC"
		Set oRs = DBRecordSet(oCnMain, rSQL)
		If Not oRs.EOF Then jPrec = Left(oRs(0), 8)

		rSQL = "SELECT " & SQLtop(1) & " nDate FROM news WHERE nDate > '" & DateToString(DateAdd("d", 1, dDate)) & "' AND nValid=True ORDER BY nDate"
		Set oRs = DBRecordSet(oCnMain, rSQL)
		If Not oRs.EOF Then jSuiv = Left(oRs(0), 8)
		
		If jPrec <> "" or jSuiv <> "" Then
			CreateTopTable "NewsNavigate", GetTranslation("LANG_OLD_NEWS")
			Response.Write "<table width=""100%"" cellspacing=""0"" cellpadding=""5"" border=""0"" align=""center"">" & vbCRLF
			Response.Write "  <tr>" & vbCRLF
			Response.Write "    <td width=""35%"" class=""small"">" & vbCRLF
			If jPrec <> "" Then Response.Write "      &lt;&lt; <a href=""" & GLOBAL_SITE_NEWS_PAGE & "?date=" & jPrec & """>" & GetTranslation("LANG_LAST_DAY") & "</a><br>" & GetDateLitteralDDMMYYYY(StringToDate(jPrec)) & vbCRLF
			Response.Write "    </td>" & vbCRLF
			Response.Write "    <td width=""30%"" class=""small"" align=""center"" valign=""bottom"">" & GetDateLitteralDDMMYYYY(dDate) & "</td>" & vbCRLF
			Response.Write "    <td width=""35%"" class=""small"" align=""right"">" & vbCRLF
			If jSuiv <> "" Then Response.Write "      <a href=""" & GLOBAL_SITE_NEWS_PAGE & "?date=" & jSuiv & """>" & GetTranslation("LANG_NEXT_DAY") & "</a> &gt;&gt;<br>" & GetDateLitteralDDMMYYYY(StringToDate(jSuiv)) & vbCRLF
			Response.Write "    </td>" & vbCRLF
			Response.Write "  </tr>" & vbCRLF
			Response.Write "</table>" & vbCRLF
			CreateBottomTable ""
		End If

		Set oRs = Nothing
	End Sub

	' Generate news backend - create a file display_news.js into the scripts directory with javascript inside
	' IN  : iTop (int) : number of results wanted
	' OUT : -
	Sub GenerateBackEndNews(iTop)
		Dim oRs, rSQL, oFs, oJsFile, oFile

		rSQL =	"SELECT " & SQLtop(iTop) & " nID, nTitle, nDate FROM news" & _
				" WHERE (nDate < '" & DateTimeToString(GMTNow) & "')" & _
				" AND (nValid = True)" & _
				" ORDER BY nDate DESC"

		Set oRs = DBRecordSet(oCnMain, rSQL)
		
		On Error Resume Next
		Set oFs = Server.CreateObject("Scripting.FileSystemObject")
		If Err.number <> 0 Then
			Err.Clear
		Else
			Set oFile = oFs.OpenTextFile(Server.MapPath(GLOBAL_SITE_BACKEND), 2, true)
			If Not oRs.EOF Then
				While Not oRs.EOF
					oFile.WriteLine "document.write('<a href=""" & GLOBAL_SITE_URL & "/news.asp?id=" & oRs("nID") & """ target=""_blank"">" & _
							JsEncrypt(CodeMessage(oRs("nTitle"), False)) & "</a>&nbsp;<font size=""1"">" & _
							GetDateLitteralDDMMYYYY(GMT2Local(StringToDate(oRs("nDate")))) & "</font><br>');" & vbCRLF
					oRs.MoveNext
				WEnd
			End If
			oFile.Close
			Set oFs = Nothing
		End If
		On Error Goto 0

		Set oRs = Nothing
	End Sub

'	----------------------
'	|
'	----------------------
	Sub	DisplayTopNewsAdmin(ByVal sSortedField, ByVal bAscSort)
		Dim rSQL, rs, X, iNbTotalPosts, sHTML, sSortDesc, iPage, iLine
		Dim iCat
		iCat = RequestSession("nCategory",0)
		If Not IsNumeric(iCat) Then iCat = 0

		' Number of News lines per page, default 10
		Dim MAX_LINES_PER_PAGE
		MAX_LINES_PER_PAGE = RequestSession("NewsPageSize", 10)

		Dim aPage(5,1)
		aPage(0,0)="5"		:	aPage(0,1)=5
		aPage(1,0)="10"		:	aPage(1,1)=10
		aPage(2,0)="15"		:	aPage(2,1)=15
		aPage(3,0)="20"		:	aPage(3,1)=20
		aPage(4,0)="40"		:	aPage(4,1)=40
		aPage(5,0)="all"	:	aPage(5,1)=9999
		sHTML = ""
		
		Select Case LCase(sSortedField)
			Case "ntitle" :
				sSortedField = sSortedField
				sSortDesc = GetTranslation("LANG_TITLE")
			Case "nauthor" :
				sSortedField = sSortedField
				sSortDesc = GetTranslation("LANG_AUTHOR")
			Case "ndate" :
				sSortedField = sSortedField
				sSortDesc = GetTranslation("LANG_DATE")
			Case "ncategory" :
				sSortedField = "cTitle" 'sSortedField
				sSortDesc = GetTranslation("LANG_CATEGORY")
			Case Else :	' default value
				sSortedField = "nDate"
				bAscSort = False
				sSortDesc = GetTranslation("LANG_DATE")
		End Select

		rSQL = "SELECT * FROM news, categories WHERE nCategory=cID" 
		If iCat<>0 Then
			rSQL = rSQL & " AND nCategory=" & iCat
		End If
		rSQL = rSQL & " ORDER BY " & sSortedField

		If NOT bAscSort Then 
			rSQL = rSQL & " DESC"
			sSortDesc = sSortDesc & " (DESC)"
		Else
			sSortDesc = sSortDesc & " (ASC)"
		End If

		Response.Write "<script language='javascript' type='text/javascript'>" & vbCrLf
		Response.Write "function changeNewsPage()" & vbCrLf
		Response.Write "{" & vbCrLf
		Response.Write "  document.NewsPage.submit();" & vbCrLf
		Response.Write "}" & vbCrLf
		Response.Write "</script>" & vbCrLf
		Response.Write "<form method='post' name='NewsPage' action='" & sURLPage & IIF(Request.QueryString<>"","?" & Request.QueryString,"") & "'>"

		sHTML = ""
		sHTML = sHTML & GetTranslation("LANG_NEWS")
		sHTML = sHTML & "&nbsp;|&nbsp;<span class=small>" & GetTranslation("LANG_SORT_BY", sSortDesc) & "</span>"
		sHTML = sHTML & "&nbsp;|&nbsp;<a href='" & sURLPage & "?do=new'>" & GetTranslation("LANG_ADD") &" - "& GetTranslation("LANG_NEWS") & "</a>"

		CreateTopTable "News", sHTML
		sHTML = ""
		sHTML = sHTML & " | " & GetTranslation("LANG_ITEMS_PER_PAGE")  & vbCrLf
		sHTML = sHTML & " <select name='NewsPageSize' class='smallcell' onChange='javascript:changeNewsPage();'>" & vbCrLf
		For X = 0 To UBound(aPage)
				sHTML = sHTML & "  <option value=" & aPage(X,1) & "" & _
								IIF(cLng(MAX_LINES_PER_PAGE)=cLng(aPage(X,1))," selected","") & ">" & _
								aPage(X,0) & "</option>" & vbCrLf
		Next
		sHTML = sHTML & " </select>" & vbCrLf

		sHTML = sHTML & " | " & GetTranslation("LANG_CATEGORY")
		sHTML = sHTML & " <select name='nCategory' class='smallcell' onChange='javascript:changeNewsPage();'>" & vbCrLf

		sTreeID="" : sTreeTitle="" : iTreeLevel=0
		GetCategoryTree(0), CATEGORY_TYPE_News
		Dim aTreeID, aTreeTitle
		aTreeID=Split(sTreeID,",")
		aTreeTitle=Split(sTreeTitle,",")
		iLine = GetPopulationTable(0, "News", "nCategory", "")
		sHTML = sHTML & "  <option value=0" & IIF(cLng(iCat)=0," selected","") & ">"&GetTranslation("LANG_ALL")&"("&iLine&")</option>" & vbCrLf
		For X = 0 To UBound(aTreeID) 
				sHTML = sHTML & "  <option value=" & aTreeID(X) & IIF(cLng(iCat)=cLng(aTreeID(X))," selected","") & ">" & _
								aTreeTitle(X) & "</option>" & vbCrLf
		Next
		sHTML = sHTML & " </select>" & vbCrLf
		Response.Write sHTML

		Response.Write GLOBAL_SITE_SUBTABLE & vbCRLF
		Response.Write "</form>"
		Response.Write "  <tr class='tablelinemain'>" & vbCRLF
		Response.Write "    <td>"
		SortMenu GetTranslation("LANG_TITLE"), "nTitle", sSortedField, bAscSort
		Response.Write "</td>" & vbCRLF
		Response.Write "    <td align=""center"">"
		SortMenu GetTranslation("LANG_CATEGORY"), "nCategory", sSortedField, bAscSort
		Response.Write "</td>" & vbCRLF
		Response.Write "    <td width='120' align=center>"
		SortMenu GetTranslation("LANG_DATE"), "nDate", sSortedField, bAscSort
		Response.Write "</td>" & vbCRLF
		Response.Write "    <td width='80' align=center>"
		SortMenu GetTranslation("LANG_AUTHOR"), "nAuthor", sSortedField, bAscSort
		Response.Write "</td>" & vbCRLF
		Response.Write "    <td width='40' align=center>" & GetTranslation("LANG_VALID") & "</td>" & vbCRLF
		Response.Write "    <td width='90' align=center>" & GetTranslation("LANG_ACTIONS") & "</td>" & vbCRLF
		Response.Write "  </tr>" & vbCRLF

		Set rs = Server.CreateObject("ADODB.Recordset")
		rs.PageSize = MAX_LINES_PER_PAGE
		rs.open rSQL, oCnMain, 1
		iNbTotalPosts = rs.RecordCount

		iPage = RequestSession("Page", 1)
		If Not IsNumeric(iPage) Then iPage = 1
		iPage=Int(iPage)
		If iPage<1 Then iPage=1
		If ((iPage-1)*MAX_LINES_PER_PAGE) > iNbTotalPosts Then
			iPage=1
			Session("page")=iPage
		end if

		if not rs is nothing then
			if not rs.eof and not rs.bof then
				If rs.RecordCount <> -1 Then
					rs.AbsolutePage = iPage
				Else
					For X = 1 To (iPage-1)*MAX_LINES_PER_PAGE
						rs.MoveNext
					Next
				End If
			end if
		end if

		if not rs is nothing then
			if not rs.eof and not rs.bof then

				If Not rs.EOF Then
					iLine = 1
					For X = 1 to MAX_LINES_PER_PAGE
						if not rs.eof then
							Response.Write "  <tr class='tableline" & iLine & "'>" & vbCRLF
							Response.Write "    <td>" & CodeMessage(rs("nTitle"), False) & "</td>" & vbCRLF
							Response.Write "    <td align=center>" & GetTranslation(rs("cTitle")) & "</td>" & vbCRLF
							Response.Write "    <td align=center>" & GMT2Local(StringToDate(rs("nDate"))) & "</td>" & vbCRLF
							Response.Write "    <td align=center>" & rs("nAuthor") & "</td>" & vbCRLF

							Response.Write "    <td align=center>" & vbCRLF
							MenuValid rs("nID"), rs("nValid")
							Response.Write "    </td>" & vbCRLF

							Response.Write "    <td align=center nowrap>" & vbCRLF
							MenuAdmin(rs("nID"))
							Response.Write "    </td>" & vbCRLF
							Response.Write "  </tr>" & vbCRLF

							iLine = 1 + ((iLine-1) XOR 1)
							rs.MoveNext
						End If
					Next
				end if
			else
				Response.Write "  <tr class='tableline" & iLine & "'>" & vbCRLF
				Response.Write "    <td align=center colspan=6>" & vbCRLF
				Response.Write "<p><span class='normal'>" & GetTranslation("LANG_EMPTY_SECTION") & "</span><p>" & vbCrLf
				Response.Write "    </td>" & vbCRLF
				Response.Write "  </tr>" & vbCRLF
				iLine = 1 + ((iLine-1) XOR 1)
			end if
		end if
		sHTML = "<a href='" & sURLPage & "?do=new'>" & GetTranslation("LANG_ADD") & " - " & GetTranslation("LANG_NEWS") & "</a>"
		DisplayNewsPageRules sHTML, rs.RecordCount, MAX_LINES_PER_PAGE, iPage, 6
		Response.Write "</table>" & vbCRLF
		CreateBottomTable ""

		rs.close
		set rs = nothing
	End Sub

	function NewsPage(page)
		NewsPage =	"<a href='" & GLOBAL_SITE_NEWS_PAGE & "?page=" & page & "'>"
	end function
	
	sub DisplayNewsPageRules(ByVal sText, ByVal Totalepc, ByVal PageLen, ByVal Pagina, ByVal ColsPan)
		Dim PagineTotali, X
		if Totalepc < 0 then Totalepc = 0
		PagineTotali = 0
		if Totalepc > 0 then
			PagineTotali = Totalepc\PageLen
			If Totalepc Mod PageLen Then PagineTotali = PagineTotali + 1
		end if

		If PagineTotali > 1 Then
			Response.Write "  <tr class='tablelinemain'>" & vbCrLf
			
			If sText<>"" Then
				Response.Write "    <td >" & sText & "</td>" & vbCRLF
				ColSpan=ColSpan-1
			End IF
			
			Response.Write "    <td align='center' colspan='" & Colspan & "'>" & vbCrLf
			If Pagina <> 1 Then
				Response.Write "      &nbsp;" & NewsPage(Pagina-1) & "<span title='"&GetTranslation("LANG_PREV_PAGE")&"'>&lt;&lt;</span></a>" & vbCrLf
			End If
			For X = 1 To PagineTotali
				If X <> CInt(Pagina) Then 
					Response.Write "      &nbsp;" & NewsPage(X) & X & "</a>" & vbCrLf
				Else
					Response.Write "&nbsp;<b>(" & X & ")</b>" & vbCrLf
				End If
			Next
			If Pagina <> PagineTotali Then
				Response.Write "      &nbsp;" & NewsPage(Pagina+1) & "<span title='"&GetTranslation("LANG_NEXT_PAGE")&"'>&gt;&gt;</span></a>" & vbCrLf
			End IF
			Response.Write "    </td>" & vbCrLf
			Response.Write "  </tr>" & vbCrLf
		Else
			If sText<>"" Then
				Response.Write "  <tr class='tablelinemain'>" & vbCrLf
				Response.Write "    <td colspan='" & Colspan & "'>" & sText & "</td>" & vbCRLF
			End IF
		End If
	end sub
'------

	' Display the top last news
	' IN  : iTop (int) : number of results wanted
	'     : sSortedField (string) : field sorted
	'     : bAscSort (boolean) : if true = ASC sort, else DESC
	' OUT : -
	Sub DisplayTopNewsAdmin_org(iTop, sSortedField, bAscSort)
		Dim oRs, rSQL, iLine
		Dim titreNews, texteNews, dateNews, sSortDesc

		Select Case LCase(sSortedField)
			Case "ntitle" :
				sSortedField = sSortedField
				sSortDesc = GetTranslation("LANG_TITLE")
			Case "nauthor" :
				sSortedField = sSortedField
				sSortDesc = GetTranslation("LANG_AUTHOR")
			Case "ndate" :
				sSortedField = sSortedField
				sSortDesc = GetTranslation("LANG_DATE")
			Case Else :	' default value
				sSortedField = "nDate"
				bAscSort = False
				sSortDesc = GetTranslation("LANG_DATE")
		End Select

		rSQL = "SELECT " & SQLtop(iTop) & " nID, nTitle, nDate, nAuthor, nValid FROM news ORDER BY " & sSortedField
		If Not bAscSort Then 
			rSQL = rSQL & " DESC"
			sSortDesc = sSortDesc & " (DESC)"
		Else
			sSortDesc = sSortDesc & " (ASC)"
		End If

		Set oRs = DBRecordSet(oCnMain, rSQL)

		CreateTopTable "AdminNews", GetTranslation("LANG_TOP") & " " & iTop & " - " & _
									GetTranslation("LANG_NEWS") & "&nbsp;|&nbsp;<span class=small>" & _
									GetTranslation("LANG_SORT_BY", sSortDesc) & "</span>"
		
		Response.Write GLOBAL_SITE_SUBTABLE & vbCRLF
		Response.Write "  <tr class='tablelinemain'>" & vbCRLF
		Response.Write "    <td>"
		SortMenu GetTranslation("LANG_TITLE"), "nTitle", sSortedField, bAscSort
		Response.Write "</td>" & vbCRLF
		Response.Write "    <td width='120' align=center>"
		SortMenu GetTranslation("LANG_DATE"), "nDate", sSortedField, bAscSort
		Response.Write "</td>" & vbCRLF
		Response.Write "    <td width='80' align=center>"
		SortMenu GetTranslation("LANG_AUTHOR"), "nAuthor", sSortedField, bAscSort
		Response.Write "</td>" & vbCRLF
		Response.Write "    <td width='40' align=center>" & GetTranslation("LANG_VALID") & "</td>" & vbCRLF
		Response.Write "    <td width='90' align=center>" & GetTranslation("LANG_ACTIONS") & "</td>" & vbCRLF
		Response.Write "  </tr>" & vbCRLF
			
		iLine = 1
		While Not oRs.EOF
			Response.Write "  <tr class='tableline" & iLine & "'>" & vbCRLF
			Response.Write "    <td>" & CodeMessage(oRs("nTitle"), False) & "</td>" & vbCRLF
			Response.Write "    <td align=center>" & GMT2Local(StringToDate(oRs("nDate"))) & "</td>" & vbCRLF
			Response.Write "    <td align=center>" & oRs("nAuthor") & "</td>" & vbCRLF

			Response.Write "    <td align=center>" & vbCRLF
			MenuValid oRs("nID"), oRs("nValid")
			Response.Write "    </td>" & vbCRLF

			Response.Write "    <td align=center nowrap>" & vbCRLF
			MenuAdmin(oRs("nID"))
			Response.Write "    </td>" & vbCRLF
			Response.Write "  </tr>" & vbCRLF
				
			iLine = 1 + ((iLine-1) XOR 1)
			oRs.MoveNext
		WEnd
		Response.Write "  <tr class='tablelinemain'>" & vbCRLF
		Response.Write "    <td colspan=5><a href='" & sURLPage & "?do=new'>" & GetTranslation("LANG_ADD") & " - " & GetTranslation("LANG_NEWS") & "</a></td>" & vbCRLF
		Response.Write "  </tr>" & vbCRLF
		Response.Write "</table>" & vbCRLF
		CreateBottomTable ""

		Set oRs = Nothing
	End Sub

	' Display all news queued for validation
	' IN  : -
	' OUT : -
	Sub DisplayAdminNewsToValidate()
		Dim oRs, rSQL, iLine

		rSQL = "SELECT nID, nTitle, nDate, nAuthor, nValid FROM news WHERE nValid=FALSE ORDER BY nDate DESC"
		Set oRs = DBRecordSet(oCnMain, rSQL)
		
		If Not oRs.EOF Then
			CreateTopTable "NewsToValidate", GetTranslation("LANG_NEWS") & " - " & GetTranslation("LANG_TO_VALIDATE")
			Response.Write GLOBAL_SITE_SUBTABLE & vbCRLF
			Response.Write "  <tr class='tablelinemain'>" & vbCRLF
			Response.Write "    <td>" & GetTranslation("LANG_TITLE") & "</td>" & vbCRLF
			Response.Write "    <td width='130' align='center'>" & GetTranslation("LANG_DATE") & "</td>" & vbCRLF
			Response.Write "    <td width='80' align='center'>" & GetTranslation("LANG_AUTHOR") & "</td>" & vbCRLF
			Response.Write "    <td width=""40"" align=""center"">" & GetTranslation("LANG_VALID") & "</td>" & vbCRLF
			Response.Write "    <td width='100' align='center'>" & GetTranslation("LANG_ACTIONS") & "</td>" & vbCRLF
			Response.Write "  </tr>" & vbCRLF

			iLine = 1
			While Not oRs.EOF
				Response.Write "  <tr class='tableline" & iLine & "'>" & vbCRLF
				Response.Write "    <td>" & CodeMessage(oRs("nTitle"), False) & "</td>" & vbCRLF
				Response.Write "    <td align='center'>" & GetDateLitteralDDMMYYYY(GMT2Local(StringToDate(oRs("nDate")))) & "</td>" & vbCRLF'HHMMSS
				Response.Write "    <td align='center'>" & oRs("nAuthor") & "</td>" & vbCRLF

				Response.Write "    <td align=""center"">" & vbCRLF
				MenuValid oRs("nID"), oRs("nValid")
				Response.Write "    </td>" & vbCRLF
				
				Response.Write "    <td align='center'>" & vbCRLF
				MenuAdmin(oRs("nID"))
				Response.Write "    </td>" & vbCRLF
				Response.Write "  </tr>" & vbCRLF
			
				iLine = 1 + ((iLine-1) Xor 1)
				oRs.MoveNext
			WEnd				
			Response.Write "</table>" & vbCRLF
			CreateBottomTable ""
		End If

		Set oRs = Nothing
	End Sub
	

	' Display the preview page
	' IN  : sTitle (string) : news' title
	'     : dDate (datetime) : news' post date
	'     : sAuthor (string) : news' author
	'     : sHeader (string) : news' header
	'     : sText (string) : news' content
	'     : sImage (string) : news' picture (displayed if not null)
	'     : sURL (string) : news' source (display if not null)
	' OUT : -
	Sub DisplayPreviewNews(sTitle, dDate, sAuthor, sHeader, sText, sImage, sURL)
		Dim tURL

		CreateTopTable "PreviewNews", CodeMessage(sTitle, False)
	'	Response.Write "<span class='small'>" & Replace(Replace(GetTranslation("LANG_POST_DATE_BY"), _
	'					"%1%", GetDateLitteralDDMMYYYYHHMMSS(GMT2Local( StringToDate(dDate)))), _
	'					"%2%", DisplayEmail(sAuthor)
		Response.Write "<span class=small>" & GetTranslation("LANG_POST_DATE_BY", GetDateLitteralDDMMYYYYHHMMSS(dDate), DisplayEmail(sAuthor))
		If sURL <> "" Then
			sURL = Replace(LCase(sURL), "http://", "")
			tURL = Split(sURL, "/")
			Response.Write "<br>" & GetTranslation("LANG_SOURCE") & " : <a href=""" & GLOBAL_SITE_GOTOURL_PAGE & "?url=http://" & Server.URLEncode(sURL) & """ target=_blank>" & tURL(0) & "</a>" & vbCRLF
		End If
		Response.Write "</span><br><br>" & vbCRLF

		If sImage <> "" Then Response.Write "<img src='" & Server.URLEncode(sImage) & "' align='left' border='0'>" & vbCRLF
		Response.Write CodeMessage(sHeader, False) & vbCRLF
		If sHeader <> "" and sText <> "" Then Response.Write "<hr>" & vbCRLF
		Response.Write CodeMessage(sText, False) & vbCRLF
		CreateBottomTable "<input type='button' class='button' onClick='javascript:history.back()' value='" & GetTranslation("LANG_BACK") & "'>"
	End Sub
	
	' Display old news by date
	' IN  : dDate (datetime) : news' posting date
	' OUT : -
	Sub DisplayAdminOldNews(dDate)
		Dim oRs, rSQL, iLine

		rSQL = "SELECT * FROM news WHERE Left(nDate,8) = " & Left(DateToString(dDate), 8) & " ORDER BY nDate DESC"
		Set oRs = DBRecordSet(oCnMain, rSQL)

		If Not oRs.EOF Then
			CreateTopTable "News", GetTranslation("LANG_NEWS") & " - " & dDate
			Response.Write GLOBAL_SITE_SUBTABLE & vbCRLF
			Response.Write "  <tr class=""tablelinemain"">" & vbCRLF
			Response.Write "    <td>" & GetTranslation("LANG_TITLE") & "</td>" & vbCRLF
			Response.Write "    <td width=""120"">" & GetTranslation("LANG_DATE") & "</td>" & vbCRLF
			Response.Write "    <td width=""80"" align=""center"">" & GetTranslation("LANG_AUTHOR") & "</td>" & vbCRLF
			Response.Write "    <td width=""40"" align=""center"">" & GetTranslation("LANG_VALID") & "</td>" & vbCRLF
			Response.Write "    <td width=""100"" align=""center"">" & GetTranslation("LANG_ACTIONS") & "</td>" & vbCRLF
			Response.Write "  </tr>" & vbCRLF
			
			iLine = 1
			While Not oRs.EOF
				Response.Write "  <tr class=""tableline" & iLine & """>" & vbCRLF
				Response.Write "    <td>" & CodeMessage(oRs("nTitle"), False) & "</td>" & vbCRLF
				Response.Write "    <td align=""center"">" & GMT2Local(StringToDate(oRs("nDate"))) & "</td>" & vbCRLF
				Response.Write "    <td align=""center"">" & oRs("nAuthor") & "</td>" & vbCRLF

				Response.Write "    <td align=""center"">" & vbCRLF
				MenuValid oRs("nID"), oRs("nValid")
				Response.Write "    </td>" & vbCRLF
				
				Response.Write "    <td align=""center"">"
				MenuAdmin(oRs("nID"))
				Response.Write "</td>" & vbCRLF
				Response.Write "  </tr>" & vbCRLF
				
				iLine = 1 + ((iLine-1) XOR 1)
				oRs.MoveNext
			WEnd
			Response.Write "</table>" & vbCRLF
			CreateBottomTable ""
		End If

		Set oRs = Nothing
	End Sub

	' Edit news for add or update
	' IN  : iID (int) : news' id (table news, field nID) if 0 or null then added
	' OUT : -
	Sub EditNews(iID)
		Dim oRs, rSQL, X
		Dim sDo, sEditTitle, sTitle, sAuthor, dDate, sHeader, sText, sImage, sURL, iCategory, iVersion, bValid
		Dim dEndDate, bTagged

		If iID <> "" and iID <> 0 Then
			sDo = "updt"
			sEditTitle = GetTranslation("LANG_EDIT") & " - " & GetTranslation("LANG_NEWS")
		'	rSQL = "SELECT nTitle, nAuthor, nDate, nHeader, nText, nImage, nURL, nValid, nCategory, nVersion FROM news WHERE nID=" & iID
			rSQL = "SELECT * FROM news WHERE nID=" & iID
			Set oRs = DBRecordSet(oCnMain, rSQL)
			If Not oRs.EOF Then
				sTitle = oRs("nTitle")&""
				sAuthor = oRs("nAuthor")&""
				dDate = StringToDate(oRs("nDate"))
				dEndDate = oRs("nEndDate")
				if trim(dEndDate&"")="" Then dEndDate=DateTimeToString(DateSerial(9999,12,31))
				dEndDate = StringToDate(dEndDate)

				sHeader = oRs("nHeader")&""
				sText = oRs("nText")&""
				sImage = oRs("nImage")&""
				sURL = oRs("nURL")&""
				iCategory = oRs("nCategory")
				iVersion = oRs("nVersion")
				bValid = oRs.Fields("nValid").Value
				bTagged = oRs.Fields("nTagged").Value
			End If
		Else
			sDo = "add"
			sEditTitle = GetTranslation("LANG_ADD") & " - " & GetTranslation("LANG_NEWS")
			sTitle		= Request.Form("nTitle")
			sAuthor		= sPseudo
			dDate		= RequestDate("nDate")
			if Year(dDate)=2000 and Month(dDate)=1 and Day(dDate)=1 and Hour(dDate)=0 and Minute(dDate)=0 then dDate=GMTnow()
		'	if dDate = DateSerial(2000,1,1) & TimeSerial(0,0,0) then dDate = GMTNow()
			dEndDate	= DateSerial(9999,12,31) 'DateAdd("y",5,dDate)
			
			sHeader		= Request.Form("nHeader")
			sText		= Request.Form("nText")
			sImage		= RequestStr("nImage")
			sURL		= RequestStr("nURL")
			iCategory	= RequestNum("nCategory")
			bValid		= RequestBoolean("nValid")
			bTagged		= RequestBoolean("nTagged")
		End If

		CreateTopTable "EditionNews", GetTranslation("LANG_ADD") & " - " & GetTranslation("LANG_NEWS")
		Response.Write GLOBAL_SITE_SUBTABLE & vbCRLF
		Dim oForm
		Set oForm = New DesignForms
		With oForm
			.Open				"EditNews", "post", sUrlPage
			.AddJAVA			"	function preview()" & vbCRLF
			.AddJAVA			"	{" & vbCRLF
			.AddJAVA			"		document.EditNews.Do.value = 'preview';" & vbCRLF
			.AddJAVA			"		document.EditNews.submit();" & vbCRLF
			.AddJAVA			"	}" & vbCRLF
			.AddInputHidden		"Do", sDo
			.AddInputHidden		"nID", iID
			.AddShowHeader		GetTranslation("LANG_FIELD"),		GetTranslation("LANG_VALUE")
			.Required
			.AddInput			GetTranslation("LANG_TITLE"),		"nTitle",		sTitle, 100, 50
			.NotRequired
			.AddTextHidden		GetTranslation("LANG_AUTHOR"),		"nAuthor",		sAuthor
			.AddDateTime		GetTranslation("LANG_DATE"),		"nDate",		GMT2Local(dDate), true
			.AddDateTime		GetTranslation("LANG_DATE_END"),	"nEndDate",		GMT2Local(dEndDate), true
			.Required
			.AddTextbox			GetTranslation("LANG_HEADER"),		"nHeader",		sHeader, 50, 8, false
			.NotRequired
			.AddTextbox			GetTranslation("LANG_CONTENT"),		"nText",		sText, 50, 10, false
			.AddUpload			GetTranslation("LANG_IMAGE"),		"nImage",		sImage, 250, 50, "tn", ""
			.AddInput			GetTranslation("LANG_SOURCE"),		"nURL",			sUrl, 250, 50
			.AddCategory											"nCategory",	iCategory, CATEGORY_TYPE_NEWS, true
			.AddVersion												"nVersion",		iVersion
			.AddCheckBox		GetTranslation("LANG_POST_STICKED"),"nTagged",		bTagged
			.AddCheckBox		GetTranslation("LANG_VALID"),		"nValid",		bValid

			.ConfirmSubmit
			.AlignRight
			.AddShowBottom		.AddSubmit(GetTranslation("LANG_SUBMIT"), "bSubmit") '& " " & _
			'					.AddButton(GetTranslation("LANG_PREVIEW"), "bPreview", "javascript:preview();")
			.Close
		End With
		Set oForm = Nothing
		Response.Write "</table>" & vbCRLF
		CreateBottomTable ""

		Set oRs = Nothing
	End Sub

	' Display deleting page
	' IN  : iID (int) : news' id (table news, field nID)
	' OUT : -
	Sub ConfirmDeleteNews(iID)
		Dim oRs, rSQL

		If iID <> "" and iID <> 0 Then
			rSQL = "SELECT * FROM news WHERE nID=" & iID
			Set oRs = DBRecordSet(oCnMain, rSQL)
			If Not oRs.EOF Then
				Response.Write "<script language=""javascript"" type=""text/javascript"">" & vbCRLF
				Response.Write "  function delNews()" & vbCRLF
				Response.Write "  {" & vbCRLF
				Response.Write "    document.suppression.Do.value='del';" & vbCRLF
				Response.Write "    document.suppression.submit();" & vbCRLF
				Response.Write "  }" & vbCRLF
				Response.Write "</script>" & vbCRLF
				CreateTopTable "ConfirmDel", GetTranslation("LANG_CONFIRM") & " - " & GetTranslation("LANG_DELETE")
				Response.Write GLOBAL_SITE_SUBTABLE & vbCRLF
				Response.Write "<form name=""suppression"" method=""post"" action=""" & sUrlPage & """>" & vbCRLF
				Response.Write "<input type=""hidden"" name=""nID"" value=""" & oRs("nID") & """>" & vbCRLF
				Response.Write "<input type=""hidden"" name=""Do"" value="""">" & vbCRLF
				Response.Write "  <tr class=""tablelinemain"">" & vbCRLF
				Response.Write "    <td>" & GetTranslation("LANG_CONFIRM_DELETE") & "</td>" & vbCRLF
				Response.Write "  </tr>" & vbCRLF
				Response.Write "</table>" & vbCRLF
				Response.Write GLOBAL_SITE_SUBTABLE & vbCRLF
				Response.Write "  <tr class=""tableline1"">" & vbCRLF
				Response.Write "    <td>" & GetTranslation("LANG_TITLE") & "</td><td>" & oRs("nTitle") & "</td>" & vbCRLF
				Response.Write "  </tr>" & vbCRLF
				Response.Write "  <tr class=""tableline2"">" & vbCRLF
				Response.Write "    <td>" & GetTranslation("LANG_DATE") & "</td><td>" & GMT2Local(StringToDate(oRs("nDate"))) & "</td>" & vbCRLF
				Response.Write "  </tr>" & vbCRLF
				Response.Write "  <tr class=""tableline1"">" & vbCRLF
				Response.Write "    <td>" & GetTranslation("LANG_AUTHOR") & "</td><td>" & oRs("nAuthor") & "</td>" & vbCRLF
				Response.Write "  </tr>" & vbCRLF
				
				rSQL = "SELECT Count(*) FROM Comments WHERE cItem=" & iID & " AND cType=" & CATEGORY_TYPE_NEWS
				Set oRs = DBRecordSet(oCnMain, rSQL)

				Response.Write "  <tr class=""tableline2"">" & vbCRLF
				Response.Write "    <td>" & GetTranslation("LANG_COMMENTS") & "</td><td>" & oRs(0) & "</td>" & vbCRLF
				Response.Write "  </tr>" & vbCRLF
				Response.Write "  <tr class=""tablelinemain"">" & vbCRLF
				Response.Write "    <td colspan=""2"" align=""right"">" & vbCRLF
				Response.Write "      <input type=""button"" name=""Oui"" value=""" & GetTranslation("LANG_YES") & """ class=""button"" onClick=""javascript:delNews();"">&nbsp;&nbsp;&nbsp;&nbsp;" & vbCRLF
				Response.Write "      <input type=""button"" name=""Non"" value=""" & GetTranslation("LANG_NO") & """ class=""button"" onClick=""javascript:document.suppression.submit();"">&nbsp;" & vbCRLF
				Response.Write "    </td>" & vbCRLF
				Response.Write "  </tr>" & vbCRLF
				Response.Write "</form>" & vbCRLF
				Response.Write "</table>" & vbCRLF
				CreateBottomTable ""
			End If
		End If

		Set oRs = Nothing
	End Sub

	' Add a news' category (insert query)
	' IN  : sTitle (string) : category's title (table categories, field cTitle)
	' OUT : (int) : Category's id (table categories, fields cID)
	Function AddCategoryNews(sTitle)
		Dim oRs, rSQL

		rSQL = "SELECT " & SQLtop(1) & " cID FROM categories WHERE cParent=0 AND cTitle='" & SQLEncrypt(sTitle) & "' AND cDescription='" & SQLEncrypt(sTitle) & "' AND cType=" & CATEGORY_TYPE_NEWS & " ORDER BY cID DESC"
		Set oRs = DBRecordSet(oCnMain, rSQL)
		If oRs.EOF Then
			rSQL = "INSERT INTO categories (cParent, cTitle, cDescription, cImage, cType) VALUES (0, '" & SQLEncrypt(sTitle) & "', '" & SQLEncrypt(sTitle) &"', '', " & CATEGORY_TYPE_NEWS & ")"
			DBExecute oCnMain, rSQL
			rSQL = "SELECT " & SQLtop(1) & " cID FROM categories WHERE cParent=0 AND cTitle='" & SQLEncrypt(sTitle) & "' AND cDescription='" & SQLEncrypt(sTitle) & "' AND cType=" & CATEGORY_TYPE_NEWS & " ORDER BY cID DESC"
			Set oRs = DBRecordSet(oCnMain, rSQL)
			If Not oRs.EOF Then
				AddCategoryNews = oRs(0)
			Else
				AddCategoryNews = -1
			End If
		Else
			AddCategoryNews = oRs(0)
		End If

		Set oRs = Nothing
	End Function

	' Add a news (insert query)
	' IN  : sTitle (string) : news' title (table news, field nTitle)
	'     : dDate (datetime) : news' posting date (table news, field nDate)
	'     : sAuthor (string) : news' author (table news, field nAuthor)
	'     : sHeader (string) : news' header (table news, field nHeader)
	'     : sText (string) : news' content (table news, field nText)
	'     : sImage (string) : news' image path (table news, field nImage)
	'     : sURL (string) : news' source (table news, field nURL)
	'     : iCategory (int) : news' category (table news, field nCategory)
	'     : iVersion (int) : news' version (table news, field nVersion)
	'     : bValid (boolean) : news' validation (table news, field nValid)
	' OUT : (boolean) : True if added
	Function AddNews(sTitle, dDate, sAuthor, sHeader, sText, sImage, sURL, iCategory, iVersion, bValid)
		Dim rSQL, dEndDate, bTagged
		dEndDate = RequestDate("nEndDate")
		If dEndDate = RequestDate("DummyDate") Then dEndDate=DateSerial(9999,12,31)
		bTagged =RequestBoolean("nTagged")

		rSQL =	"INSERT INTO news" & _
				" (nTitle, nDate, nEndDate, nAuthor, nHeader, [nText], nImage, nURL, nCategory, nVersion, nValid, nTagged)" & _
				" VALUES" & _
				" ('" & SQLEncrypt(sTitle) & "'" & _
				", '" & DateTimeToString(Local2GMT( dDate )) &"'" & _
				", '" & DateTimeToString(Local2GMT( dEndDate )) &"'" & _
				", '" & SQLEncrypt(sAuthor) & "'" & _
				", '" & SQLEncryptADMIN(sHeader) & "'" & _
				", '" & SQLEncryptADMIN(sText) & "'" & _
				", '" & SQLEncrypt(sImage) & "'" & _
				", '" & SQLEncrypt(sURL) & "'" & _
				", " & cLng(SQLEncrypt(iCategory)) & _
				", " & cLng(SQLEncrypt(iVersion)) & _
				", " & cLng(bValid) & _
				", " & cLng(bTagged) & _
				")"
	'	DebugPrint "rSQL:'"&rSQL&"'"
		DBExecute oCnMain, rSQL

		AddNews = True
	End Function

	' Modify news (update query)
	' IN  : iID (int) : news' id (table news, field nID)
	'     : sTitle (string) : news' title (table news, field nTitle)
	'     : dDate (datetime) : news' posting date (table news, field nDate)
	'     : sAuthor (string) : news' author (table news, field nAuthor)
	'     : sHeader (string) : news' header (table news, field nHeader)
	'     : sText (string) : news' content (table news, field nText)
	'     : sImage (string) : news' image path (table news, field nImage)
	'     : sURL (string) : news' source (table news, field nURL)
	'     : iCategory (int) : news' category (table news, field nCategory)
	'     : iVersion (int) : news' version (table news, field nVersion)
	'     : bValid (boolean) : news' validation (table news, field nValid)
	' OUT : (boolean) : True if modified
	Function ModifyNews(iID, sTitle, dDate, sAuthor, sHeader, sText, sImage, sURL, iCategory, iVersion, bValid)
		Dim rSQL, dEndDate, bTagged
		dEndDate = RequestDate("nEndDate")
		bTagged =RequestBoolean("nTagged")

		rSQL =	"UPDATE news SET nTitle='" & SQLEncrypt(sTitle) & _
				"', nDate='" & DateTimeToString(Local2GMT( dDate )) & _
				"', nEndDate='" & DateTimeToString(Local2GMT( dEndDate )) & _
				"', nAuthor='" & SQLEncrypt(sAuthor) & _
				"', nHeader='" & SQLEncryptADMIN(sHeader) & _
				"', [nText]='" & SQLEncryptADMIN(sText) & _
				"', nImage='" & SQLEncrypt(sImage) & _
				"', nURL='" & SQLEncrypt(sURL) & _
				"', nCategory=" & SQLEncrypt(iCategory) & _
				", nVersion=" & SQLEncrypt(iVersion) & _
				", nValid=" & clng(bValid) & _
				", nTagged=" & clng(bTagged) & _
				" WHERE nID=" & SQLEncrypt(iID)
		DBExecute oCnMain, rSQL

		ModifyNews = True
	End Function

	' Delete news (delete query) and delete comments associated !!!
	' IN  : iID (int) : news' id (table news, field nID)
	' OUT : (boolean) : True if deleted
	Function DeleteNews(iID)
		Dim rSQL

		rSQL = "DELETE FROM comments WHERE cItem=" & iID & " AND cType=" & CATEGORY_TYPE_NEWS
		DBExecute oCnMain, rSQL
		rSQL = "DELETE FROM news WHERE nID=" & iID
		DBExecute oCnMain, rSQL

		DeleteNews = True
	End Function

	Function ValidateNews(iID)
		Dim rSQL	', bValid
	'	bValid = dLookupM("nValid","news","nID=" & iID)
	'	bValid = not bValid
		
		rSQL =	"UPDATE news SET nValid=" & TextBoolean(NOT dLookupM("nValid","news","nID=" & iID)) & " WHERE nID=" & iID
	'	DebugPrint rSQL
		DBExecute oCnMain, rSQL

		ValidateNews = True
	End Function


	' Process actions
	' IN  : -
	' OUT : -
	Sub DoAdminNews()
		Dim nDate, nValid, iCategory
		Select Case Request("do") 
			Case "add"  : 
				nDate = RequestDate("nDate")
				If Request.Form("nCategory_add") <> "" Then 
					iCategory = AddCategoryNews(Request.Form("nCategory_add"))
				Else
					iCategory = RequestNum("nCategory")
				End If
				If Not IsNumeric(iCategory) Then iCategory=0
				nValid = RequestBoolean("nValid")

				If AddNews(	Request.Form("nTitle"), nDate, Request.Form("nAuthor"), Request.Form("nHeader"), Request.Form("nText"), _
							Request.Form("nImage"), Request.Form("nURL"), iCategory, Request.Form("nVersion"), nValid) Then 
					If bAutoBackEnd Then GenerateBackEndNews(GLOBAL_NEWS_LINKS_TOP) ' Generate a new backend
					sInfoPage = GetTranslation("LANG_NEWS") & " - " & GetTranslation("LANG_ADD_SUCCESS")
				Else
					sInfoPage = GetTranslation("LANG_NEWS") & " - " & GetTranslation("LANG_ADD_ERROR")
				End If
					
			Case "updt" : 
				nDate = RequestDate("nDate")
				If Request.Form("nCategory_add") <> "" Then 
					iCategory = AddCategoryNews(Request.Form("nCategory_add"))
				Else
					iCategory = Request.Form("nCategory")
				End If
				nValid = RequestBoolean("nValid")

				If ModifyNews(	Request.Form("nID"), Request.Form("nTitle"), nDate, Request.Form("nAuthor"), Request.Form("nHeader"), _
								Request.Form("nText"), Request.Form("nImage"), Request.Form("nURL"), iCategory, Request.Form("nVersion"), nValid) Then 
					If bAutoBackEnd Then GenerateBackEndNews(GLOBAL_NEWS_LINKS_TOP) ' Generate a new backend
					sInfoPage = GetTranslation("LANG_NEWS") & " - " & GetTranslation("LANG_MODIFY_SUCCESS")
				Else
					sInfoPage = GetTranslation("LANG_NEWS") & " - " & GetTranslation("LANG_MODIFY_ERROR")
				End If

			Case "del"  :
				If DeleteNews(Request.Form("nID")) Then 
					If bAutoBackEnd Then GenerateBackEndNews(GLOBAL_NEWS_LINKS_TOP) ' Generate a new backend
					sInfoPage = GetTranslation("LANG_NEWS") & " - " & GetTranslation("LANG_DELETE_SUCCESS")
				Else
					sInfoPage = GetTranslation("LANG_NEWS") & " - " & GetTranslation("LANG_DELETE_ERROR")
				End If

			Case "val"	
				If ValidateNews(RequestNum("ID")) Then
					sInfoPage = GetTranslation("LANG_NEWS") & " - " & GetTranslation("LANG_VALIDATE_SUCCESS")
				Else
					sInfoPage = GetTranslation("LANG_IMAGE") & " - " & GetTranslation("LANG_VALIDATE_ERROR")
				End If
		End Select
	End Sub

	' Display page
	' IN  : -
	' OUT : -
	Sub DisplayAdminNewsPage()
		Dim sDate, dDatePage, bAscSorted, sSortedField
		
		bAscSorted = True
		sSortedField = ""
		
		sSortedField = RequestSession("sort","")
		If sSortedField <> "" Then sSortedField = LCase(sSortedField)
		If RequestSession("sortype","") = "desc" Then bAscSorted = False

		dDatePage = Request("date")
		If dDatePage = "" Then 
			dDatePage = LocalDate
		Else
			dDatePage = StringToDate(dDatePage)
		End If

		Select Case Request("do")
			Case "view" : 
				DisplayAdminNews Request("id")
			Case "preview" : 
			'	sDate = Request.Form("nAnnee") & Request.Form("nMois") & Request.Form("nJour") & " " & Request.Form("nHeure") & ":" & Request.Form("nMinute") & ":00"
				sDate = RequestDate("nDate")
				DisplayPreviewNews Request.Form("nTitle"), sDate, Request.Form("nAuthor"), Request.Form("nHeader"), Request.Form("nText"), Request.Form("nImage"), Request.Form("nURL")
			Case "new"  : 
				EditNews 0
			Case "edit" : 
				EditNews Request("id")
			Case "cdel" : 
				ConfirmDeleteNews Request("id")
		End Select

		If Request("do") <> "preview" Then
			DisplayTopNewsAdmin sSortedField, bAscSorted
			DisplayAdminOldNews dDatePage
		'	DisplayNewsNavigation dDatePage
			DisplayAdminNewsToValidate
		End If
	End Sub
%>