<%@ 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="ferryVO" id="detailForm" name="detailForm" enctype="multipart/form-data" method="POST">
	<form:hidden path="serNo" />
	<form:hidden path="writer" />
   	<div id="table">
   	<table class="tb">
   		<colgroup>
   			<col width="100"/>
   			<col width="?"/>
   			<col width="100"/>
   			<col width="?"/>
   		</colgroup>
   		<tr>
   			<td class="tbtd_caption">
   				<form:label path="ferryName"><spring:message code="target.ferry.name" /></form:label>
   			</td>
   			<td class="tbtd_content">
   				<form:input path="ferryName" cssClass="txt" />
   			</td>
   			<td class="tbtd_caption">
   				<form:label path="repreName"><spring:message code="target.ferry.repreName" /></form:label>
   			</td>
   			<td class="tbtd_content">
   				<form:input path="repreName" cssClass="txt" />
   			</td>
   		</tr>
   		<tr>
   			<td class="tbtd_caption">
   				<form:label path="ferryOffice"><spring:message code="target.ferry.office" /></form:label>
   			</td>
   			<td class="tbtd_content">
   				<form:input path="ferryOffice" cssClass="txt" />
   			</td>
   			<td class="tbtd_caption">
   				<form:label path="tel"><spring:message code="target.ferry.tel" /></form:label>
   			</td>
   			<td class="tbtd_content">
   				<form:input path="tel" cssClass="txt" />
   			</td>
   		</tr>
   		<tr>
   			<td class="tbtd_caption">
   				<form:label path="ferryTon"><spring:message code="target.ferry.ton" /></form:label>
   			</td>
   			<td class="tbtd_content">
   				<form:input path="ferryTon" cssClass="txt" />&nbsp;톤
   			</td>
   			<td class="tbtd_caption">
   				<form:label path="ferrySosok"><spring:message code="target.ferry.ferrySosok" /></form:label>
   			</td>
   			<td class="tbtd_content">
   				<form:input path="ferrySosok" cssClass="txt" />
   			</td>
   		</tr>
   		<tr>
   			<td class="tbtd_caption">
   				<form:label path="ferryRoute"><spring:message code="target.ferry.route" /></form:label>
   			</td>
   			<td class="tbtd_content">
   				<form:select path="ferryRoute">
   					<form:options items="${routeList}" itemValue="code" itemLabel="value"/>
   				</form:select>
   			</td>
   			<td class="tbtd_caption">
   				<form:label path="sailingDistance"><spring:message code="target.ferry.sailingDistance" /></form:label>
   			</td>
   			<td class="tbtd_content">
   				<form:input path="sailingDistance" cssClass="txt" />&nbsp;마일
   			</td>
   		</tr>
   		<tr>
   			<td class="tbtd_caption">
   				<form:label path="ferryTime"><spring:message code="target.ferry.ferryTime" /></form:label>
   			</td>
   			<td class="tbtd_content">
				<form:input path="ferryTime" cssClass="txt" />&nbsp;시간
   			</td>
   			<td class="tbtd_caption">
   				<form:label path="sailingDate"><spring:message code="target.ferry.sailingDate" /></form:label>
   			</td>
   			<td class="tbtd_content">
   				<form:input path="sailingDate" cssClass="txt" /> (형식 : 2000-01-01)
   			</td>
   		</tr>
   		<tr>
   			<td class="tbtd_caption">
   				<form:label path="ferrySpeedMax"><spring:message code="target.ferry.speed" /></form:label>
   			</td>
   			<td class="tbtd_content">
   				<spring:message code="target.ferry.speedMax" />&nbsp;
				<form:input path="ferrySpeedMax" cssClass="txt" />&nbsp;노트<br />
				<spring:message code="target.ferry.speedNor" />&nbsp;
				<form:input path="ferrySpeedNor" cssClass="txt" />&nbsp;노트
   			</td>
   			<td class="tbtd_caption">
   				<form:label path="ferryGuestCnt"><spring:message code="target.ferry.capacity" /></form:label>
   			</td>
   			<td class="tbtd_content">
   				<spring:message code="target.ferry.guestCnt" />　&nbsp;
				<form:input path="ferryGuestCnt" cssClass="txt" />&nbsp;명<br />
				<spring:message code="target.ferry.clueCnt" />&nbsp;
				<form:input path="ferryClueCnt" cssClass="txt" />&nbsp;명
   			</td>
   		</tr>
   		<tr>
   			<td class="tbtd_caption">
   				<form:label path="runCnt"><spring:message code="target.ferry.runCnt" /></form:label>
   			</td>
   			<td class="tbtd_content">
   				<form:select path="runTerm">
   					<form:options items="${runTermList}" itemValue="code" itemLabel="value"/>
   				</form:select>
				<form:input path="runCnt" cssClass="txt" />&nbsp;회
   			</td>
   			<td class="tbtd_caption">
   				<form:label path="cooperateNation"><spring:message code="target.ferry.cooperateNation" /></form:label>
   			</td>
   			<td class="tbtd_content">
   				<form:input path="cooperateNation" cssClass="txt" />
   			</td>
   		</tr>   		
   		<tr>
   			<td class="tbtd_caption">
   				<form:label path="imgFile"><spring:message code="target.ferry.imgFile" /></form:label>
   			</td>
   			<td class="tbtd_content" colspan="3">
   				<c:if test="${registerFlag eq 'modify' and not empty ferryVO.imgFile}">
   					<form:hidden path="imgFile"/>
   					<img src="<c:url value="/target/ferry/download.do">
								<c:param name="serNo" value="${ferryVO.serNo}" />
							  </c:url>" alt="<spring:message code="target.ferry" /> 이미지" width="350" /><br />
   					<input type="checkbox" id="chkDelFileImg" name="deleteFile" value="imgFile"/>
   					<label for="chkDelFileImg"><c:out value="${ferryVO.imgFile}" />는 삭제합니다.</label><br />
   				</c:if>
   				<input type="file" name="imgFileObj" />
   			</td>
   		</tr>
   		<tr>
   			<td class="tbtd_caption">
   				<form:label path="comments"><spring:message code="target.ferry.comments" /></form:label>
   			</td>
   			<td class="tbtd_content" colspan="3">
   				<form:input path="comments" cssClass="txt" />
   			</td>
   		</tr>
   	</table>
    </div>
   	<div id="sysbtn">
   		<ul>
   			<li>
            	<span class="btn_blue_l">
	      			<c:choose>
		      			<c:when test="${registerFlag == 'modify'}">
		       				<a href="<c:url value='/target/ferry/view.do'>
                				<c:param name="serNo" value="${ferryVO.serNo}" />
                			 </c:url>"><spring:message code="button.cancel" /></a>
		       			</c:when>
		       			<c:otherwise>
			    			<a href="<c:url value='/target/ferry/list.do'>
                				<c:param name="ferryRoute" value="${ferryVO.ferryRoute}" />
                			 </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="ferryVO" staticJavascript="false" xhtml="true" cdata="false"/>
<script type="text/javaScript" defer="defer">
<!--
	$(document).ready(function() {
		$("#sailingDate").datepicker({
			dateFormat: 'yy-mm-dd',
			onSelect: function(date){
				$("#sailingDate").val(date);
			}
		});
	});

	function fn_save() {
		var frm = document.detailForm;
		if (!validateFerryVO(frm)) {
			return;
		} else {
			frm.submit();
		}
	}
	-->
</script>