<%@ include file="/includes.jsp"%>
<jsp:useBean id="changePatientsPaginationData" class="com.ardeo.util.PaginationData" scope="session"/>
<c:if test="${param.pageSize != null}">
	<jsp:setProperty name="changePatientsPaginationData" property="pageSize"  value="${param.pageSize}"/>
</c:if>
<jsp:setProperty name="changePatientsPaginationData" property="size"  value="${fn:length(patients)}"/>
<c:choose>
	<c:when test="${param.pageNum != null}">
		<jsp:setProperty name="changePatientsPaginationData" property="currentPage"  value="${param.pageNum}"/>
	</c:when>
	<c:otherwise>
		<jsp:setProperty name="changePatientsPaginationData" property="currentPage" value="1"/>
	</c:otherwise>
</c:choose>
<script>
	function changePageSize(el) {
		document.location = 'addMeetingPatients.form?action=paginationAction&pageSize=' + el.options[el.selectedIndex].value;
	}
</script>
<table width="100%">
	<tr>
		<td align="left">
			<c:choose>
				<c:when test="${changePatientsPaginationData.previousPageNum != null}">
					<a title="Previous Page" href="addMeetingPatients.form?action=paginationAction&pageNum=<c:out value="${changePatientsPaginationData.previousPageNum}"/><c:out value="${sortOrderBySelectedPatients}"/>"><img src="../images/16x16/action_back.png"/></a>
				</c:when>
				<c:otherwise>
					<img src="../images/16x16/action_back_disabled.png"/>
				</c:otherwise>
			</c:choose>
			</td>
			<td align="center"><b>Page <c:out value="${changePatientsPaginationData.currentPage }"/> of <c:out value="${changePatientsPaginationData.numberOfPages }"/></b></td>
			<td width="1" align="right">
				<c:choose>
				<c:when test="${changePatientsPaginationData.nextPageNum != null}">
					<a title="Next Page" href="addMeetingPatients.form?action=paginationAction&pageNum=<c:out value="${changePatientsPaginationData.nextPageNum}"/><c:out value="${sortOrderBySelectedPatients}"/>"><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">
			<c:if test="${sessionScope.ignoreFilters != 'true' }">
				<c:out value="${mplHelper.allPatientsCount - fn:length(patients)}"/> patient(s) have been filtered out&nbsp;&nbsp;
			</c:if>Show 
			<select name="selectPageSize" onchange="changePageSize(this)">
				<webapp:option value="10" currentValue="${changePatientsPaginationData.pageSize}">10</webapp:option>
				<webapp:option value="20" currentValue="${changePatientsPaginationData.pageSize }">20</webapp:option>
				<webapp:option value="30" currentValue="${changePatientsPaginationData.pageSize }">30</webapp:option>
				<webapp:option value="40" currentValue="${changePatientsPaginationData.pageSize }">40</webapp:option>
				<webapp:option value="50" currentValue="${changePatientsPaginationData.pageSize }">50</webapp:option>
				<webapp:option value="${changePatientsPaginationData.size }" currentValue="${changePatientsPaginationData.pageSize }">All</webapp:option>
			</select> items per page
		</td>
	</tr>
</table>