<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<style type="text/css">
	.fileImg {
		max-height:220px;
		max-width:400px;
	}
</style>
<form:form commandName="divMngVO" id="detailForm" name="detailForm" enctype="multipart/form-data" method="POST">
	<form:hidden path="writer" />
   	<div id="table">
   	<table class="tbl_add">
   		<colgroup>
  			<col width="166">		
  			<col width="">		
  			<col width="166">		
  			<col width="">		
  		</colgroup>
   		<tr>
   			<th>
   				<form:label path="place"><spring:message code="target.divmng.place" /></form:label>
   			</th>
   			<td>
   				<c:choose>
   					<c:when test="${registerFlag == 'create' and loginUserVO.authAdmin eq 1}">
	   					<form:select path="place" cssClass="use">
							<c:forEach var="result" items="${placeList}" varStatus="status">
								<form:option value="${result.code2}" label="${result.codenm}" />
							</c:forEach>
		    			</form:select>
   					</c:when>
   					<c:otherwise>
   						<c:out value="${divMngVO.placeStr}" />
   						<form:hidden path="place" />
   					</c:otherwise>
   				</c:choose>
   			</td>
   			<th>
   				<form:label path="fileImg"><spring:message code="target.divmng.fileImg" /></form:label>
   			</th>
   			<td>
   				<c:if test="${registerFlag eq 'modify' and not empty divMngVO.fileImg}">
   					<img src="<c:url value="/target/divmng/download.do">
								<c:param name="place" value="${divMngVO.place}" />
								<c:param name="no" value="${divMngVO.no}" />
								<c:param name="fileId" value="fileImg" />
							  </c:url>"  alt="<spring:message code="target.divmng" /> 이미지" class="fileImg" /><br />
   					<input type="checkbox" id="chkDelFileImg" name="deleteFile" value="fileImg"/>
   					<label for="chkDelFileImg"><c:out value="${divMngVO.fileImg}" />는 삭제합니다.</label>
   					<br />
   				</c:if>
   				<input type="file" name="fileImgObj" class="input_file" size="60" />
   			</td>
   		</tr>
   		<tr>
   			<th>
   				<form:label path="tel"><spring:message code="target.divmng.tel" /></form:label>
   			</td>
   			<td>
   				<form:input path="tel" cssClass="txt" />
   			</td>
   			<th>
   				<form:label path="tel"><spring:message code="target.divmng.local" /></form:label>
   			</th>
   			<td>
   				<form:input path="local" cssClass="txt" />
   			</td>
   		</tr>
   		<tr>
   			<th>
   				<form:label path="tel"><spring:message code="target.divmng.gubun" /></form:label>
   			</th>
   			<td>
   				<form:radiobutton path="gubun" value="i" label="상주" />&nbsp;&nbsp;&nbsp;
   				<form:radiobutton path="gubun" value="o" label="비상주" />
   			</td>
   			<th>
   				<form:label path="tel"><spring:message code="target.divmng.staffNum" /></form:label>
   			</th>
   			<td>
   				<form:input path="staffNum" cssClass="txt" /> 명
   			</td>
   		</tr>
   		<tr>
   			<th>
   				<form:label path="tel"><spring:message code="target.divmng.condition" /></form:label>
   			</td>
   			<td colspan="3">
   				<form:textarea path="condition" cssClass="ta" />
   			</td>
   		</tr>
   		<tr>
   			<th>
   				<form:label path="tel"><spring:message code="target.divmng.equipStat" /></form:label>
   			</th>
   			<td colspan="3">
   				<form:textarea path="equipStat" cssClass="ta" />
   			</td>
   		</tr>   		
   		<tr>
   			<th><spring:message code="target.divmng.file" /></th>
   			<td colspan="3">
   				<p>
   					<c:if test="${registerFlag eq 'modify' and not empty divMngVO.file1}">
   						<input type="checkbox" name="deleteFile" value="file1"/>
   						<c:out value="${divMngVO.file1}" />는 삭제합니다.
   					</c:if>
   					<input type="file" name="file1obj" class="input_file" size="60" />
   				</p>
 				<p>
 					<c:if test="${registerFlag eq 'modify' and not empty divMngVO.file2}">
   						<input type="checkbox" name="deleteFile" value="file2"/>
   						<c:out value="${divMngVO.file2}" />는 삭제합니다.
   					</c:if>
 					<input type="file" name="file2obj" class="input_file" size="60" />
 				</p>
 				<p>
					<c:if test="${registerFlag eq 'modify' and not empty divMngVO.file3}">
   						<input type="checkbox" name="deleteFile" value="file3"/>
   						<c:out value="${divMngVO.file3}" />는 삭제합니다.
   					</c:if>
					<input type="file" name="file3obj" class="input_file" size="60" />
				</p>
   			</td>
   		</tr>
   	</table>
    </div>
    <div class="boardviewinfo">
		<ul class="right btn-style">
  			<li>
  				<c:choose>
      			<c:when test="${registerFlag == 'modify'}">
       				<a href="<c:url value='/target/divmng/view.do'>
              				<c:param name="place" value="${divMngVO.place}" />
              				<c:param name="no" value="${divMngVO.no}" />
              			 </c:url>"><spring:message code="button.cancel" /></a>
       			</c:when>
       			<c:otherwise>
	    			<a href="<c:url value='/target/divmng/list.do'>
              				<c:param name="place" value="${divMngVO.place}" />
              			 </c:url>"><spring:message code="button.cancel" /></a>
      			</c:otherwise>
     			</c:choose>            	
            </li>
  			<li>
  			   	<a href="javascript:fn_save();">
                  	<c:if test="${registerFlag == 'create'}">
                  		<spring:message code="button.goCreate" />
                  	</c:if>
                  	<c:if test="${registerFlag == 'modify'}">
                  		<spring:message code="button.goModify" />
                  	</c:if>
              	</a>
            </li>           
   		</ul>	
	</div>
   	<!-- <div id="sysbtn">
   		<ul>
   			<li>
            	<span class="btn_blue_l">
	      			<c:choose>
		      			<c:when test="${registerFlag == 'modify'}">
		       				<a href="<c:url value='/target/divmng/view.do'>
                				<c:param name="place" value="${divMngVO.place}" />
                				<c:param name="no" value="${divMngVO.no}" />
                			 </c:url>"><spring:message code="button.cancel" /></a>
		       			</c:when>
		       			<c:otherwise>
			    			<a href="<c:url value='/target/divmng/list.do'>
                				<c:param name="place" value="${divMngVO.place}" />
                			 </c:url>"><spring:message code="button.cancel" /></a>
	       				</c:otherwise>
       				</c:choose>            	
                    <img src="<c:url value='/images/rte/btn_bg_r.gif'/>" style="margin-left:6px;" alt="<spring:message code="button.cancel" />"/>
               	</span>
            </li>
   			<li>
            	<span class="btn_blue_l">
                   	<a href="javascript:fn_save();">
                       	<c:if test="${registerFlag == 'create'}">
                       		<spring:message code="button.goCreate" />
                       		<img src="<c:url value='/images/rte/btn_bg_r.gif'/>" style="margin-left:6px;" alt="<spring:message code="button.goCreate" />"/>
                       	</c:if>
                       	<c:if test="${registerFlag == 'modify'}">
                       		<spring:message code="button.goModify" />
                       		<img src="<c:url value='/images/rte/btn_bg_r.gif'/>" style="margin-left:6px;" alt="<spring:message code="button.goModify" />"/>
                       	</c:if>
                   	</a>
               	</span>
          	</li>
   		</ul>
   	</div> -->
</form:form>


<script type="text/javascript" src="<c:url value='/validator.do'/>"></script>
<validator:javascript formName="divMngVO" staticJavascript="false" xhtml="true" cdata="false"/>
<script type="text/javaScript" defer="defer">
<!--
	function fn_save() {
		var frm = document.detailForm;
		if (!validateDivMngVO(frm)) {
			return;
		} else {
			frm.submit();
		}
	}
	-->
</script>