<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 
<%@ page session="false" %>
<!doctype html>
<html lang="ko">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1"/>
	<meta name="Description" content="사이트설명" />
	<meta name="Keywords" content="키워드" />
	
	<%@ include file="/WEB-INF/views/common.jsp" %>
	<link rel="stylesheet" type="text/css" href="${contextRoot }/css/common.css" />
	<link rel="stylesheet" type="text/css" href="${contextRoot }/css/main.css" />
	<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css" />
	
	<title>SIGINFO_MAP</title>
</head>
<body class="sang">
<input type="hidden" name="min_x" id="min_x" value=""/>
<input type="hidden" name="min_y" id="min_y" value=""/>
<input type="hidden" name="max_x" id="max_x" value=""/>
<input type="hidden" name="max_y" id="max_y" value=""/>
<div class="popContainer">
	<div class="phaseInfoTop">
		<ul class="tabs">
			<li><a href="javascript:goPhaseInfo()" class="tab" id="pTab1"><img src="images/tab03_on.png" alt="현시구성정보" /></a></li>
			<li><a href="javascript:goTodInfo()" class="tab" id="pTab2"><img src="images/tab04_off.png" alt="TOD정보" /></a></li>
			<li><a href="javascript:goEventHistory()" class="tab" id="pTab3"><img src="images/tab05_off.png" alt="이벤트이력정보" /></a></li>
			<li><a href="javascript:goSignalMap()" class="tab" id="pTab4"><img src="images/tab07_off.png" alt="시그널맵정보" /></a></li>
			<li class="regionIntNm"><strong style="padding-left:5px">[${regionNm}] - ${intNm }</strong></li>
			<li class="simulation"><strong>시뮬레이션[${simulFlag}]</strong></li>
			<li><img alt="" src="" class="testImg"></li>
		</ul>
	</div>
	<div class="leftPopMenu">
		<div class="intResrvPlan">
			<p>예약 설정 정보</p>
			<div class="intResrvPlanCon">
				<div class="intResrvPlanHead">
					<table>
						<colgroup>
							<col width="10%" />
							<col width="10%" />
							<col width="10%" />
							<col width="10%" />
							<col width="10%" />
							<col width="10%" />
							<col width="10%" />
							<col width="15%" />
							<col width="15%" />
						</colgroup>
						<thead>
							<tr>
								<th rowspan="2">월</th>
								<th rowspan="2">일</th>
								<th rowspan="2">요일</th>
								<th colspan="2">시작</th>
								<th colspan="2">종료</th>
								<th rowspan="2">예약<br>정보</th>
								<th rowspan="2">계획<br>번호</th>
							</tr>
							<tr>
								<th>시</th>
								<th>분</th>
								<th>시</th>
								<th>분</th>
							</tr>
						</thead>
					</table>
				</div>
				<div class="intResrvPlanBody">
					<table>
						<colgroup>
							<col width="10%" />
							<col width="10%" />
							<col width="10%" />
							<col width="10%" />
							<col width="10%" />
							<col width="10%" />
							<col width="10%" />
							<col width="15%" />
							<col width="15%" />
						</colgroup>
						<tbody id="resrvInfoList"></tbody>
					</table>
				</div>
			</div>
		</div>
		<div class="holydayPlan">
			<p>HOLYDAY PLAN</p>
			<div class="holydayPlanCon">
				<div class="holydayPlanHead">
					<table>
					<colgroup>
						<col width="33.3%"/>
						<col width="33.3%"/>
						<col width="33.3%"/>
					</colgroup>
					<thead>
						<tr>
							<th>월</th>
							<th>일</th>
							<th>계획번호</th>
						</tr>
					</thead>
					</table>
				</div>
				<div class="holydayPlanBody">
					<table>
						<colgroup>
							<col width="33.3%"/>
							<col width="33.3%"/>
							<col width="33.3%"/>
						</colgroup>
						<tbody id="holyInfoList"></tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
	<div id="map" class="popMap"></div>
	<div class="bottomPopMenu">
		<div class="bottomRight">
			<p>제어기 정보</p>
			<div class="bottomSigInfo">
				<table>
					<colgroup>
						<col width="5%"/>
						<col width="6%"/>
						<col width="10%"/>
						<col width="10%"/>
						<col width="5%"/>
						<col width="8%"/>
						<col width="6%"/>
						<col width="6%"/>
						<col width="6%"/>
						<col width="5%"/>
						<col width="5%"/>
						<col width="5%"/>
						<col width="8%"/>
						<col width="5%"/>
						<col width="5%"/>
						<col width="5%"/>
					</colgroup>
					<thead>
						<tr>
							<th>그룹번호</th>
							<th>제어기번호</th>
							<th>교차로명</th>
							<th>수집일시</th>
							<th>통신여부</th>
							<th>운영모드</th>
							<th>시차제모드</th>
							<th>A링<br/>현시값</th>
							<th>B링<br/>현시값</th>
							<th>소등</th>
							<th>점멸</th>
							<th>수동</th>
							<th>주기<br/>카운트</th>
							<th>주기</th>
							<th>맵<br/>번호</th>
							<th>PPC제어</th>
						</tr>
					</thead>
					<tbody id="bottomSiginfo"></tbody>
				</table>
			</div>
		</div>
		<div class="phaseInfo">
			<p>페이즈 정보</p>
			<span class="pMapNo">
				<label for="pMapNo">맵번호  : </label>
				<select id="pMapNo" onchange="phaseOnMap(this.value)">
					<c:forEach var="item" items="${resultList }">
						<option value="${item.MAP_NO }" <c:if test="${item.MAP_NO_STATUS == item.MAP_NO}">selected="selected"</c:if>>${item.MAP_NO }</option>
					</c:forEach>
				</select>
			</span>
			<div class="phaseInfoCon">
				<table>
					<thead>
						<tr>
							<th>현시</th>
							<th class="pa_1">1</th>
							<th class="pa_2">2</th>
							<th class="pa_3">3</th>
							<th class="pa_4">4</th>
							<th class="pa_5">5</th>
							<th class="pa_6">6</th>
							<th class="pa_7">7</th>
							<th class="pa_8">8</th>
						</tr>
					</thead>
					<tbody id="phaseInfoList1"></tbody>
					<tbody id="phaseInfoList2"></tbody>
				</table>
			</div>
		</div>
		<div class="dayPlan">
			<p>DAY PLAN</p>
			<span>
				<label for="dayPlanNo">PLAN_NO : </label>
				<select id="dayPlanNo" onchange="getCropInfoList(this.value)">
				<c:forEach begin="1" end="10" step="1" var="i">
					<option value="${i }">${i }</option>
				</c:forEach>
				</select>
			</span>
			<div class="dayPlanCon">
				<div class="dayPlanHead">
					<table>
						<colgroup>
							<col width="31px"/>
							<col width="48px"/>
							<col width="38px"/>
							<col width="49px"/>
							<col width="49px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
						</colgroup>
						<thead>
							<tr>
								<th rowspan="2">No</th>
								<th rowspan="2">HOUR</th>
								<th rowspan="2">MIN</th>
								<th rowspan="2">Cycle</th>
								<th rowspan="2">Offset</th>
								<th colspan="2">1현시</th>
								<th colspan="2">2현시</th>
								<th colspan="2">3현시</th>
								<th colspan="2">4현시</th>
								<th colspan="2">5현시</th>
								<th colspan="2">6현시</th>
								<th colspan="2">7현시</th>
								<th colspan="2">8현시</th>
							</tr>
							<tr>
								<th>A</th>
								<th>B</th>
								<th>A</th>
								<th>B</th>
								<th>A</th>
								<th>B</th>
								<th>A</th>
								<th>B</th>
								<th>A</th>
								<th>B</th>
								<th>A</th>
								<th>B</th>
								<th>A</th>
								<th>B</th>
								<th>A</th>
								<th>B</th>
							</tr>
						</thead>
					</table>
				</div>
				<div class="dayPlanBody">
					<table>
						<colgroup>
							<col width="31px"/>
							<col width="48px"/>
							<col width="38px"/>
							<col width="49px"/>
							<col width="49px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
							<col width="25px"/>
						</colgroup>
						<tbody id="dayInfoList"></tbody>
					</table>
				</div>
			</div>
		</div>
		<div class="weekPlan">
			<p>WEEK PLAN</p>
			<div class="weekPlanCon">
				<table>
					<thead>
						<tr>
							<th>월요일</th>
							<th>화요일</th>
							<th>수요일</th>
							<th>목요일</th>
							<th>금요일</th>
							<th>토요일</th>
							<th>일요일</th>
						</tr>
					</thead>
					<tbody id="weekInfoList"></tbody>
				</table>
			</div>
		</div>
		<div class="eventHist">
			<p>이벤트이력정보</p>
			<div class="collctDtime">
				수집일시 : <input type="text" id="fromPopYMD" style="width:100px;" value="" /><label for="fromPopYMD">일</label> 
				<select id="fromPopHour">
					<c:forEach var="i" begin="1" end="24" step="1">
						<c:choose>
							<c:when test="${i < 10 }"><c:set var="ii" value="0${i }"></c:set></c:when>
							<c:otherwise><c:set var="ii" value="${i }"></c:set></c:otherwise>
						</c:choose>
						<option value="${ii }">${ii}</option>
					</c:forEach>
				</select><label for="fromPopHour">시</label>
				<select id="fromPopMin">
					<c:forEach var="i" begin="0" end="59" step="1">
						<c:choose>
							<c:when test="${i < 10 }"><c:set var="ii" value="0${i }"></c:set></c:when>
							<c:otherwise><c:set var="ii" value="${i }"></c:set></c:otherwise>
						</c:choose>
						<option value="${ii }">${ii}</option>
					</c:forEach>
				</select><label for="fromPopMin">분</label>
				~ <input type="text" id="toPopYMD" style="width:100px;" value="" /><label for="toPopYMD">일</label>
				<select id="toPopHour">
					<c:forEach var="i" begin="1" end="24" step="1">
						<c:choose>
							<c:when test="${i < 10 }"><c:set var="ii" value="0${i }"></c:set></c:when>
							<c:otherwise><c:set var="ii" value="${i }"></c:set></c:otherwise>
						</c:choose>
						<option value="${ii }">${ii}</option>
					</c:forEach>
				</select><label for="toPopHour">시</label>
				<select id="toPopMin">
					<c:forEach var="i" begin="0" end="59" step="1">
						<c:choose>
							<c:when test="${i < 10 }"><c:set var="ii" value="0${i }"></c:set></c:when>
							<c:otherwise><c:set var="ii" value="${i }"></c:set></c:otherwise>
						</c:choose>
						<option value="${ii }">${ii}</option>
					</c:forEach>
				</select><label for="toPopMin">분</label>
				<label for="eventPopCd" style="padding-left:19px">이벤트코드명 : </label>
				<select id="eventPopCd">
					<option value="">전체</option>
					<option value="04,05">통신</option>
					<option value="08,09">시차제</option>
					<option value="10,11">점멸</option>
					<option value="20,21">소등</option>
					<option value="40,41">모순</option>
					<option value="80,81">수동</option>
				</select>
				<img src="images/btn_pop5.png" alt="이벤트이력검색" onClick="getPopEventList()" />
			</div>
			<div class="eventPopListTable">
				<span id="eventPopListCnt"></span>
				<div class="eventPopListHead">
					<table>
						<colgroup>
							<col width="30%"/>
							<col width="15%"/>
							<col width="15%"/>
							<col width="20%"/>
							<col width="20%"/>
						</colgroup>
						<thead>
							<tr>
								<th>수집 일시</th>
								<th>지역 코드</th>
								<th>지역 명</th>
								<th>제어기 번호</th>
								<th>이벤트코드</th>
							</tr>
						</thead>
					</table>
				</div>
				<div class="eventPopListBody">
					<table>
						<colgroup>
							<col width="30%"/>
							<col width="15%"/>
							<col width="15%"/>
							<col width="20%"/>
							<col width="20%"/>
						</colgroup>
						<tbody id="eventPopList"></tbody>
					</table>
				</div>
			</div>
			<img src="images/loading.gif" alt="로딩바" class="loading" />
		</div>
	</div>
	<div class="signalMapDiv">
		<div class="signalMapNo">
			<ul>
				<li class="lcType"></li>
				<li class="lampType"></li>
				<li>
					<label for="signalMapNo">맵 번호 : </label>
					<select id="signalMapNo" onchange="goSignalMap()">
						<c:forEach var="i" begin="0" end="6">
							<option value="${i}">${i}</option>
						</c:forEach>
					</select>
				</li>
			</ul>
			
		</div>
		<div class="signalMapCon">
			<table>
				<thead>
					<tr>
						<td>링</td>
						<td>스텝</td>
						<c:forEach var="i" begin="1" end="16">
						<td>${i }</td>
						</c:forEach>
						<td>MIN</td>
						<td>MAX</td>
						<td>EOP</td>
					</tr>
				</thead>
				<tbody id="signalMapBody"></tbody>
			</table>
		</div>
	</div>
