<?xml version="1.0" encoding="ISO-8859-1"?>

<jsp:root	xmlns:jsp="http://java.sun.com/JSP/Page" 
				xmlns:c="http://java.sun.com/jsp/jstl/core" 
				xmlns:fe="http://www.emdt.ardeo.net/jsp/fe"
				version="2.0">
	<jsp:directive.page contentType="text/html" />
	<c:set var="model" value="${xmlFormCtx.model}" scope="page"/>
	<fe:getAttribute var="formId" element="${model.documentElement}" attribute="id" />
	<form id='<c:out value="${formId}"/>' action="testXmlForm.form" method="post">
		<input type="hidden" name="<c:out value="${xmlFormCtx.actionRequiredRequestParamKey }"/>" id="<c:out value="${xmlFormCtx.actionRequiredRequestParamKey }"/>" value="save"/>
		<input type="hidden" name="_page" id="_page" value="<c:out value="${xmlFormCtx.currentPage}"/>"/>
		<table class="tabpanel" style="width: 500">
			<tr class="tabbar">
				<td width="1" class="tab">
					<!-- PREV PAGE -->
					<c:choose>
						<c:when test="${xmlFormCtx.previousPageAvailable }">
							<img src="../images/16x16/action_back.png" alt="Previous page" border="0" onclick="changePage(${formId}, <c:out value=${xmlFormCtx.actionRequiredRequestParamKey}"/>, <c:out value=${xmlFormCtx.currentPage - 1}"/>)"/>
						</c:when>
						<c:otherwise>
							<img src="../images/16x16/action_back_disabled.png" alt="Previous page (disabled)" border="0"/>
						</c:otherwise>
					</c:choose>
				</td>
				<fe:forEach var="element" element="${model.documentElement}" tagName="page" varStatus="s">
					<fe:formElement var="fe" element="${element}"/>
					<td class="tab <c:out value="${s.count == xmlFormCtx.currentPage ? 'selectedTab' : ''}"/>" onclick="changePage(<c:out value="formId}"/>, <c:out value="${xmlFormCtx.actionRequiredRequestParamKey}"/>, <c:out value="${s.count}"/>)"><c:out value="${fe.label }"/></td>
				</fe:forEach>
				<td width="1" class="tab">
					<!-- NEXT PAGE -->
					<c:choose>
						<c:when test="${xmlFormCtx.nextPageAvailable }">
							<img src="../images/16x16/action_forward.png" alt="Next page" border="0" onclick="changePage(${formId},<c:out value="${xmlFormCtx.actionRequiredRequestParamKey}"/>,<c:out value=" ${xmlFormCtx.currentPage + 1}"/>)"/>
						</c:when>
						<c:otherwise>
							<img src="../images/16x16/action_forward_disabled.png" alt="Next page (disabled)" border="0"/>
						</c:otherwise>
					</c:choose>
				</td>
				<td></td>
			</tr>
			<tr>
				<td colspan="<c:out value="${xmlFormCtx.numberOfPages + 2 }"/>" class="pane">
					<fe:forEach var="formElement" element="${model.documentElement}" tagName="page" varStatus="s">
						<c:if test="${s.count == xmlFormCtx.currentPage}">
							 <c:set var="currentElement" value="${formElement}" scope="request"/>
							 <jsp:include flush="true" page="page.jsp"/>
						</c:if>
					</fe:forEach>
				</td>
			</tr>
			<tr>
				<td colspan="<c:out value="${xmlFormCtx.numberOfPages + 2 }"/>">
					<fieldset style="text-align:center;">
						<a href="javascript:cancel(<c:out value="${formId }"/>,<c:out value="${xmlFormCtx.actionRequiredRequestParamKey }"/>);" title="Cancel"><img src="../images/16x16/Undo.png" title="Cancel" alt="Cancel" border="0"/>Cancel</a>
						&#160;
						<a href="javascript:save(<c:out value="${formId }"/>,<c:out value="${xmlFormCtx.actionRequiredRequestParamKey }"/>);" title="Save"><img src="../images/16x16/accept.png" title="Save" alt="Save" border="0"/>Save</a>
					</fieldset>
				</td>
			</tr>
		</table>
	</form>
</jsp:root>