<%
	response.CacheControl = "no-cache"
	set con = Server.CreateObject("ADODB.Connection")
	con.Open Application("CString")


	'----News----
	
		strSQL = "SELECT * "&_ 
				" FROM News where NewsDateEnd >= getdate()  -1  order by NewsDate desc"

	set rsPage = server.createobject("ADODB.RecordSet")
	rsPage.open strSQL, Application("CString"), 3, 1
	s_Heading = "Newsroom"
	'---end News---------
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><%=Server.HTMLEncode(s_Heading)%> :. P.K. Ferraris & Associates - Financial Planning South Africa</title>
<!--#include file="meta.asp"-->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="styles.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="javaFunctions.js"></script>
</head>

<body>
<!--#include file="header.asp"-->
<h1>Latest News</h1>
	   

                   
                    <% 
		   '------Paging
		   if not rsPage.EOF  then%><ul>
					<%rsPage.PageSize = 10
					intPageCount = rsPage.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
							
							rsPage.AbsolutePage = intPage
				   
				   
				   blnVal = false
				  for i = 1 to rsPage.PageSize
						if not rsPage.EOF  then%>
								
								<%if DateDiff("d",rsPage("Newsdate"),date) >= 0 and DateDiff("d",rsPage("NewsdateEnd"),date) <= 0 then
										iCol = iCol + 1
										s_NewsID = rsPage("NewsID")
										s_Title = rsPage("Title")
										s_ShortDesc = rsPage("ShortDesc")
										s_NewsDate = rsPage("NewsDate")
										s_NewsDateEnd = rsPage("NewsDateEnd")
										%>
                    <li> 
                     <a href="news.asp?NewsID=<%=s_NewsID%>" target="_self"><b><%=s_Title%></b></a></b><br> <i>Date: <%=s_NewsDate%></i><br> <%=s_ShortDesc %> <br>&nbsp;
</li>
                    
                    <%
								end if
								rsPage.movenext
								blnVal = true
								
								'''
									  if rsPage.EOF then 
											exit for
									  end if%>
					    <%
					    else
							exit for
							end if
						   
				   next%></ul>
            <%else%>
                   <p>We 
                        are in the process of updating our database...</p>
                  
                    <%end if   
				   %>
            <%
					'buttton display
					if intPagecount >1 then %>
                   <table border="0" cellpadding="0" cellspacing="1">
                          <tr> 
                            <td width="75"><p>More news:</p></td>
                            <%for i=1 to intPagecount
									if i = CDbl(intPage) then
								%>
                            <td class="PageOn"><%=i%></td>
                            <% else%>
                            <td class="PageOff" style="cursor:hand;" onClick="javascript:window.open('news_current.asp?intPage=<%=i%><%=s_request%>','_self');"><%=i%></td>
                            <% end if
							next%>
                           
                        </tr>
                        </table>
                        <%end if%> 
                  
		  <!-- -->
          <br>
          <input name="Button" type="button" class="button" value="Archive News" onClick="javascript:window.open('news_archive.asp','_self','');">
        
        <!--#include file="footer.asp"-->
</body>
</html>
