<%@ include file="/includes.jsp"%>
<script language="javascript">
function textCounter(field, maxlimit) {
if (field.value.length > maxlimit)
field.value = field.value.substring(0,4000);
else
return true;
}
function back(){
document.location="patientDiscussionLink.do"
}
function discard(){
document.location="patientDiscussion.do"
}
function validate(){
var postedTo = document.patientForumDiscussionForm.postedTo.value;
var postedBy = document.patientForumDiscussionForm.postedBy.value;
if(postedTo == postedBy){
alert("You cannot Post the thread to yourself!");
return false;
}
}
</script>
<table>
	<tr>
		<td width=10%><tiles:insertTemplate template="/meetings/tiles/menu.jsp" flush="true" /></td>
		<td width=5%></td>
		<td valign="top" width=85%><s:form
			action="/referrals/patientDiscussion" styleId="patientDiscussion">

			<table border="0" width="70%" height="500">
				<tr>
					<c:if test="${ close ne null}">
						<tr>
							<td valign="top"><span
								style="font-weight: bold; font-size: 10pt; color: #F62817">Thread
							"${topic}" successfully closed</span></td>
						</tr>
					</c:if>


					<td valign="top">
					<fieldset>
					<table class="menu" cellpadding="2" cellspacing="0" border="0"
						width="100%" height="100" align="center">
						<tr>
							<td class="menuItem" colspan="6"><span
								style="font-weight: bold; font-size: 12pt;">Q and A Forum
							- new topic</span><br />
							<br />
							</td>
						</tr>
						<tr>
							<td><span style="font-weight: bold; font-size: 10pt;">Discussion
							Topic</span></td>
							<td colspan="5"><html:text property="discussionTopic"
								maxlength="255" size="86" />
						</tr>
						<tr>
							<td><span style="font-weight: bold; font-size: 10pt;">Posted
							To</span></td>
							<td><html:select property="postedTo" onchange="validate();">
								<html:option value="all">All</html:option>
								<c:forEach var="oneObj" items="${patientForumDiscussionForm.user}">
									<html:option value="<c:out value="${oneObj.username}"/>"><c:out value="${oneObj.username}"/> </html:option>
								</c:forEach>
							</html:select></td>

							<td><span style="font-weight: bold; font-size: 10pt;">Posted
							By</span></td>
							<td><html:text property="postedBy" maxlength="255" size="11" /></td>


							<td>&#160;</td>
							<td>&#160;</td>
						</tr>
						<tr>
							<td><span style="font-weight: bold; font-size: 10pt;">Start
							Date</span></td>
							<td><html:text property="startDate" maxlength="255" size="9"
								readonly="true" /></td>

							<td><span style="font-weight: bold; font-size: 10pt;">End
							Date</span></td>
							<td><webapp:date property="endDate" styleId="endDate" /></td>

							<td><span style="font-weight: bold; font-size: 10pt;">DeadLine
							?</span></td>
							<td><webapp:date property="deadLine" styleId="deadline" /></td>
						</tr>
					</table>
					<table class="menu" cellpadding="6" cellspacing="0" border="0"
						width="100%" height="100" align="center">
						<tr>
							<td><span style="font-weight: bold; font-size: 10pt;">Comments</span></td>
							<td>&#160;</td>
						</tr>
						<tr>
							<td>&#160;</td>
							<td><html:textarea property="comments" rows="7" cols="80"
								value="Enter your text"
								onblur="textCounter(this.form.comments,4000);" /></td>
						</tr>
						<tr>
							<td>&#160;</td>
							<td align="center"><html:button property="button"
								value=" Back " onclick="back();" /> <html:button
								property="button" value=" Discard " onclick="discard();" /> <html:submit
								onclick="this.form.submitName.value='newSubmit'" value=" Post " />
							<html:hidden property="threadId" /> <html:hidden
								property="submitName" /></td>
						</tr>
					</table>
					</fieldset>
					<c:if test="${patientDiscussion ne null}">
						<fieldset>
						<table cellpadding="2" cellspacing="0" border="0" width="100%"
							align="center">
							<tr>
								<td align="center"><span
									style="font-weight: bold; font-size: 10pt;">Response/History</span></td>
							</tr>
						</table>

						<table class="menuInfoBox" cellpadding="6" cellspacing="0"
							border="1" width="100%" height="200" align="center">
							<tr>
								<td align="center" width="20%">Date-Time/Who</td>
								<td align="center" width="80%">Comment:</td>
							</tr>
							<c:forEach var="oneObj" items="${patientForumDiscussionForm.dissHistory}">
								<tr>
									<td align="center" width="20%"><c:out value="${oneObj.commentDate}"/>/<c:out value="${oneObj.username}"/></td>
									<td align="center" width="80%"><<c:out value="${oneObj.comments}"/></td>
								</tr>
							</c:forEach>

						</table>
						</fieldset>
					</c:if></td>
				</tr>
			</table>
		</s:form></td>
	</tr>
</table>