</div>

<script src="${contextRoot }/js/common/hashmap.js" type="text/javascript" ></script>
<script src="${contextRoot }/js/common/common-all.js" type="text/javascript" ></script>
<script src="${contextRoot }/js/common/common.js" type="text/javascript" ></script>
<script src="${contextRoot }/js/signal.js" type="text/javascript" ></script>
<script type="text/javascript">

var pMap;
var staticMap;
var mapRing;
var customOverlay = null;
_RegionCd   = '<c:out value="${regionCd}" />';
_IntNo      = '<c:out value="${intNo}" />';
_MapNo      = '<c:out value="${mapNoStatus}" />';
var _XCoord = '<c:out value="${xCoord}" />';
var _YCoord = '<c:out value="${yCoord}" />';
var centerLat;
var centerLng;
var listCoord = [];
var sigInfoDetailId = null;
var thisDate = new Date();
var thisYy = thisDate.getFullYear();
var thisMn = thisDate.getMonth()+1;
var thisDd = thisDate.getDate();
var thisDy = thisDate.getDay();
var thisHh = thisDate.getHours();
var thisMi = thisDate.getMinutes();
var _TodayPlanNo;

var _BackCircleFlag = true;
_ToggleSiginfo  = false;

var mapContainer = document.getElementById('map') // 지도를 표시할 div
var mapOption = {
	center: new kakao.maps.LatLng(_YCoord, _XCoord),
	level: 1
};
map = new kakao.maps.Map(mapContainer, mapOption); // 지도생성
var bounds = map.getBounds();
// 영역정보의 남서쪽 정보를 얻어옵니다 
var swLatlng = bounds.getSouthWest();
var neLatlng = bounds.getNorthEast();

