<!--#include file="../library/libraryinc.inc" -->
<%
	Timeout(1)
	
	Set con = Server.CreateObject("ADODB.Connection")
	con.Open Application("CString")
	
%>
<html>
<head>
<title>Website Administration</title>
<script language="JavaScript">
function MM_openBrWindow(theURL,winName,features) 
{ 
	window.open(theURL,winName,features);
}

function ConfirmDelete(varURL, varFrame)
{
	if (window.confirm("Are you sure you want to Delete this News Article ?"))
		window.open(varURL, varFrame);
}

</script>

<link rel="stylesheet" href="../StyleSheet.css" type="text/css">
</head>

<body>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr > 
    <td class="pageheadings"> Maintain news </td>
  </tr><tr>
    <td height="30" valign="top" class="tableborders"><input name="gotoAdd2" type="button" class="button" value=" Add an Article" onClick="javascript:window.open('add_news.asp?CMS_HeightOffSet=380&cache=<%=Server.URLEncode(Now())%>','_self');">
    </td>
  </tr>
  <tr>
    <td valign="top" class="tableborders">
<%	


			strSQL = "SELECT NewsID, Title, NewsDate, NewsDateEnd, ShortDesc, Headline FROM News ORDER BY NewsDate DESC"
			
			set rsNews = server.createobject("ADODB.Recordset")
			rsNews.open strSQL, con, 3, 1
		
		
			if rsNews.EOF then
%>
	  <p>There are no news articles!</p>
      <%
			else
			
				rsNews.PageSize = 15
					
				intPageCount = rsNews.PageCount
				
				if request("intPage") <> empty and IsNumeric(request("intPage")) then
					intPage = CInt(request("intPage"))
				else
					intPage = 1
				end if
				
				if intPage > intPageCount then
					intPage = intPageCount
				elseif intPage < 1 then
					intPage = 1
				end if
				
				rsNews.AbsolutePage = intPage
				
				if intPagecount > 1 then
%>
	  <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <TR> <td width="150" align="center">
<%
					if CDbl(intPage) > 1 then
%><input name="" type="button" value="Previous" class="button"  onClick="javascript:window.open('News.asp?CategoryID=<%=Request("CategoryID")%>&intPage=<%=(intPage - 1)%>&buster=<%=Server.URLEncode(Now())%>','_self');" >
<%
					else
%>
		  <img src="../Images/spacer.gif" width="1" height="1"> 
<%
					end if
%></td>  
          <td align="center">
		    <table border="0" cellspacing="1" cellpadding="0">
			  <tr align="center">
			    <td><p><b>Pages:</b></p></td>
<%
					for i=1 to intPagecount
					
						if i = CDbl(intPage) then
%>
				<td width="17" height="22" background="../images/page_on.gif"><p><%=i%></p> </td> 
<% 
						else
%>
				<td width="17" height="22" background="../images/page_off.gif" style="cursor:hand;" onClick="javascript:window.open('News.asp?CategoryID=<%=Request("CategoryID")%>&intPage=<%=i%>&buster=<%=Server.URLEncode(Now())%>','_self');"><p><%=i%></p></td> 
<% 
						end if
						
					next
%>
	  		  </tr>
			</table>
		  </td>
<td width="150" align="center">
<%
					if CDbl(intPage) <> intPagecount then
%><input name="" type="button" value="Next" class="button"
  onClick="javascript:window.open('News.asp?CategoryID=<%=Request("CategoryID")%>&intPage=<%=(intPage + 1)%>&buster=<%=Server.URLEncode(Now())%>','_self');" >
<%
					else
%>
<img src="../Images/spacer.gif" width="1" height="1">
<%
					end if
%></td>
        </tr>
      </table>
	</td>
  </tr>
  <tr>
    <td height="100%" valign="top" class="tableborders">
<%
				end if
%>
	  <table width="100%" border="0" cellspacing="1" cellpadding="0">
        <tr> 
          <td height="22" colspan="3"></td>
          <td height="22" align="center" class="tableheadings">Article 
              Heading</td>
          <td width="150" align="center" class="tableheadings">Starts</td>
          <td width="150" align="center" class="tableheadings">Expires</td>
        </tr>
<%
				counterx=0
				
				for i = 1 to rsNews.PageSize
		
					i_NewsID 		= rsNews("NewsID")
					s_Title 			= rsNews("Title")
					s_NewsDate 	= rsNews("NewsDate")
					s_NewsDateEnd = rsNews("NewsDateEnd")
					s_ShortDesc 	= rsNews("ShortDesc")
					b_Headline		= rsNews("Headline")			
%>
        <!--#include file="../library/eyeline.asp" -->
        <tr > 
          <td width="23" height="22" align="center" class="icon" onClick="javascript:window.open('edit_news.asp?CategoryID=<%=Request("CategoryID")%>&id=<%=i_NewsID%>&strSQL=<%=Server.URLEncode("SELECT Article FROM News WHERE NewsID = "& i_NewsID)%>&intPage=<%=request("intPage")%>&buster=<%=server.URLEncode(now)%>','right');"> 
            <img src="../Images/icons_edit.gif" alt="Edit"></td>
          <td width="23" height="22" align="center" class="icon" onClick="javascript: window.open('../CMS_Page_Images/photos_news.asp?ptype=3&newsID=<%=i_NewsID%>&buster=<%=Server.URLEncode(Now())%>','','scrollbars=yes,resizable=yes,width=720,height=450');"><img src="../Images/icons_image.gif" alt="Images" width="16" height="15"></td>
          <td width="23" height="22" align="center" class="icon" onClick="javascript:ConfirmDelete('delete_news.asp?CategoryID=<%=Request("CategoryID")%>&id=<%=i_NewsID%>&intPage=<%=request("intPage")%>&buster=<%=Server.URLEncode(Now())%>','right');"><img src="../Images/icons_delete.gif" alt="Delete"></td> 
            
          <td height="22" bgcolor="<%=colorx%>" class="TextInCell" > 
            <b><%=Server.HTMLEncode(s_Title)%></b></td>
          <td align="right" bgcolor="<%=colorx%>" class="TextInCell" ><%=Day(s_NewsDate) &" "& MonthName(Month(s_NewsDate)) &" "& Year(s_NewsDate)%></td>
          <td align="right" bgcolor="<%=colorx%>" class="TextInCell" ><%=Day(s_NewsDateEnd) &" "& MonthName(Month(s_NewsDateEnd)) &" "& Year(s_NewsDateEnd)%></td>
        </tr>
<%
					rsNews.movenext
					
					if rsNews.EOF then exit for
					
				Next
%>
      </table>
<%
			end if
			
			rsNews.close
			set rsNews = Nothing
					
	
%>
	</td>
  </tr>
</table>
</body>
</html>
<%
	Set rsCats = Nothing
	
	con.Close
	set con = Nothing
%>
