<%--
  Copyright 2003 Sun Microsystems, Inc. All rights reserved 
  Use is subject to license terms.
 --%>
<%-- @(#)pageFooter.jsp --%>

<!-- Beginning of Page Footer  -->
<% 
Integer total1 = (Integer)pageContext.getAttribute("total1");
Integer total2 = (Integer)pageContext.getAttribute("total2");
int total = 0;

if ((total1 == null) && (total2 == null)) {
   total = 0;
} else if ((total2 == null) || (total1 != null && (total1.intValue() >= total2.intValue()))) {
   total = total1.intValue();
} else if ((total1 == null) || (total2 != null && (total2.intValue() >= total1.intValue()))) {
   total = total2.intValue();
} else {
   total = 1;
}
%>
<% if (total > 1) { %>
<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>
<TR>
<search:getPage id="pg"/>
<% 
String pg = ((Integer)pageContext.getAttribute("pg")).toString();
int currentPage = 1;
if (pg != null)
    currentPage = Integer.parseInt(pg); 
%>

<TD valign="middle" class="discTitle"> Pages:&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 valign="middle">&nbsp;<span class="discFilter"><%= dpage %></span>&nbsp;</TD>
<% } else { %>
    <TD valign="middle">&nbsp;<a class="noUnderline" onClick="document.dform.reset();" href="javascript:document.dform.page.value='<%=dpage%>';document.dform.submit();"><span class="discRating"><%= dpage %></span></a>&nbsp;</TD>
<% } %>
<% dpage++; %>
<td>&nbsp;&nbsp;</td>
<% } %>
</TR>
</TABLE> 
<% } %>
<!-- End of Page Footer  -->