$("#min_x").val(swLatlng.getLng());
$("#min_y").val(swLatlng.getLat());
$("#max_x").val(neLatlng.getLng());
$("#max_y").val(neLatlng.getLat());

goPhaseInfo();

function goPhaseInfo() {
	if(sigInfoDetailId != null) clearInterval(sigInfoDetailId);
	if(_CenterMarker != null) _CenterMarker.setMap(null);
	
	emptySignalArr(linkPhaseLineArr);
	emptySignalArr(_SubLinkLineArr);
	emptySignalArr(linkLineArr);
	emptySignalArr(signalALineArr);
	emptySignalArr(signalBLineArr);
	emptySignalArr(lineCenterCircleArr);
	
	linkPhaseLineArr    = [];
	_SubLinkLineArr     = [];
	linkLineArr         = [];
	signalALineArr      = [];
	signalBLineArr      = [];
	lineCenterCircleArr = [];
	
	$('.signalMapDiv').hide();
	$('#signalMapBody').empty();
	
	$('#pTab1 img').attr('src','images/tab03_on.png');
	$('#pTab2 img').attr('src','images/tab04_off.png');
	$('#pTab3 img').attr('src','images/tab05_off.png');
	$('#pTab4 img').attr('src','images/tab07_off.png');
	
	$('.popMap').show();
	$('.bottomPopMenu').show();
	
	$('.leftPopMenu').hide();
	$('.dayPlan').hide();
	$('.weekPlan').hide();
	$('.eventHist').hide();
	$('.updatePhase').hide();
	$('#moveSigId').css('color','');
	$('#updatePhaseId').css('color','');
	$('#updateLinkId').css('color','');
	$('.updateSigSub').hide();
	$('.sigMove').hide();
	
	$('.bottomRight').show();
	$('.phaseInfo').show();
	$('.phaseInfoCon').show();
	
	$('.bottomPopMenu').css({top:'295px',left:'0',height:'538px',width:'908px',marginLeft:'5px',marginTop:'2px'});
	$('.popMap').css({height:'250px',width:'908px',left:'0'});
	$('.puA_'+_PhaseNum).css('background-color','#ffffff');
	$('.puB_'+_PhaseNum).css('background-color','#ffffff');
	
	map.relayout();
	map.setCenter(new kakao.maps.LatLng(_YCoord, _XCoord));
	map.setLevel(1);
	map.setDraggable(false);
	map.setZoomable(false);

	_PFlag = '';

	goTodInfoDetail();
	sigInfoDetailId = setInterval('goTodInfoDetail()',1000 * 1);

	getSigInfoPhaseDetail();
	getSignalInfo('sigPop');
}

function goTodInfoDetail() {
	var infoNo = _IntNo;
	
	var url = 'getTodInfoDetail.do';
	var params = 'regionCd='+_RegionCd+'&intNo='+infoNo+'&mapNo='+_MapNo;
	requestService(url, params, goTodInfoDetailCallback);
}

function goTodInfoDetailCallback(data) {
	
	var groupNo = data[0].GROUP_NO;
	var mapNo = data[0].MAP_NO;
	var intNm = data[0].INT_NM;
	var collctDtime = data[0].COLLCT_DTIME;
	var commOnOffFlag = data[0].COMM_ON_OFF_FLAG;
	var contrlrOperModeCd = data[0].CONTRLR_OPER_MODE_CD;
	var contrlrTmdiffContrlFlag = data[0].CONTRLR_TMDIFF_CONTRL_FLAG;
	var aRingPhaseVal = data[0].A_RING_PHASE_VAL;
	var bRingPhaseVal = data[0].B_RING_PHASE_VAL;
	var siglightTurnoffFlag = data[0].SIGLIGHT_TURNOFF_FLAG;
	var siglightBlinkFlag = data[0].SIGLIGHT_BLINK_FLAG;
	var contrlrManualFlag = data[0].CONTRLR_MANUAL_FLAG;
	var intSigCycleCnt = (data[0].INT_SIG_CYCLE_CNT == '-') ? data[0].INT_SIG_CYCLE_CNT : Number(data[0].INT_SIG_CYCLE_CNT);
	var intSigCycleLen = (data[0].INT_SIG_CYCLE_LEN == '-') ? data[0].INT_SIG_CYCLE_LEN : Number(data[0].INT_SIG_CYCLE_LEN);
	var ppcContrlFlag = data[0].PPC_CONTRL_FLAG;
	
	if(aRingPhaseVal != '-') aRingPhaseVal = Number(aRingPhaseVal) + 1;
	if(bRingPhaseVal != '-') bRingPhaseVal = Number(bRingPhaseVal) + 1;
	
	var infoHtml = '';
	infoHtml += '<tr>';
	infoHtml += '<td>'+groupNo+'</td>';
	infoHtml += '<td>'+_IntNo+'</td>';
	infoHtml += '<td>'+intNm+'</td>';
	infoHtml += '<td>'+collctDtime+'</td>';
	infoHtml += '<td>'+commOnOffFlagFnc(commOnOffFlag)+'</td>';
	infoHtml += '<td>'+contrlrOperModeCdFnc(contrlrOperModeCd)+'</td>';
	infoHtml += '<td>'+tmdiffFlagFnc(contrlrTmdiffContrlFlag)+'</td>';
	infoHtml += '<td>'+aRingPhaseVal+'</td>';
	infoHtml += '<td>'+bRingPhaseVal+'</td>';
	infoHtml += '<td>'+onOffFlagFnc(siglightTurnoffFlag)+'</td>';
	infoHtml += '<td>'+onOffFlagFnc(siglightBlinkFlag)+'</td>';
	infoHtml += '<td>'+onOffFlagFnc(contrlrManualFlag)+'</td>';
	infoHtml += '<td>'+intSigCycleCnt+'</td>';
	infoHtml += '<td>'+intSigCycleLen+'</td>';
	infoHtml += '<td>'+_MapNo+'</td>';
	infoHtml += '<td>'+ppcFlagFnc(ppcContrlFlag)+'</td>';
	infoHtml += '</tr>';
	
	$('#bottomSiginfo').empty().html(infoHtml);
	
	//페이즈 정보색상 표시
	if(mapNo == _MapNo)
	{
		$('.phaseInfoCon thead th').css('background-color','');
		$('.pa_'+aRingPhaseVal).css('background-color','yellow');
		$('.pb_'+bRingPhaseVal).css('background-color','yellow');
	}
	else
	{
		$('.phaseInfoCon thead th').css('background-color','');
	}
}

