<%@ include file="/includes.jsp"%>
<%@ taglib prefix="smvc" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<script type="text/javascript">
	function submitform(action) {
		document.getElementById("action").value = action;
		document.getElementById("changeAttendeeForm").submit();
	}
</script>
<c:if test="${fn:length(redirect) gt 0}">
	<input type="hidden" id="redirectpath" value="<c:out value="${redirect}"/>" />
	<Script type="text/javascript">
		document.location = document.getElementById('redirectpath').value;
	</Script>
</c:if>


<div> <%@include file="meetingHeadingPanel.jsp" %></div>

<table width="100%">
	<tr>
		<td valign="top" align="center"><br /> <smvc:form
				modelAttribute="meetingAttendeesForm" id="changeAttendeeForm" action="../meetings/changeMeetingAttendee.form">
				<smvc:errors cssClass="error" path="*"></smvc:errors>
				<input type="hidden" name="redirectParams" value="<c:out value="${requestScope['javax.servlet.forward.query_string']}" />" />
				<input type="hidden" name="page" value="Invites" />
				<table>
					<tr>
						<td align="center"><br /> <c:if test="${message ne null}">
								<table width="100%" cellpadding="4"
									style="border: 2px Blue solid">
									<tr>
										<td><img src="../images/16x16/information.png" alt="!"
											border="0" /></td>
										<td>
											<div class="message"><c:out value="${message}"/></div>
											<br /></td>
									</tr>
								</table>
							</c:if></td>
					</tr>
				</table>
				<br />
				<table width="750" border="0">
					<tr>
						<td><tags:dialogBox title="Change Attendees">
								<table width="100%">
									<thead>
									<tr>
										<th>Attendee name</th>
										<th>E-Mail</th>
										<th align="center">Remove?</th>
									</tr>
									</thead>
									<tbody>
									<c:if
										test="${meetingAttendeesForm.meeting.totAttendees ne '0'}">
										<c:if
											test="${meetingAttendeesForm.meeting.attendees ne null && fn:length(meetingAttendeesForm.meeting.attendees) gt 0}">
											<c:forEach var="attendee"
												items="${meetingAttendeesForm.meeting.attendees}"
												varStatus="index">
												<tr>
													<td>	<c:out value="${attendee.user.fullName }"/></td>
													<td>	<c:out value="${attendee.user.email }"/></td>
													<td align="center" style="text-align: center;" title="Check to remove attendee">
														<smvc:checkbox
															path="selected" value="${attendee.id }" />
													</td>
												</tr>
											</c:forEach>
										</c:if>
									</c:if>
									<tr>
										<td><br/> <c:out value="${fn:length(meetingAttendeesForm.meeting.attendees)}"/> attendees<br/></td>
									</tr>
									</tbody>

									<tfoot>
										<tr>
											<td colspan="2" >
												<input type="button" value="Cancel"	onclick="window.location.href = 'viewMeetingAttendee.form'" />
											</td>
											<td align="right" style="text-align: center;">
												<smvc:hidden path="action" id="action" />
												
												<c:if
													test="${meetingAttendeesForm.meeting.totAttendees ne '0'}">
													<input type="button" value="Remove"
														onclick="submitform('Delete')" title="Remove selected attendees"/>
												</c:if></td>
										</tr>
									</tfoot>
								</table>
							</tags:dialogBox></td>
					</tr>
				</table>
			</smvc:form>
		</td>
	</tr>
</table>