<%@ include file="/includes.jsp"%>
<%@ taglib prefix="smvc" uri="http://www.springframework.org/tags/form"%>
<script type="text/javascript">
function setTitle(){
	var name = document.getElementById('my_file');
	document.getElementById('patientDocumentMetaDatatitle').value=name.files.item(0).name;
}
</script>
<style type="text/css">
.contentPopup {
    display: none;
	height: auto;
	width: 1000px;
	border: 2px solid #668B8B;
	z-index: 2;
	padding: 10px;
	font-size: 13px;
	background-color: #e0e5eb;
}

#attachFilePopupTable	{
	width: 100%;	
	background-color: #e0e5eb;
}
#popupContactClose	{
	color: red;
	cursor: pointer;
}

</style>
<link href="../referrals/css/main.css" type="text/css" rel="stylesheet" />
<div id="attachFilePopupId" class="contentPopup" >
<table id="attachFilePopupTable">
	<tr>
		<td class="dialogTitle" colspan="4">Add a File...</td>
	</tr>
	<tr><td>&nbsp;</td></tr>
	<tr>
		<td>Title:<br/>
			<smvc:hidden path="patientDocumentMetaData.patientGuid"/>
			<smvc:input path="patientDocumentMetaData.title" id="patientDocumentMetaDatatitle"/>
		</td>
		<td>Category:<br/>
			<webapp:selectAndEditList path="patientDocumentMetaData.category" domain="EMDT" list="DocumentCategory" includeEmpty="false" />
		</td>
		<td>Uploaded By:<br/>
			<smvc:select path="patientDocumentMetaData.selectedUser">
				<smvc:option value=""></smvc:option>
				<c:forEach var="usersByHospitalMap" items="${webapp.usersByHospitalIdMap}">
					<optgroup label="${webapp.hospMap[usersByHospitalMap.key]}">
						<c:forEach var="userId" items="${usersByHospitalMap.value}">
							<smvc:option  value="${userId}" ><c:out value="${webapp.userIdNameMap[userId]}"/></smvc:option>
						</c:forEach>
					</optgroup>
				</c:forEach>
			</smvc:select>
		</td>
		<td>Date of File:<br/>
			<smvc:input path="patientDocumentMetaData.uploadedOnStr" id="patientDocumentMetaDataUploadedOn"/>
			&nbsp;<img title='Click to choose date' style='cursor: pointer' src='../images/16x16/date.png' id="patientDocumentMetaDataUploadedOn_DateTrigger" />
		</td>
	</tr>
	<tr><td colspan="4"><br/><br/></td></tr>
		<tr>
			<td colspan="3"> 
			<input type="file" onchange="setFileSize(this);setTitle();" name="file" size="45" id="my_file" />&#160;
			<input type="button" name="startPatientImport" value="Add File and Finish" onclick="submitForm('','');" /><br /> <br /></td>
			<td align="right"><button type="button" onclick="disablePopup('attachFilePopupId','ajaxFilePathTable');" id="popupContactClose">Cancel</button></td>
		</tr>
	</table>
</div>