function goTodInfo() {
	if(sigInfoDetailId != null) clearInterval(sigInfoDetailId);
	if(_CenterMarker != null) _CenterMarker.setMap(null);
	
	emptySignalArr(linkPhaseLineArr);
	emptySignalArr(_SubLinkLineArr);
	emptySignalArr(linkLineArr);
	emptySignalArr(signalALineArr);
	emptySignalArr(signalBLineArr);
	emptySignalArr(lineCenterCircleArr);
	
	linkPhaseLineArr    = [];
	_SubLinkLineArr     = [];
	linkLineArr         = [];
	signalALineArr      = [];
	signalBLineArr      = [];
	lineCenterCircleArr = [];
	
	$('.signalMapDiv').hide();
	$('#signalMapBody').empty();
	
	$('#pTab1 img').attr('src','images/tab03_off.png');
	$('#pTab2 img').attr('src','images/tab04_on.png');
	$('#pTab3 img').attr('src','images/tab05_off.png');
	$('#pTab4 img').attr('src','images/tab07_off.png');
	
	$('.popMap').show();
	$('.bottomPopMenu').show();
	$('.bottomRight').hide();
	$('.phaseInfo').hide();
	$('.eventHist').hide();
	$('.updatePhase').hide();
	$('#moveSigId').css('color','');
	$('#updatePhaseId').css('color','');
	$('#updateLinkId').css('color','');
	$('.updateSigSub').hide();
	$('.sigMove').hide();
	$('.leftPopMenu').show();
	$('.dayPlan').show();
	$('.weekPlan').show();
	$('.bottomPopMenu').css({top:'345px',left:'230px',height:'488px',width:'678px'});
	$('.popMap').css({height:'300px',width:'678px',left:'230px'});
	$('.puA_'+_PhaseNum).css('background-color','#ffffff');
	$('.puB_'+_PhaseNum).css('background-color','#ffffff');
	
	//오늘의 intplan_no를 가저온다.
	//getTodayPlanNo();
	
	//예약 설정 정보를 먼저 가저와서 planNo를 확인한다..
	//RESRV_CONTRL_CD 가 4인경우 시차제 
	//RESRV_CONTRL_CD = 4일때 운영될 시차제 플랜 번호(6-10), (0이면 6번플랜)
	//getCrrsInfoList();
	
	//WEEK PLAN 계획정보 데이터를 먼저 불러온다..
	getCrwdInfoList();
	
	map.relayout();
	map.setCenter(new kakao.maps.LatLng(_YCoord, _XCoord));
	map.setLevel(1);
	map.setDraggable(false);
	map.setZoomable(false);
	
	getSignalInfo('sigPop');
}

//WEEK PLAN
function getCrwdInfoList() {
	var regionCd = _RegionCd;
	var intNo = _IntNo;
	var url = 'getCrwdInfoList.do';
	var params = 'regionCd='+regionCd+'&intNo='+intNo;
	requestService(url, params, getCrwdInfoListCallback);
}

function getCrwdInfoListCallback(data) {
	var weekHtml = '<tr>';
	if(data && data.length > 6)
	{
		var intPlanNo;
		var planDy;
			for(var ii = 0; ii < data.length; ii++)
			{
				var backColor = '#fff';
				var dyNo = ii + 1;
				planDy = data[ii].plan_DY;
				intPlanNo = data[ii].int_PLAN_NO;
				if(planDy == thisDy)
				{
					backColor = 'yellow';
					$('#dayPlanNo').val(data[ii].int_PLAN_NO);
					_TodayPlanNo = intPlanNo;
				}
				if(dyNo == planDy) 
				{
					weekHtml += '<td style="background-color:'+backColor+'" id="planId_'+(ii+1)+'" >'+intPlanNo+'</td>';
				}
				else weekHtml += '<td>-</td>';
			}
		
	}
	else {
		for(var jj = 0; jj < 7; jj++) weekHtml += '<td>-</td>';
	}
	
	weekHtml += '</tr>';
	$('#weekInfoList').empty().html(weekHtml);
	
	getCrhdInfoList();
}

//HOLYDAY PLAN
function getCrhdInfoList() {
	var regionCd = _RegionCd;
	var intNo = _IntNo;
	var url = 'getCrhdInfoList.do';
	var params = 'regionCd='+regionCd+'&intNo='+intNo;
	requestService(url, params, getCrhdInfoListCallback);
}

function getCrhdInfoListCallback(data) {
	if(data.length > 0)
	{
		var intPlanNo;
		var holyddPlanMm;
		var holyddPlanDd;
		var holyHtml = '';
		var backgroundColor = "#fff";
		for(var ii = 0; ii < data.length; ii++)
		{
			intPlanNo = data[ii].int_PLAN_NO;
			holyddPlanMm = data[ii].holydd_PLAN_MM;
			holyddPlanDd = data[ii].holydd_PLAN_DD;
			
			holyHtml += '<tr>';
			if(holyddPlanMm == thisMn && holyddPlanDd == thisDd) 
			{
				_TodayPlanNo = intPlanNo;
				backgroundColor = 'yellow';
			}
			
			holyHtml += '<td style="background-color:'+backgroundColor+'">'+holyddPlanMm+'</td>';
			holyHtml += '<td style="background-color:'+backgroundColor+'">'+holyddPlanDd+'</td>';
			holyHtml += '<td style="background-color:'+backgroundColor+'">'+intPlanNo+'</td>';
			holyHtml += '</tr>';
		}
	}
	else
	{
		holyHtml += '<tr>';
		holyHtml += '<td colspan="3">데이터가 없습니다.</td>';
		holyHtml += '</tr>';
	}
	
	$('#holyInfoList').empty().html(holyHtml);
	
	//if(thisDy == 0) thisDy = 7;
	//var todayPlanNo = $('#planId_'+_TodayPlanNo).text();
	//$('#dayPlanNo option[value="'+intPlanNo+'"]').prop('selected',true);
	
	getCrrsInfoList();
}

