<%@ include file="/includes.jsp"%>
<tiles:importAttribute />
<%--This imports all tiles attributes to page --%>
<%-- Requirement #336(New Images don't get automatically fetched)--%>

<c:choose>
	<c:when test="${'Response' eq consultationNoteForm.view.formName}">
		<c:if
			test="${(3 ne emdt.currentCareSpell.referralDetails.referralStatus) and (2 ne emdt.currentCareSpell.referralDetails.referralStatus)}">
			<input type="hidden" id="saveAndEditLater"></input>
			<div class="leftSaveSmallDiv"
				onclick="javascript:document.getElementById('saveAndEditLater').value='true';saveNote();"><br />
			Save and Edit later</div>
			<div class="centerSaveSmallDiv" title="Patient details for printing"
				onclick="printPatient()"><br />
			Print</div>
			<div id="save" class="rightSaveSmallDiv" onclick="send()"><br /><c:out value="${consultationNoteForm.view.buttonValue}"/></div>
			<br />
			<br />
			<br />
			<br />

		</c:if>
	</c:when>
	<c:otherwise>
		<table>
			<c:if test="${consultationNoteForm.view.totalPages gt 1}">
			<tr>
				<td align="left" colspan="2"><c:out value="${consultationNoteForm.view.currentPage.label}"/> (page <c:out value="${consultationNoteForm.view.currentPageIndex + 1}"/> of <c:out value="${consultationNoteForm.view.totalPages}"/>)</td>
				<td align="right" colspan="2"><tiles:insertTemplate template ="../../../emdt/tiles/consultationNoteNavButtons.jsp"/></td>
			</tr>
			</c:if>
			<tr>
				<td align="left" width="35%">
				<div class="leftSaveDiv">
				<a href="javascript:patientHistory(<c:out value="${consultationNoteForm.view.form.id}"/>, <c:out value="${consultationNoteForm.view.form.id}"/>);">
				<br />Show History/Make new Form</a></div>
				</td>
				<td align="center" width="30%" valign="top"><!-- 
				<div id="seriesDetails" style="display: block;">
				<table border="1" bordercolor="#b4b4b4" width="90%">
					<tr class="tableHeader">
						<th class="tableColHeader" width="55%">View Image</th>
						<th class="tableColHeader" width="45%">Log</th>
					</tr>
					<tr>
						<td align="center"><a href="#"
							onclick="callAjaxRequest('preTreatmentCTScanPopup');"><img
							src="../referrals/images/viewIcon.png"
							title="Click here to view the image" /></a></td>
						<td align="center"><a style="text-decoration: underline"
							title="Click here to view log of <c:out value="${imgStatus.accessionNum}"/>"
							href="../referrals/imageTransferLog.form?noteId=<c:out value="${imgStatus.formId}"/>&accNum=<c:out value="${imgStatus.accessionNum}"/>">View
						Log</a></td>

					</tr>
				</table>
				</div>
				 -->
				<div id="preTreatmentCTScanPopup" style="display: none;"
					class="contentPopup">
				<table align="center" border="0" bordercolor="#b4b4b4" width="100%">
					<tr class="borderbot">
						<td class="headtxt">Available Images</td>
						<td><a id="preTreatmentCTScanClose" style="color: red;"
							class="popupContactClose"
							onclick="disablePopup('preTreatmentCTScanPopup');">x</a></td>
					</tr>
					<tr>
						<td height="30"></td>
					</tr>
					<tr>
						<td width="100%" align="center">
						<table border="1" bordercolor="#b4b4b4" width="100%"
							id="preTreatmentCTScanTable">
							<tr class="tableHeader">
								<th class="tableColHeader" width="10%">Modality</th>
								<th class="tableColHeader" width="50%">Description</th>
								<th class="tableColHeader" width="15%">No of Images</th>
								<th class="tableColHeader" width="15%">View Image</th>
							</tr>
						</table>
						</td>
					</tr>
				</table>
				</div>
				</td>
				<td align="right" width="35%">
				<div id="save" class="rightSaveDiv" onclick="saveNote();"><br />
				<c:out value="${consultationNoteForm.view.buttonValue}"/></div>
				</td>
			</tr>
		</table>
		<br />
		<br />
	</c:otherwise>
</c:choose>
<c:if test="${error ne null}">
	<div class="error">
		<img src="../images/16x16/error.png" alt="!" border="0" />
		<c:out value="${error}"/>
		<br />
	<br />
	<br />
	</div>
</c:if> 
 <c:choose>
	<c:when
		test="${requestScope.successMsg ne null || requestScope.errorMsg ne null}">
		<c:if test="${requestScope.successMsg ne null}">
			<div class="message"><img src="../images/16x16/information.png"
				alt="i" /> <c:out value="${requestScope.successMsg}"/></div>
			<br />
		</c:if>
		<c:if test="${requestScope.errorMsg ne null}">
			<div class="error"><img src="../images/16x16/error.png" alt="e" /><c:out value="${requestScope.errorMsg}"/></div>
			<br />
		</c:if>
	</c:when>
	<c:otherwise>
		<c:set var="msg" value='<%=request.getParameter("successMsg")%>' />
		<c:if test="${(null ne msg) and ('null' ne msg)}">
			<div class="message"><img src="../images/16x16/information.png"
				alt="i" /> <c:out value="${msg}"/></div>
			<br />
		</c:if>
	</c:otherwise>
</c:choose><!-- END buttons and errors -->