<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<!DOCTYPE html>
<html lang="ko">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content= "text/html; charset= utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    <meta http-equiv="Content-Style-Type" content="text/css">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="format-detection" content="telephone=no">
    <link rel="favicon" href="/images/favicon.ico">
    <title>안동시 교통정보센터 - ${popupObject.TITLE}</title>
	<style>
		*{
			margin: 0;
			padding: 0;
		}
		html, body{
			width: 100%;
			height: 100%
		}
		.container{width: 100%;height: 100%;}
		.content {
			width: 100%;
			height: calc(100% - 31px);
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			border-bottom: 1px solid #ddd;
		}
		.bottom {
			width: calc(100% - 20px);
			height: 30px;
			display: flex;
			align-items: center;
			justify-content: flex-end;
			padding-right: 20px;
			background-color: black;
		}
		label {
			color : white;
			height : 100%;
			display: flex;
			align-items: center;
			font-size: 16px;
		}
		label:hover {
			cursor: pointer;
		}
		.go-page{
			width: calc(100% - 20px);
			height: 30px;
			display: flex;
			align-items: center;
			justify-content: flex-end;
			padding-right: 20px;
		}
		.img-box{
			width: 100%;
			height: calc(100% - 30px);
			display: flex;
			align-items: center;
			justify-content: center;
		}
		.close{
			color: white;
			margin-left: 10px;
			height : 100%;
			display: flex;
			align-items: center;
			font-size: 16px;
		}
		.close:hover {
			cursor: pointer;
			color: #0f9bf5;
		}
	</style>
</head>
<body>
	<div class="container">
		<div class="content">
			<c:if test="${empty popupObject.URL }">
				<img src="/upload/${popupObject.IMG_ID }.do" style="max-width: 1920px; max-height: 920px;" alt="${popupObject.TITLE }"/>
			</c:if>
			<c:if test="${!empty popupObject.URL}">
				<div class="img-box">
					<a href="http://${popupObject.URL }" target='_blank' rel="noopener noreferrer" onclick="window.close()">
						<img src="/upload/${popupObject.IMG_ID }.do" style="max-width: 1920px;" alt="${popupObject.TITLE }"/>
					</a>
				</div>
				<div class="go-page">
					<a href="http://${popupObject.URL }" target='_blank' rel="noopener noreferrer" onclick="window.close()">[페이지 바로가기]</a>
				</div>
			</c:if>
		</div>
		<div class="bottom">
			<label for="close" onclick="closeWin(${popupObject.POPUPID})">
			<input type="checkbox" id="close" name="Notice" onclick="closeWin(${popupObject.POPUPID})" />&nbsp;오늘 하루 동안 열지 않음</label>
			<div class="close" onclick="window.close()">[닫기]</div>
		</div>
	</div>
</body>
<script type="text/javascript">
	function closeWin(id) {
		setCookie("gm-${popupObject.POPUPID}", "Y", 1);
		//return 
		window.close();
	}
	
	function setCookie( name, value, expiredays ) {
		var todayDate = new Date(); 
	    todayDate.setDate( todayDate.getDate() + expiredays );
	    todayDate.setHours('00');
	    todayDate.setMinutes('00');
	    todayDate.setSeconds('00');
		//todayDate = new Date(parseInt(todayDate.getTime() / 86400000) * 86400000 + 54000000);
		document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";";
	}
</script>
</html>