//예약 설정 정보
function getCrrsInfoList() {
	var regionCd = _RegionCd;
	var intNo = _IntNo;
	var url = 'getCrrsInfoList.do';
	var params = 'regionCd='+regionCd+'&intNo='+intNo;
	requestService(url, params, getCrrsInfoListCallback);
}

function getCrrsInfoListCallback(data) {
	
	var resrvPlanNo;
	
	if(data.length > 0)
	{
		var resrvNo;
		var resrvMm;
		var resrvDd;
		var resrvDy;
		var resrvStrtHh;
		var resrvStrtMi;
		var resrvEndHh;
		var resrvEndMi;
		var resrvCtrCd;
		var resrvHtml = '';
		
		var monToFri = 0;
		var satToSun = 0;
		
		if(thisDy == 0) thisDy = 7;
		
		for(var ii = 0; ii < data.length; ii++)
		{
			resrvNo       = data[ii].resrv_NO;
			resrvMm       = data[ii].resrv_MM;
			resrvDd       = data[ii].resrv_DD;
			resrvDy       = data[ii].resrv_DY;
			resrvStrtHh   = data[ii].resrv_STRT_HH;
			resrvStrtMi   = data[ii].resrv_STRT_MI;
			resrvEndHh    = data[ii].resrv_END_HH;
			resrvEndMi    = data[ii].resrv_END_MI;
			resrvCtrCd    = data[ii].resrv_CONTRL_CD;
			resrvPlanNo   = data[ii].resrv_PLAN_NO;
			
			if (resrvCtrCd == 4) //시차제인 경우 계획번호는 6 ~ 10
			{
				if (resrvPlanNo < 6)
				{
					// 시차제인경우에 계획번호가 6~10번으로 들어오지않고 0~4번으로 들어오는 경우 6~10번으로 계획번호를 조정해 준다.
					resrvPlanNo = resrvPlanNo + 6;
				}
				console.log(resrvPlanNo);
				$('#planId_'+resrvDy).text(resrvPlanNo);
			}
			
			if(resrvMm == 0 || resrvDd == 0)
			{
				if(resrvCtrCd != 0)
				{
					if(resrvDy == 8) //공휴일(휴일계획에 지정된 휴일)
					{
						
					}
					else if(resrvDy == 9) //모든 주중(월-금)
					{
						monToFri = resrvPlanNo;
					}
					else if(resrvDy == 10) //모든 주말(토, 일)
					{
						satToSun = resrvPlanNo;
					}
					else if(resrvDy == 11) //매 월 격주 첫 번째 토요일
					{
						
					}
					else if(resrvDy == 12) //매 월 격주 두 번째
					{
						
					}
					else //일반 월-일 
					{
						if(resrvStrtHh != 0 && resrvEndHh != 0)
						{
							var d = new Date();
							var thisHour = d.getHours();
							
							if(thisHour >= resrvStrtHh && thisHour < resrvEndHh && thisDy == resrvDy)
							{
								
								//$('#planId_'+resrvDy).text(resrvPlanNo);
								_TodayPlanNo = resrvPlanNo;
							}
						}
					}
				}
			}
			else if(thisMn == resrvMm && thisDd == resrvDd)
			{
				$('#planId_'+thisDy).text(resrvPlanNo);
			}
			else 
			{
				
			}
			
			resrvHtml += '<tr>';
			resrvHtml += '<td>'+resrvMm+'</td>';
			resrvHtml += '<td>'+resrvDd+'</td>';
			resrvHtml += '<td>'+resrvDy+'</td>';
			resrvHtml += '<td>'+resrvStrtHh+'</td>';
			resrvHtml += '<td>'+resrvStrtMi+'</td>';
			resrvHtml += '<td>'+resrvEndHh+'</td>';
			resrvHtml += '<td>'+resrvEndMi+'</td>';
			resrvHtml += '<td>'+resrvCtrCd+'</td>';
			resrvHtml += '<td>'+resrvPlanNo+'</td>';
			resrvHtml += '</tr>';
		}
		
	}
	else
	{
		resrvHtml += '<tr>';
		resrvHtml += '<td colspan="9">데이터가 없습니다.</td>';
		resrvHtml += '</tr>';
	}
	
	$('#resrvInfoList').empty().html(resrvHtml);
	
	if(monToFri != 0) 
	{
		for(var i = 1; i < 6; i++)
		{
			$('#planId_'+i).text(monToFri);
		}
		if (thisDy < 6) {
			_TodayPlanNo = monToFri;
		}
	}
	
	if(satToSun != 0)
	{
		for(var j = 6; j < 8; j++)
		{
			$('#planId_'+j).text(satToSun);
		}
		if (thisDy > 5) {
			_TodayPlanNo = satToSun;
		}
	}
	
	//var todayPlanNo = $('#planId_'+thisDy).text();
	$('#dayPlanNo option[value="'+Number(_TodayPlanNo)+'"]').prop('selected',true);

	//DAY PLAN 가저온다..
	getCropInfoList(_TodayPlanNo);
}

//DAY PLAN
function getCropInfoList(planNo) {
	var regionCd = _RegionCd;
	var intNo = _IntNo;
	var url = 'getCropInfoList.do';
	var params = 'regionCd='+regionCd+'&intNo='+intNo+'&planNo='+planNo;
	requestService(url, params, getCropInfoListCallback);
}

