<%@ include file="/includes.jsp"%>
<style>
.backButtonHolder{
	padding-top:5px;
	width:231px;
	height:75px;
	float:left;
	margin: 0 0 0 320px;
	display:inline;
	background:url(../referrals/images/imgPinkLong.gif) top center;
	background-repeat:no-repeat;
	text-align:center;
	font-weight: bold;
	color: #02018b;
	cursor: pointer;
}
</style>
<c:if test="${emdt.currentMeeting ne null}">
	<div class="backButtonHolder"  onclick="location.href='../meetings/resumeMeeting.form'"> Resume Current Meeting </div>
</c:if>
<c:choose>
	<c:when test="${filterForm.name ne null }"><c:set var="nameOfForm" value="${filterForm.name}"></c:set></c:when>
	<c:otherwise><c:if test="${consultationNoteForm ne null}"><c:set var="nameOfForm" value="${consultationNoteForm.view.formName}"></c:set></c:if></c:otherwise>
</c:choose>
<c:set var="msg1" value='<%=request.getParameter("successMsg")%>' />
<c:if test="${referralPatientDto.currentCareSpell.referralsDefinition ne null || emdt.currentCareSpell.referralsDefinition ne null}">
	<c:choose>
		<c:when
			test="${referralPatientDto.currentCareSpell.referralsDefinition ne null}">
			<c:set var="referralsDefinition" value="${referralPatientDto.currentCareSpell.referralsDefinition}" scope="request"></c:set>
		</c:when>
		<c:otherwise>
			<c:set var="referralsDefinition" value="${emdt.currentCareSpell.referralsDefinition}" scope="request"></c:set>
		</c:otherwise>
	</c:choose>
	<c:set var="currentCareSpell" value="${emdt.currentCareSpell}" scope="session"></c:set>
</c:if>
<c:if test="${referralsDefinition ne null}">
	<c:set var="groupBy" value="" scope="request"/>
	<c:if test="${nameOfForm !=null or nameOfForm ne ''}">
		<c:forEach var="formSummaryMapOrder"
			items="${referralsDefinition.formSummaryMapOrder}">
			<c:if test="${formSummaryMapOrder.formOrSummaryName eq nameOfForm and formSummaryMapOrder.groupName!='Top Level' }">
				<c:set var="groupBy" value="${formSummaryMapOrder.groupName}" scope="request"></c:set>
			</c:if>

		</c:forEach>
	</c:if>
	<c:if test="${nameOfForm !=null or nameOfForm ne ''}">
		<c:forEach var="formSummaryMapOrder"
			items="${referralsDefinition.formSummaryMapOrder}">
			<c:if
				test="${formSummaryMapOrder.formOrSummaryName eq summaryName and formSummaryMapOrder.groupName=='Top Level' }">
				<c:set var="groupBy" value="" scope="request"></c:set>
			</c:if>
		</c:forEach>
	</c:if>
	<c:choose>
		<c:when test="${ summaryName eq null and ((null eq nameOfForm) or  ('' eq nameOfForm)) and addToMeeting ne true }">
			<c:set var="menuButtonHolderDivClass" value="menuButtonSquare selected"/>
		</c:when>
		<c:otherwise>
			<c:set var="menuButtonHolderDivClass" value="menuButtonSquare blue"/></c:otherwise>
	</c:choose>
	<c:choose>
		<c:when test="${groupBy ne null and groupBy ne ''}">
			<c:choose>
				<c:when test="${groupBy eq 'Images and ReportsXXX'}">
					<c:set var="menuButtonHolderClass" value="menuButtonSquare blue"/>
					<c:set var="menuHolderClass" value="menuSubHolderBig"/>
				</c:when>
				<c:otherwise>
					<c:set var="menuButtonHolderClass" value="menuButtonSquare blue"/>
					<c:set var="menuHolderClass" value="menuHolder"/>
				</c:otherwise>
			</c:choose>
			<div class="${menuHolderClass}">
				<div class="${menuButtonHolderClass}">
					<a href="../referrals/viewPatient.form?formName=">Patient<br /> Demographics </a></div>
				<c:choose>
					<c:when test="${groupBy eq 'Images and ReportsXXX'}">
							<div class="${menuButtonHolderClass}"> <a href="../referrals/imgStatusTracking.form"><span>View Images</span></a></div>
					</c:when>
					<c:otherwise>
						<tiles:insertTemplate template="forms/groupFormsMenu.jsp" flush="true"/>
					</c:otherwise>
				</c:choose>
			</div>
			<div class="menuHolder">
				<tiles:insertTemplate template="forms/formsMenu.jsp" flush="true"/>
			</div>
		</c:when>
		<c:otherwise>
			<div class="menuHolder">
				<div class="<c:out value="${menuButtonHolderDivClass}"/>">
					<a href="viewPatient.form?formName=">Patient<br /> Demographics</a>
				</div>
				<tiles:insertTemplate template ="forms/groupFormsMenu.jsp"  />
			</div>
		</c:otherwise>
	</c:choose>
</c:if>