<%--
  Copyright 2003 Sun Microsystems, Inc. All rights reserved 
  Use is subject to license terms.
 --%>
<%-- @(#)pageFooter.jsp --%>
<%@page language= "java" import="com.sun.portal.search.providers.SearchRequestBean" %>

<%@ taglib uri="/tld/jx.tld" prefix="jx" %>
<%@ taglib uri="/tld/search.tld" prefix="search" %>

<jsp:useBean id="formbean" scope="request" class="SearchRequestBean">
<jsp:setProperty name="formbean" property= "*"/>
</jsp:useBean>

<%-- declare all UI related variables --%>
<jx:declare id="tFontFace" type="java.lang.String"/>

<!-- Beginning of Page Footer  -->
<search:getMaximumPages id="totalInt"/>
<jx:declare id="totalInt" type="Integer"/>

<% 
int total = 0;
if (totalInt != null)
    total = totalInt.intValue();
if (total > 1) { %>
<center> 
<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0><TR>
<% int currentPage = formbean.getPage(); %>
<% if (currentPage > 1) { %>
<TD><a class="noUnderline" onClick="document.searchform.reset();" href="javascript:document.searchform.page.value='<%=currentPage-1%>';document.searchform.submit();"><font face="<%=tFontFace%>"><b>Previous</b></font></a>&nbsp;</TD>
<% } %>

<% 
int max=0, min=0, dpage=0;

if (currentPage < 6) {
  max = 10;
  min = 0;
} else {
  max = currentPage+5;
  min = currentPage-5;
}

dpage = min+1;
while ((dpage <= total) && (dpage >= min) && (dpage <= max)) { %>
<% if (dpage == currentPage) { %>
    <TD>&nbsp;<FONT color='#AAAAAA' face="<%=tFontFace%>"><b><%= dpage %></b></FONT>&nbsp;</TD>
<% } else { %>
    <TD>&nbsp;<a class="noUnderline" onClick="document.searchform.reset();" href="javascript:document.searchform.page.value='<%=dpage%>';document.searchform.submit();"><font face="<%=tFontFace%>"><b><%= dpage %></b></font></a>&nbsp;</TD>
<% } %>
<% dpage++; %>
<% } %>

<% if (currentPage < total) { %>
<TD>&nbsp;<a class="noUnderline" onClick="document.searchform.reset();" href="javascript:document.searchform.page.value='<%=currentPage+1%>';document.searchform.submit();"><font face="<%=tFontFace%>"><b>Next</b></font></a></TD> 
<% } %>

</TR></TABLE> 
</center>
<% } %>
<!-- End of Page Footer  -->