function getCropInfoListCallback(data) {
	var hour = thisDate.getHours();
	var operPlanHhArr = [];
	var operPlanHh;
	var operPlanMi;
	var intOperCycleVal; 
	var intOperOffsetVal;
	var aRing1PhaseVal;
	var aRing2PhaseVal;
	var aRing3PhaseVal;
	var aRing4PhaseVal;
	var aRing5PhaseVal;
	var aRing6PhaseVal;
	var aRing7PhaseVal;
	var aRing8PhaseVal;
	var bRing1PhaseVal;
	var bRing2PhaseVal;
	var bRing3PhaseVal;
	var bRing4PhaseVal;
	var bRing5PhaseVal;
	var bRing6PhaseVal;
	var bRing7PhaseVal;
	var bRing8PhaseVal;
	var dayHtml = '';
	
	if(data.length > 0)
	{
		for(var ii = 0; ii < data.length; ii++)
		{
			intPlanIdxNo     = data[ii].int_PLAN_IDX_NO;
			operPlanHh       = data[ii].oper_PLAN_HH;
			operPlanMi       = data[ii].oper_PLAN_MI;
			intOperCycleVal  = data[ii].int_OPER_CYCLE_VAL;
			intOperOffsetVal = data[ii].int_OPER_OFFSET_VAL;
			aRing1PhaseVal   = data[ii].a_RING_1_PHASE_VAL;
			aRing2PhaseVal   = data[ii].a_RING_2_PHASE_VAL;
			aRing3PhaseVal   = data[ii].a_RING_3_PHASE_VAL;
			aRing4PhaseVal   = data[ii].a_RING_4_PHASE_VAL;
			aRing5PhaseVal   = data[ii].a_RING_5_PHASE_VAL;
			aRing6PhaseVal   = data[ii].a_RING_6_PHASE_VAL;
			aRing7PhaseVal   = data[ii].a_RING_7_PHASE_VAL;
			aRing8PhaseVal   = data[ii].a_RING_8_PHASE_VAL;
			bRing1PhaseVal   = data[ii].a_RING_1_PHASE_VAL;
			bRing2PhaseVal   = data[ii].a_RING_2_PHASE_VAL;
			bRing3PhaseVal   = data[ii].a_RING_3_PHASE_VAL;
			bRing4PhaseVal   = data[ii].a_RING_4_PHASE_VAL;
			bRing5PhaseVal   = data[ii].a_RING_5_PHASE_VAL;
			bRing6PhaseVal   = data[ii].a_RING_6_PHASE_VAL;
			bRing7PhaseVal   = data[ii].a_RING_7_PHASE_VAL;
			bRing8PhaseVal   = data[ii].a_RING_8_PHASE_VAL;
			
			if(aRing1PhaseVal != 0 || bRing1PhaseVal != 0)
			{
				dayHtml += '<tr class="hourBack_'+operPlanHh+'">';
				if(operPlanHh <= hour) 
				{
					operPlanHhArr.push(operPlanHh);
				}
			}
			else
			{
				dayHtml += '<tr>';
			}
			
			dayHtml += '<td>'+intPlanIdxNo+'</td>';
			dayHtml += '<td>'+operPlanHh+'</td>';
			dayHtml += '<td>'+operPlanMi+'</td>';
			dayHtml += '<td>'+intOperCycleVal+'</td>';
			dayHtml += '<td>'+intOperOffsetVal+'</td>';
			dayHtml += '<td>'+aRing1PhaseVal+'</td>';
			dayHtml += '<td>'+bRing1PhaseVal+'</td>';
			dayHtml += '<td>'+aRing2PhaseVal+'</td>';
			dayHtml += '<td>'+bRing2PhaseVal+'</td>';
			dayHtml += '<td>'+aRing3PhaseVal+'</td>';
			dayHtml += '<td>'+bRing3PhaseVal+'</td>';
			dayHtml += '<td>'+aRing4PhaseVal+'</td>';
			dayHtml += '<td>'+bRing4PhaseVal+'</td>';
			dayHtml += '<td>'+aRing5PhaseVal+'</td>';
			dayHtml += '<td>'+bRing5PhaseVal+'</td>';
			dayHtml += '<td>'+aRing6PhaseVal+'</td>';
			dayHtml += '<td>'+bRing6PhaseVal+'</td>';
			dayHtml += '<td>'+aRing7PhaseVal+'</td>';
			dayHtml += '<td>'+bRing7PhaseVal+'</td>';
			dayHtml += '<td>'+aRing8PhaseVal+'</td>';
			dayHtml += '<td>'+bRing8PhaseVal+'</td>';
			dayHtml += '</tr>';
		}
	}
	else
	{
		dayHtml += '<tr>';
		dayHtml += '<td colspan="21">데이터가 없습니다.</td>';
		dayHtml += '</tr>';
	}
	
	$('#dayInfoList').empty().html(dayHtml);
	
	var max = operPlanHhArr.length - 1;
	$('#dayInfoList .hourBack_'+operPlanHhArr[max]).css('background-color','yellow');
}

function goEventHistory() {
	if(sigInfoDetailId != null) clearInterval(sigInfoDetailId);
	if(_CenterMarker != null) _CenterMarker.setMap(null);
	
	emptySignalArr(linkPhaseLineArr);
	emptySignalArr(_SubLinkLineArr);
	emptySignalArr(linkLineArr);
	emptySignalArr(signalALineArr);
	emptySignalArr(signalBLineArr);
	emptySignalArr(lineCenterCircleArr);
	
	linkPhaseLineArr    = [];
	_SubLinkLineArr     = [];
	linkLineArr         = [];
	signalALineArr      = [];
	signalBLineArr      = [];
	lineCenterCircleArr = [];
	
	$('.signalMapDiv').hide();
	$('#signalMapBody').empty();
	
	$('#pTab1 img').attr('src','images/tab03_off.png');
	$('#pTab2 img').attr('src','images/tab04_off.png');
	$('#pTab3 img').attr('src','images/tab05_on.png');
	$('#pTab4 img').attr('src','images/tab07_off.png');
	
	$('.popMap').show();
	$('.bottomPopMenu').show();
	$('.leftPopMenu').hide();
	$('.dayPlan').hide();
	$('.weekPlan').hide();
	$('.bottomRight').hide();
	$('.phaseInfo').hide();
	$('#moveSigId').css('color','');
	$('#updatePhaseId').css('color','');
	$('#updateLinkId').css('color','');
	$('.updatePhase').hide();
	$('.updateSigSub').hide();
	$('.sigMove').hide();
	$('.bottomPopMenu').css({top:'295px',left:'0',height:'538px',width:'908px',marginLeft:'5px',marginTop:'2px'});
	$('.popMap').css({height:'250px',width:'908px',left:'0'});
	$('.eventHist').show();
	$('.puA_'+_PhaseNum).css('background-color','#ffffff');
	$('.puB_'+_PhaseNum).css('background-color','#ffffff');
	
	map.relayout();
	map.setCenter(new kakao.maps.LatLng(_YCoord, _XCoord));
	map.setLevel(1);
	map.setDraggable(false);
	map.setZoomable(false);
	
	var eventToday = thisYy+'-'+plusZero(thisMn)+'-'+plusZero(thisDd);
	
	$('#fromPopYMD').val(eventToday);
	$('#toPopYMD').val(eventToday);
	
	$('#fromPopHour').val(plusZero(thisHh)).prop('selected',true);
	$('#fromPopMin').val(plusZero(thisMi)).prop('selected',true);
	$('#toPopHour').val(plusZero(thisHh)).prop('selected',true);
	$('#toPopMin').val(plusZero(thisMi)).prop('selected',true);
	
	getSignalInfo('sigPop');
	getPopEventList();
}

