<%@ 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" %>
<div id="divPrintArea">
	<div id ="divPrintTitle" style="display: none;margin: 10px 0 10px 0;">
		<jsp:useBean id="toDay" class="java.util.Date" />
		<spring:message code="target.ferry" /> (출력일자 : <fmt:formatDate value="${toDay}" pattern="yyyy-MM-dd" />)
	</div>
	<div id="table">
	   	<table class="tb">
		<colgroup>
			<col width="150"/>
			<col width="?"/>
			<col width="150"/>
			<col width="200"/>
		</colgroup>
		<tr>
			<td class="tbtd_caption"><spring:message code="target.ferry.name" /></td>
			<td class="tbtd_content"><c:out value="${ferryVO.ferryName}" /></td>
			<td class="tbtd_content" rowspan="10" colspan="2">
				<c:choose>
				<c:when test="${ferryVO.imgFile ne null and ferryVO.imgFile ne ''}" >
					<a id="imgViewer" href="<c:url value="/target/ferry/download.do">
												<c:param name="serNo" value="${ferryVO.serNo}" />
											</c:url>">
					<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" />
					</a>
				</c:when>
				<c:otherwise>
					<img src="/images/basic_img.jpg" alt="<spring:message code="target.ferry" /> 이미지" />
				</c:otherwise>
				</c:choose>
			</td>
		</tr>
		<tr>
			<td class="tbtd_caption"><spring:message code="target.ferry.repreName" /></td>
			<td class="tbtd_content"><c:out value="${ferryVO.repreName}" /></td>
		</tr>
		<tr>
			<td class="tbtd_caption"><spring:message code="target.ferry.office" /></td>
			<td class="tbtd_content"><c:out value="${ferryVO.ferryOffice}" /></td>
		</tr>
		<tr>
			<td class="tbtd_caption"><spring:message code="target.ferry.tel" /></td>
			<td class="tbtd_content"><c:out value="${ferryVO.tel}" /></td>
		</tr>
		<tr>
			<td class="tbtd_caption"><spring:message code="target.ferry.ton" /></td>
			<td class="tbtd_content"><c:out value="${ferryVO.ferryTon}" />&nbsp;톤</td>
		</tr>
		<tr>
			<td class="tbtd_caption"><spring:message code="target.ferry.ferrySosok" /></td>
			<td class="tbtd_content"><c:out value="${ferryVO.ferrySosok}" /></td>
		</tr>
		<tr>
			<td class="tbtd_caption"><spring:message code="target.ferry.route" /></td>
			<td class="tbtd_content"><c:out value="${ferryVO.ferryRouteStr}" /></td>
		</tr>
		<tr>
			<td class="tbtd_caption"><spring:message code="target.ferry.sailingDistance" /></td>
			<td class="tbtd_content"><c:out value="${ferryVO.sailingDistance}" /></td>
		</tr>
		<tr>
			<td class="tbtd_caption"><spring:message code="target.ferry.ferryTime" /></td>
			<td class="tbtd_content"><c:out value="${ferryVO.ferryTime}" /></td>
		</tr>
		<tr>
			<td class="tbtd_caption"><spring:message code="target.ferry.sailingDate" /></td>
			<td class="tbtd_content"><c:out value="${ferryVO.sailingDate}" /></td>
		</tr>
		<tr>
			<td class="tbtd_caption"><spring:message code="target.ferry.speed" /></td>
			<td class="tbtd_content">
				최대&nbsp;<c:out value="${ferryVO.ferrySpeedMax}" />&nbsp;노트<br />
				항해&nbsp;<c:out value="${ferryVO.ferrySpeedNor}" />&nbsp;노트<br />
			</td>
			<td class="tbtd_caption"><spring:message code="target.ferry.capacity" /></td>
			<td class="tbtd_content">
				여객　&nbsp;<c:out value="${ferryVO.ferryGuestCnt}" />&nbsp;명<br />
				승무원&nbsp;<c:out value="${ferryVO.ferryClueCnt}" />&nbsp;명<br />
			</td>
		</tr>
		<tr>
			<td class="tbtd_caption"><spring:message code="target.ferry.runCnt" /></td>
			<td class="tbtd_content"><c:out value="${ferryVO.runCntStr}" /></td>
			<td class="tbtd_caption"><spring:message code="target.ferry.cooperateNation" /></td>
			<td class="tbtd_content"><c:out value="${ferryVO.cooperateNation}" /></td>
		</tr>
		<tr>
			<td class="tbtd_caption"><spring:message code="target.ferry.comments" /></td>
			<td class="tbtd_content" colspan="3"><c:out value="${ferryVO.comments}" /></td>
		</tr>
		</table>
	</div>
</div>
<form:form commandName="ferryVO" name="menuForm" method="post">
	<form:hidden path="serNo" />
	<div id="sysbtn">
		<ul>
			<c:if test="${loginUserVO.isAdmin}">
	  			<li>
	           	<span class="btn_blue_l">
	               	<a href="javascript:fn_modify();"><spring:message code="button.goModify" /></a>
	                   <img src="<c:url value='/images/rte/btn_bg_r.gif'/>" style="margin-left:6px;" alt="<spring:message code='button.goModify' />" />
	              	</span>
	           </li>
	  			<li>
	           	<span class="btn_blue_l">
	               	<a href="javascript:fn_delete();"><spring:message code="button.goDelete" /></a>
	                   <img src="<c:url value='/images/rte/btn_bg_r.gif'/>" style="margin-left:6px;" alt="<spring:message code='button.goDelete' />"/>
	              	</span>
	           </li>
			</c:if>
			<li>
				<span class="btn_blue_l">
					<a href="javascript:fn_print();"><spring:message code="button.print" /></a>
					<img src="<c:url value='/images/rte/btn_bg_r.gif'/>" style="margin-left: 6px;" alt="<spring:message code='button.print' />" />
				</span>
			</li>	
			<li>
				<span class="btn_blue_l">
					<a href="<c:url value="/target/ferry/list.do" />"><spring:message code="button.goList" /></a>
					<img src="<c:url value='/images/rte/btn_bg_r.gif'/>" style="margin-left: 6px;" alt="<spring:message code='button.goList' />" />
				</span>
			</li>			
		</ul>
	</div>
</form:form>


<script type="text/javascript" defer="defer">
	/* 수정 화면 function */	
	function fn_modify() {
		document.menuForm.method = "get";
	   	document.menuForm.action = "<c:url value='/target/ferry/update.do'/>";
	   	document.menuForm.submit();
	}
	
	/* 삭제 화면 function */
	function fn_delete() {
		if (confirm("<spring:message code="confirm.msg.askDel" />")){
			document.menuForm.method = "post";
    		document.menuForm.action = "<c:url value='/target/ferry/delete.do'/>";
    	   	document.menuForm.submit();	
    	}
	}
	
	/* 출력 */
	function fn_print(){
		var divPrintTitle = document.getElementById("divPrintTitle");
		divPrintTitle.style.display = "inline";
		printDiv($("#divPrintArea").html());
		divPrintTitle.style.display = "none";
	}
	
	/* 이미지 크게보기 */
	$(document).ready(function() {
		$("#imgViewer").fancybox({
			type: "image"
		});
	})
</script>