<%@ include file="/includes.jsp" %>
<%@ taglib prefix="smvc" uri="http://www.springframework.org/tags/form" %>
<script language="javascript">
	
	function checkAndSubmit(myform){
		var destination = document.getElementById("destination");
		if(destination && destination.value == ""){
			destination.focus();
			alert("Please enter a valid destination.");
			return false;
		}
		var forename = document.getElementById("referoutForename");
		if(forename && forename.value == ""){
			forename.focus();
			alert("Please enter a valid forename.");
			return false;
		}
		var surname = document.getElementById("referoutSurname");
		if(surname && surname.value == ""){
			surname.focus();
			alert("Please enter a valid surname.");
			return false;
		}
		var referOutDate = document.getElementById("referOutDate");
		if(referOutDate && !isDate( referOutDate.value, 'Refer Out') ){
			referOutDate.focus();
			return false;
		}
		var referOutReason = document.getElementById("referOutReason");
		if(referOutReason &&  referOutReason.value == "" ){
			referOutReason.focus();
			alert("Please enter a refer out reason.");
			return false;
		}
		return submitTheForm();
	}

</script>
<smvc:form id="nrlReferOut" method="post" modelAttribute="patientInfo"  onsubmit="return checkAndSubmit(this);" >
<input type="hidden" name="redirectParams" value="<c:out value="${requestScope['javax.servlet.forward.query_string']}" />" />
	<input id="nrlPatientId" type="hidden" name="nrlPatientId" value="<c:out value="${patientInfo.patientId}"/>"/>
	<smvc:errors path="errors" cssClass="error"></smvc:errors>
<table>
	<tr>
		<td class="error"><c:out value="${model.errorMsg}"></c:out></td>
	</tr>
	<tr>
        <td>&#160;  
        	<c:if test="${yourNotesSaved == true }">
				<div class="message">
					The patient has been referred out !	
				</div>
			</c:if>
		</td>
		<td class="error">&nbsp;<smvc:errors path="yourNotes"/></td>
    </tr>
</table>

<table cellspacing="0" width="850" border="1" class="table">
	<tr>
		<td width="100%">
		<table border="1" width="100%" cellspacing="0" class="table">		
		
			<tr>
				<td class="nrltableTitleBarNoBold"> <B>Refer out</B>
				</td>
			</tr>
			<tr>
				<td>
					<table width="100%" border ="1" class="nrltableWhiteBorder" >
						
							
						<tr>	
							<td colspan="9" class="nrlBrown" > 
                    			<!-- <jsp:include page="/nrl/common/nrlPatientInfo.jsp"></jsp:include>	
                    			-->
                    			<%@ include file="/nrl/common/nrlPatientInfo.jsp" %>
                    		</td>
						</tr>					
					</table>
				</td>
			</tr>

			<tr>
				<td>
							<%@ include file="/nrl/common/nrlFromInfoLayout.jsp" %>
				</td>
			</tr>
			<tr>	
				<td  class="nrlBrownBlackText" >
					<table>
						<tr>
							<td width="15%">&#160;
							</td>
							<td width="85%">Existing Notes
							</td>
						</tr>
						
					</table>
				</td>
			</tr>
			<tr width="100%">
			
				<td width="100%">
					<table><tr>
						<td width="20%">&#160;</td>
						<td width="80%">
							<%@ include file="allNotes.jsp" %>
						</td>
						<td width="10%">&#160;</td>
					</tr></table>
				</td>
				
			</tr>
				
			<tr>	
				<td  class="nrlBrown"  align="Center" >&#160;</td>
			</tr>		
			<tr>
				<td width="100%">
					<%@ include file="/nrl/tiles/nrlMedicalContactDetails.jsp" %>
				</td>
			</tr>		
			<tr>	
				<td  class="nrlBrown"  align="Center" >
				 &#160; 
				 <input type="submit" value="Submit" id="nrlReferOut" class="nrlBtn" />
				 &#160;</td>
			</tr>	
		</table>
		</td>
	</tr>
	
</table>
	</smvc:form>