function getPopEventList() {
	var fromYMD  = $('#fromPopYMD').val();
	var fromHour = $('#fromPopHour').val();
	var fromMin  = $('#fromPopMin').val();
	var toYMD    = $('#toPopYMD').val();
	var toHour   = $('#toPopHour').val();
	var toMin    = $('#toPopMin').val();
	var eventCd  = $('#eventPopCd').val();
	
	var collctDtimeS = fromYMD + ' ' + fromHour + ':' + fromMin;
	var collctDtimeE = toYMD + ' ' + toHour + ':' + toMin;
	
	$('.loading').show();
	
	var url = 'getEventHistory.do';
	var param = 'collctDtimeS='+collctDtimeS+'&collctDtimeE='+collctDtimeE
	          + '&regionCd='+_RegionCd+'&intNo='+_IntNo+'&eventCd='+eventCd;

	requestService(url, param, getEventPopListCallback);
}

function getEventPopListCallback(data) {
	var eventHtml = '';
	var collctDtime;
	var regionCd;
	var regionNm;
	var intNo;
	var eventCd;
	
	if(data.length > 0)
	{
		for(var ii = 0; ii < data.length; ii++)
		{
			collctDtime = data[ii].COLLCT_DTIME; 
			regionCd    = data[ii].REGION_CD;
			regionNm    = data[ii].REGION_NM;
			intNo       = data[ii].INT_NO;
			eventCd     = data[ii].EVENT_CD;
			
			eventHtml += '<tr>';
			eventHtml += '<td>'+collctDtime+'</td>';
			eventHtml += '<td>'+regionCd+'</td>';
			eventHtml += '<td>'+regionNm+'</td>';
			eventHtml += '<td>'+intNo+'</td>';
			eventHtml += '<td>'+eventCd+'</td>';
			eventHtml += '</tr>';
		}
	}
	else 
	{
		eventHtml += '<tr><td colspan="5">이력정보가 없습니다.</td></tr>';
	}
	$('#eventPopListCnt').empty().html('전체 : '+data.length+'개 ');
	$('#eventPopList').empty().html(eventHtml);
	
	$('.loading').hide();
}

function goSignalMap() {
	if(getPhaseTimeId != null) clearTimeout(getPhaseTimeId);
	if(sigInfoDetailId != null) clearInterval(sigInfoDetailId);
	if(_CenterMarker != null) _CenterMarker.setMap(null);
	
	emptySignalArr(linkPhaseLineArr);
	emptySignalArr(_SubLinkLineArr);
	emptySignalArr(linkLineArr);
	emptySignalArr(signalALineArr);
	emptySignalArr(signalBLineArr);
	emptySignalArr(lineCenterCircleArr);
	
	linkPhaseLineArr    = [];
	_SubLinkLineArr     = [];
	linkLineArr         = [];
	signalALineArr      = [];
	signalBLineArr      = [];
	lineCenterCircleArr = [];
	
	$('#pTab1 img').attr('src','images/tab03_off.png');
	$('#pTab2 img').attr('src','images/tab04_off.png');
	$('#pTab3 img').attr('src','images/tab05_off.png');
	$('#pTab4 img').attr('src','images/tab07_on.png');
	
	$('.leftPopMenu').hide();
	$('.popMap').hide();
	$('.bottomPopMenu').hide();
	$('.signalMapDiv').show();
	
	var mapNo = $('#signalMapNo').val();
	
	var url = 'getSignalMap.do';
	var param = 'regionCd='+_RegionCd+
	            '&intNo='+_IntNo+
	            '&mapNo='+mapNo;
	requestService(url, param, getSignalMapCallback);
	
}

function getSignalMapCallback(data) {
	var str = '';
	var tdClass = '';
	if(data.length > 0)
	{
		$('.lcType').empty().html('제어기 유형 : '+data[0].INT_LCTYPE);
		$('.lampType').empty().html('등화기 유형 : '+data[0].INT_LAMPTYPE);
		for(var ii = 0; ii < data.length; ii++)
		{
			str += '<tr>';
			if(ii == 0 || ii == 32)
			{
				str += '<td rowspan=32 style="background-color:#ffffff;border-bottom:2px solid #000000">'+data[ii].RING_NO+'</td>';
				str += '<td style="background-color:#aaaaaa;color:#000000;font-weight:600">'+data[ii].STEP_NO+'</td>';
			}
			else
			{
				str += '<td>'+data[ii].STEP_NO+'</td>';
			}
			
			if(data[ii].EOP == 'Y') tdClass = 'eopClass';
			else tdClass = '';
			
			str += '	<td class="'+tdClass+' '+getCodeColor(data[ii].INT_LCTYPE,data[ii].CAR1)+'">'+data[ii].CAR1+'</td>';
			str += '	<td class="'+tdClass+' '+getCodeColor(data[ii].INT_LCTYPE,data[ii].PED1)+'">'+data[ii].PED1+'</td>';
			str += '	<td class="'+tdClass+' '+getCodeColor(data[ii].INT_LCTYPE,data[ii].CAR2)+'">'+data[ii].CAR2+'</td>';
			str += '	<td class="'+tdClass+' '+getCodeColor(data[ii].INT_LCTYPE,data[ii].PED2)+'">'+data[ii].PED2+'</td>';
			str += '	<td class="'+tdClass+' '+getCodeColor(data[ii].INT_LCTYPE,data[ii].CAR3)+'">'+data[ii].CAR3+'</td>';
			str += '	<td class="'+tdClass+' '+getCodeColor(data[ii].INT_LCTYPE,data[ii].PED3)+'">'+data[ii].PED3+'</td>';
			str += '	<td class="'+tdClass+' '+getCodeColor(data[ii].INT_LCTYPE,data[ii].CAR4)+'">'+data[ii].CAR4+'</td>';
			str += '	<td class="'+tdClass+' '+getCodeColor(data[ii].INT_LCTYPE,data[ii].PED4)+'">'+data[ii].PED4+'</td>';
			str += '	<td class="'+tdClass+' '+getCodeColor(data[ii].INT_LCTYPE,data[ii].CAR5)+'">'+data[ii].CAR5+'</td>';
			str += '	<td class="'+tdClass+' '+getCodeColor(data[ii].INT_LCTYPE,data[ii].PED5)+'">'+data[ii].PED5+'</td>';
			str += '	<td class="'+tdClass+' '+getCodeColor(data[ii].INT_LCTYPE,data[ii].CAR6)+'">'+data[ii].CAR6+'</td>';
			str += '	<td class="'+tdClass+' '+getCodeColor(data[ii].INT_LCTYPE,data[ii].PED6)+'">'+data[ii].PED6+'</td>';
			str += '	<td class="'+tdClass+' '+getCodeColor(data[ii].INT_LCTYPE,data[ii].CAR7)+'">'+data[ii].CAR7+'</td>';
			str += '	<td class="'+tdClass+' '+getCodeColor(data[ii].INT_LCTYPE,data[ii].PED7)+'">'+data[ii].PED7+'</td>';
			str += '	<td class="'+tdClass+' '+getCodeColor(data[ii].INT_LCTYPE,data[ii].CAR8)+'">'+data[ii].CAR8+'</td>';
			str += '	<td class="'+tdClass+' '+getCodeColor(data[ii].INT_LCTYPE,data[ii].PED8)+'">'+data[ii].PED8+'</td>';
			str += '	<td class="'+tdClass+'">'+data[ii].MIN_TM+'</td>';
			str += '	<td class="'+tdClass+'">'+data[ii].MAX_TM+'</td>';
			str += '	<td class="'+tdClass+'">'+data[ii].EOP+'</td>';
			str += '</tr>';
		}
		$('#signalMapBody').empty().html(str);
	}
	else
	{
		$('.lcType').empty().html('제어기 유형 : -');
		$('.lampType').empty().html('등화기 유형 : -');
	}
}

