<%@ include file="/includes.jsp"%>
<jsp:useBean id="patientSearchPD" class="com.ardeo.util.PaginationData" scope="session"/>
<c:if test="${param.pageSize != null}">
	<jsp:setProperty name="patientSearchPD" property="pageSize"  value="${param.pageSize}"/>
</c:if>
<jsp:setProperty name="patientSearchPD" property="size"  value="${fn:length(patientSearchDto.referralsPatient)}"/>
<c:choose>
	<c:when test="${param.page != null}">
		<jsp:setProperty name="patientSearchPD" property="currentPage"  value="${param.page}"/>
	</c:when>
	<c:otherwise>
		<jsp:setProperty name="patientSearchPD" property="currentPage" value="1"/>
	</c:otherwise>
</c:choose>
<script type="text/javascript">
	function changePageSize(el) {
	    var parentScreen= document.getElementById('parentpage').value;
		document.location = parentScreen+".form?action=paginationAction&pageSize=" + el.options[el.selectedIndex].value;
	}
</script>
<input type="hidden" id="parentpage" value="<c:out value="${parentpage}"/>"/>
<table width="100%">
	<tr>
		<td width="75%" align="left">Page <c:out value="${patientSearchPD.currentPage }"/> of <c:out value="${patientSearchPD.numberOfPages }"/>
			<c:choose>
				<c:when test="${patientSearchPD.previousPageNum != null}">
					<a title="Previous Page" href="<c:out value="${parentpage}"/>.form?action=paginationAction&page=<c:out value="${patientSearchPD.previousPageNum}"/>"><img src="../images/16x16/action_back.png"/></a>
				</c:when>
				<c:otherwise>
					<img src="../images/16x16/action_back_disabled.png"/>
				</c:otherwise>
			</c:choose>
			<c:choose>
				<c:when test="${patientSearchPD.nextPageNum != null}">
					<a title="Next Page" href="<c:out value="${parentpage}"/>.form?action=paginationAction&page=<c:out value="${patientSearchPD.nextPageNum}"/>"><img src="../images/16x16/action_forward.png"/></a>
				</c:when>
				<c:otherwise>
					<img src="../images/16x16/action_forward_disabled.png"/>
				</c:otherwise>
			</c:choose>
		</td>
		<td align="right" width="25%">
				Show 
			<select  name="selectPageSize" onchange="changePageSize(this)">
				<webapp:option value="10" currentValue="${patientSearchPD.pageSize }">10</webapp:option>
				<webapp:option value="20" currentValue="${patientSearchPD.pageSize }">20</webapp:option>
				<webapp:option value="30" currentValue="${patientSearchPD.pageSize }">30</webapp:option>
				<webapp:option value="40" currentValue="${patientSearchPD.pageSize }">40</webapp:option>
				<webapp:option value="50" currentValue="${patientSearchPD.pageSize }">50</webapp:option>
				<webapp:option value="${patientSearchPD.size }" currentValue="${patientSearchPD.pageSize }">All</webapp:option>
			</select>
			items per page
		</td>
	</tr>
</table>