function getCodeColor(type,code) {
	var codeClass = '';
	if(type == '2010년형')
	{
		if(code == '04'|| code == '40') codeClass = 'codeR1'; //red
		else if(code == '01' || code == '05' || code == '10' || code == '50') codeClass = 'codeG1'; //green
		else if(code == '02' || code == '03' || code == '20' || code == '30') codeClass = 'codeY1'; //yellow
	}
	else
	{
		if(code == '08'|| code == '30' || code == '80') codeClass = 'codeR1'; //red
		else if(code == '01' || code == '04' || code == '10' || code == '40') codeClass = 'codeG1'; //green
		else if(code == '02' || code == '03' || code == '20') codeClass = 'codeY1'; //yellow
	}
	
	return codeClass; 
}

function writeSiginfoExcel() {
	
	setTimeout(function() {
		var aRing0 = (typeof aRingPhaseData.ring0 == 'undefined') ? "-" : aRingPhaseData.ring0;
		var aRing1 = (typeof aRingPhaseData.ring1 == 'undefined') ? "-" : aRingPhaseData.ring1;
		var aRing2 = (typeof aRingPhaseData.ring2 == 'undefined') ? "-" : aRingPhaseData.ring2;
		var aRing3 = (typeof aRingPhaseData.ring3 == 'undefined') ? "-" : aRingPhaseData.ring3;
		var aRing4 = (typeof aRingPhaseData.ring4 == 'undefined') ? "-" : aRingPhaseData.ring4;
		var aRing5 = (typeof aRingPhaseData.ring5 == 'undefined') ? "-" : aRingPhaseData.ring5;
		var aRing6 = (typeof aRingPhaseData.ring6 == 'undefined') ? "-" : aRingPhaseData.ring6;
		var aRing7 = (typeof aRingPhaseData.ring7 == 'undefined') ? "-" : aRingPhaseData.ring7;
		var bRing0 = (typeof bRingPhaseData.ring0 == 'undefined') ? "-" : bRingPhaseData.ring0;
		var bRing1 = (typeof bRingPhaseData.ring1 == 'undefined') ? "-" : bRingPhaseData.ring1;
		var bRing2 = (typeof bRingPhaseData.ring2 == 'undefined') ? "-" : bRingPhaseData.ring2;
		var bRing3 = (typeof bRingPhaseData.ring3 == 'undefined') ? "-" : bRingPhaseData.ring3;
		var bRing4 = (typeof bRingPhaseData.ring4 == 'undefined') ? "-" : bRingPhaseData.ring4;
		var bRing5 = (typeof bRingPhaseData.ring5 == 'undefined') ? "-" : bRingPhaseData.ring5;
		var bRing6 = (typeof bRingPhaseData.ring6 == 'undefined') ? "-" : bRingPhaseData.ring6;
		var bRing7 = (typeof bRingPhaseData.ring7 == 'undefined') ? "-" : bRingPhaseData.ring7;
		
		$('#excelXCoord').val(_XCoord);
		$('#excelYCoord').val(_YCoord);
		$('#aRing0').val(aRing0);
		$('#aRing1').val(aRing1);
		$('#aRing2').val(aRing2);
		$('#aRing3').val(aRing3);
		$('#aRing4').val(aRing4);
		$('#aRing5').val(aRing5);
		$('#aRing6').val(aRing6);
		$('#aRing7').val(aRing7);
		$('#bRing0').val(bRing0);
		$('#bRing1').val(bRing1);
		$('#bRing2').val(bRing2);
		$('#bRing3').val(bRing3);
		$('#bRing4').val(bRing4);
		$('#bRing5').val(bRing5);
		$('#bRing6').val(bRing6);
		$('#bRing7').val(bRing7);
		$('#bRing6').val(bRing6);
		$('#bRing7').val(bRing7);
		
		$('#writeSiginfoExcel').submit();
		
	}, 500 * 1);
	
}

$(window).bind("beforeunload", function (e) {
	opener.mapZoomBound();
	siginfoPhaseDetailWin = null;
});

function plusZero(str) {
	if(str < 10) str = '0'+str;
	return str;
}

$.datepicker.setDefaults({
    dateFormat: 'yy-mm-dd',
    prevText: '이전 달',
    nextText: '다음 달',
    monthNames: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
    monthNamesShort: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
    dayNames: ['일', '월', '화', '수', '목', '금', '토'],
    dayNamesShort: ['일', '월', '화', '수', '목', '금', '토'],
    dayNamesMin: ['일', '월', '화', '수', '목', '금', '토'],
    showMonthAfterYear: true,
    yearSuffix: '년'
});

$("#fromPopYMD").datepicker({
    changeMonth: true,
    changeYear: true,
    dateFormat: 'yy-mm-dd'
});

$("#toPopYMD").datepicker({
    changeMonth: true,
    changeYear: true,
    dateFormat: 'yy-mm-dd'
});
</script>

</body>
</html>
