<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@ page import="java.util.List"%>
<%@ page import="com.eactive.eai.rms.common.context.MonitoringContext"%>
<%@ page import="com.eactive.eai.rms.common.util.CommonUtil"%>
<%@ page import="com.eactive.eai.rms.common.datasource.DataSourceType"%>
<%@ page import="com.eactive.eai.rms.common.datasource.DataSourceTypeManager"%>
<%@ page import="com.eactive.eai.common.util.SystemUtil"%>
<%@ include file="/jsp/common/include/localemessage.jsp" %>

<%
	response.setHeader("Pragma", "No-cache");
	response.setHeader("Cache-Control", "no-cache");
	response.setHeader("Expires", "0");
	request.setCharacterEncoding("utf-8");
	MonitoringContext monitoringContext = (MonitoringContext)CommonUtil.getBean(request, "monitoringContext");
	
	String NEW_TITLE = (String) session.getAttribute(MonitoringContext.NEW_DASHBOARD_TITLE);
	String fepBatchUrl = monitoringContext.getStringProperty("FEP_BATCH_SERVER", "");
	String eaiBatchUrl = monitoringContext.getStringProperty("EAI_BATCH_SERVER", "");
	
	List<DataSourceType> srvList = DataSourceTypeManager.getOnlineDataSourceTypes();
	// 마지막 서버. interval 호출 시 확인을 위한 용도로 사용한다.
	
	int srvCnt = srvList.size();
	
	String srvLast = srvList.get(srvCnt - 1).getName();

	// 서버 리스트가 홀수 일 경우 Dummy를 추가해 짝수를 만든다. As-Is
	if (srvCnt % 2 == 1) {
		DataSourceType d = new DataSourceType();
		d.setName("");
		d.setText("");
		srvList.add(d);
	}
	
%>
<!DOCTYPE html>
<html lang="ko">
<head>
<title>▣▣▣ EAI 모니터링 시스템 ▣▣▣</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="<%=request.getContextPath()%>/css/style-dashboard2.css"	rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.7.2.min.js"></script>
<script type="text/JavaScript">
var debug = true;
var staticUrl = "<%=request.getContextPath()%>" + "/dashboard2.do?cmd=main&type=";

const srvList = new Array();
var srvNames = new Array();
<% 
for (int i = 0; i < srvList.size(); i ++) {
 	DataSourceType d = srvList.get(i);
	
	String name = d.getName();
	String text = d.getText();
	
	//System.out.println("---------- srvList.get( "+i+" ) getName : " + name + " getText : " + text);
%>

var map = new Map();
map.set("name", '<%=name%>');
map.set("text", '<%=text%>');

srvList[<%=i%>] = map; 
srvNames[<%=i%>] = '<%=name%>'; 
<% } %>
var srvCnt = '<%=srvCnt%>';
var srvLast = '<%=srvLast%>';


//Create and return ajax communication object
function createAjaxRequest() {
	var reqAjax = null ;
	try {
		reqAjax = new XMLHttpRequest();
	} catch ( trymicrosoft ) {
		try {
			reqAjax = new ActiveXObject("Msxml2.XMLHTTP");
		} catch ( othermicrosoft ) {
			try {
				reqAjax = new ActiveXObject("Microsoft.XMLHTTP");
			} catch( failed ) {
				reqAjax = null ;
			}
		}
	}

	if( reqAjax == null ) {
		alert("Error creating request object!");
	}
	
	return reqAjax;
}

//Insert comma per three bytes number
function commify(n) {
	var reg = /(^[+-]?\d+)(\d{3})/;
	n += '';

	while (reg.test(n))
	  n = n.replace(reg, '$1' + ',' + '$2');
	
	return n;
}

//Return number of comma string
function commanum(s) {	
	if( s == null || s == "" ) {
		return 0 ;
	}
	
	return parseInt(s.replace( /,/g,""));
}


function toNumber(val) {
	return Number(val.replace(/\,/gi, ""));
}


function getServiceId( type, isFull ) {
	var ret = "" ;
	if( isFull == true ) {
		ret = "&service=" ;
	}
	return ret + type;
}


function formdate1( d ) {
	if( d.length == 8 ) {
		return d.substring(0,4) + '.' + d.substring(4,6) + '.' + d.substring(6);
	}
	return d ;
}


function clickCloseAlarmMsg(type,id) {
	$("#obstacle"+ type + id).css({"display":"none"});
}


function getAlarmMsgHtml( type, idx ) {
	var src = '';
	src += '<div id="pop">';
	src += '  <ul>';
	src += '    <li id="popupMsgTitle' + type + idx + '">제목입니다.</li>';
	src += '    <li id="close" onclick="javascript:clickCloseAlarmMsg(\''+type+'\',\''+idx+'\');" onfocus="blur();">close</li>';
	src += '  </ul>';
	src += '  <ol id="popupMsgBody' + type + idx + '">';
	src += '    <li>에러내용입니다.</li>';
	src += '  </ol>';
	src += '</div>';
	
	return src ;
}


function showAlarmMsg(type, idx, show, msg1, msg2 ) {

	if( isPopupOn == false && show == true ) {
		return ;
	}

	var obj = document.getElementById('obstacle'+ type + idx);
	
// 	console.log(type + idx);
	if( show == true ) {
		obj.innerHTML = getAlarmMsgHtml(type , idx);
		
		var objTitle = document.getElementById('popupMsgTitle' + type + idx);
		var objBody  = document.getElementById('popupMsgBody' + type + idx);
		
		objTitle.innerHTML = msg1 ;
		objBody.innerHTML  = msg2 ;
	
		objTitle = null ;
		objBody  = null ;
		
		obj.style.display = "" ;
	}
	
	obj = null;
}

function showAlarmMsgNew(type, idx, msg1, msg2 ) {

	if( isPopupOn == false) return ;

	var obj = document.getElementById('obstacle'+ type + idx);
	
// 	console.log(type + idx);

	obj.innerHTML = getAlarmMsgHtml(type , idx);
	
	var objTitle = document.getElementById('popupMsgTitle' + type + idx);
	var objBody  = document.getElementById('popupMsgBody' + type + idx);
	
	objTitle.innerHTML = msg1 ;
	objBody.innerHTML  = msg2 ;

	objTitle = null ;
	objBody  = null ;
	
	obj.style.display = "" ;
	
	obj = null;
}


function alarmSound(tp) {
	if( isSoundOn == false ) {
		return ;
	}

	if ( tp == 'alert' ) {
		//media player가 없어서 스크립트 에러 발생시 소리끔
		if(typeof document.player.stop === 'undefined'){
			btnSound();
		}else{	
			document.player.stop();
			document.player.play();
		}
	}
	
// 	setTimeout("stopSound('" + tp + "');", 3000);
}


function stopSound(tp) {
	if( tp == 'alert' ) {
		document.player.stop();
	}
}


function gosubpage( s ) {
	var url = "<%=request.getContextPath()%>/dashboard2/" ;
	if( s == 'BATCH' ) {
		// 임시로 막아 놓는다.
		return;		
		//url += "dashsub2.jsp?service=" + s;
	} else {
		url += "dashsub1.jsp?service=" + s;
	}
	location.href = url ;
}

var isSoundOn = true ;
var isPopupOn = true ;

const reqAjaxMap = new Map();

var reqAjaxOut  = null ;
var reqAjaxIn   = null ;
var reqAjaxBatch= null ;

var reqAjaxTran = null ;
var reqAjaxPeak = null ;
var reqAjaxSms  = null ;

var reqAjaxSmsInit = null ;
var reqAjaxBaseInfo = null ;

var isFullTrade = false ;

// var hideMenuTimeoutID = -1 ;

var connectionError = "0";

var peakStat = "tps" ;
var peakDiv = "tps";

function checkConnection() {
	if( connectionError != "0" ) {
		alert( '서버와의 연결이 종료되어 현재창을 닫습니다.( error code=' + connectionError + ' ' + getDummyTime() + ' )' );
		parent.self.close();
	}
}


function getAjaxObject( type ) {
	try {
		return reqAjaxMap.get(type)
	} catch(e) {
		return null;
	}
}


function requestBaseInfo() {
	var urlBase = staticUrl + "baseinfo" ;
	var reqAjax = getAjaxObject( "BaseInfo" );
// 	if(debug) console.log("requestBaseInfo() reqAjax == " + reqAjax + "  urlBase : " + urlBase);
	
	reqAjax.open('GET', urlBase, true);
	reqAjax.onreadystatechange = updateBaseInfo ;
	reqAjax.send(null);
	reqAjax = null;
	urlBase = null;
}


function requestAllServerInfo( serverType ) {
	if( "ALL" == serverType ) {
		for (var i = 0; i < srvCnt; i++) {
			var srvName = srvList[i].get("name");
			if(debug) console.log("requestAllServerInfo(ALL) " + i + "번째 srvName : " + srvName );
			
			if (srvName != null && srvName != "") {
				requestServerInfo(srvName);
			}
		}
	} else {
		requestServerInfo(serverType);
	}	
	requestServerInfo("BAP");
	requestServerInfo("BAT");
}


function requestServerInfo( type ) {
	var url = staticUrl + "serverinfo" + getServiceId( type, true); //+ getDummyTime() ;
	var reqAjax = getAjaxObject( type );
	
// 	if(debug) console.log("4번. requestServerInfo( "+type+" ) url = " + url);	
	
	reqAjax.open('GET', url, true);  // 정의되지 않음 또는 null 참조인 'open' 속성을 가져올 수 없습니다.
	reqAjax.onreadystatechange = function() { updateServerInfo(type); };
	reqAjax.send(null);	
	reqAjax = null;
	url = null;
}


function requestHostInfo( type ) {
	var url     = staticUrl + "hostinfo" + getServiceId(type, true) ; //+ getDummyTime() ;
	var reqAjax = getAjaxObject( type );	
	
// 	if (reqAjax != null) alert("10번. requestHostInfo("+ type +") url : " + url);
	
	reqAjax.open('GET', url, true);
	reqAjax.onreadystatechange = function() { updateHostInfo(type); };
	reqAjax.send(null);
	reqAjax = null;
	url = null;
}


function requestTranInfo() {
	var url     = staticUrl + "traninfo" ;
	var reqAjax = getAjaxObject( "Tran" );	

	reqAjax.open('GET', url, true);	
	reqAjax.onreadystatechange = updateTranInfo ;
	reqAjax.send(null);	
	reqAjax = null;
	url = null;
}


function requestPeakInfo() {
	var url     = staticUrl + "peakinfo&peakstat=" + peakDiv ;
	var reqAjax = getAjaxObject( "Peak" );
	
	reqAjax.open('GET', url, true);
	reqAjax.onreadystatechange = updatePeakInfo ;
	reqAjax.send(null);	
	reqAjax = null;
	url = null;
}


function requestSmsInfo() {
	var url = staticUrl + "smsinfo";
	var reqAjax = getAjaxObject( "Sms" );

	reqAjax.open('GET', url, true);
	reqAjax.onreadystatechange = updateSmsInfo ;
	reqAjax.send(null);
	reqAjax = null;
	url = null;
}


function requestSmsInit( t ) {
	var url = staticUrl + "smsinit";	
	var reqAjax = getAjaxObject( "SmsInit");

	reqAjax.open('GET', url, true);
	reqAjax.onreadystatechange = updateSmsInit ;
	reqAjax.send(null);
	reqAjax = null ;
	url = null;
}

function getAjaxData( type ) {
	var reqAjax = getAjaxObject( type );

	try {
		if( reqAjax.readyState == 4 ) {
			if( reqAjax.status == 200 ) {
				return reqAjax.responseText ;
			} else {
				// 12029 : ERROR_INTERNET_CANNOT_CONNECT
				if( 12029 == reqAjax.status ) {
					connectionError = "12029" ;
				} else {
					connectionError = "" + reqAjax.status ;
				}
			}
		} else {
		}
	} catch ( e ){
		//alert( e ) ;
	} finally {
		reqAjax = null ;
	}
	return null ;
}


function startMonitoring( type ) {
	// 각 서비스 타입에 따라 모니터링 정보를 요청한다.
	// 개발시에만 timeout , real 은 interval
	
	// interval 값을 5초 -> 10초로 수정 2010.02.16 ( 요청 )
	var interval = 10000 ;
	
 	setInterval('requestHostInfo("' + type + '");', interval);	
//  setTimeout('requestHostInfo("' + type + '");', 4000);
// 	setTimeout( "requestTranInfo();" , 6000);
// 	setTimeout( "requestPeakInfo();" , 8000);
// 	setTimeout( "requestSmsInfo();" , 10000);
	
	// 마지막 호스트 정보 수신 후
	if( type == srvLast ) {
 	    setInterval( 'requestTranInfo();', interval/2);
 	    setInterval( 'requestPeakInfo();', interval);
	 	setInterval( 'requestSmsInfo();', interval);
	}
	
	interval = null;
}


function updateBaseInfo() {
	var msg = getAjaxData( "BaseInfo" );
// 	if(debug) console.log("2번. updateBaseInfo() msg : " + msg);
	if( null != msg ) {
		requestAllServerInfo(msg);
	}
	msg = null;
}


function updateServerInfo( type ) {
	var msg      = getAjaxData(type);
	var arrHost  = null;	
	if( null != msg ) {
		var lines = msg.split(";");
		arrHost = checkHostNames(lines);
		
// 		if(debug) console.log("5번 updateServerInfo[ "+ type +" ] arrHost : "+arrHost);
		
		var hostMax = 4 ;
		if( type == 'ISG') {
			hostMax = 2 ;
		}
		
		for( var i = 0 ; i < hostMax ; i++ ) {
			if( i < arrHost.length ) {
				setHostBasic( type, i+1);
				var arrInst = checkInstNames(lines, arrHost[i]);				
				setInstBasic( type, i+1, arrInst);
			} else {
				setHostBasicEmpty( type, i+1);
			}
		}
		
		startMonitoring( type );
	}
}


function updateHostInfo( type ) {
	var msg      = getAjaxData(type);
	//  ieaapdz1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;ieaapdz2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
	//  ieaapdg1,0,0,0,0,0,0,0,0,0,83,97,90,0,0,0,0,0,0,0,0;ieaapdg2,0,0,0,0,0,0,0,0,0,85,77,13,0,0,0,0,0,0,0,0;
	if( null != msg ) {	
		var lines = msg.split(";");
		var procCnt = 0; // host별 처리건수 
		var step = 0;
		var host = "";
		
 		if(debug) console.log("updateHostInfo["+ type +"] lines : "+lines);
		
		for( var i = 0 ; i < lines.length ; i++ ) {
			var infos = lines[i].split(",");
			if( host != infos[0]) {
				procCnt =0;
				step += 1;
				host = infos[0];
			}
			
			// NodeBox를 비활성화로 변경
			// Host명이 2개일 때 활성화 되었던 NodeBox가 Host명이 1개로 수정 되었을 때 비활성화 되도록 수정.
			if(lines.length == 1)
			{
				var id = step + 1;
				var hostObj = getHostObject(type, id);
				if(hostObj != null)
				{
					setHostBasicEmpty(type, id);
				}
			}
			
			// hostname,isDown,adapter, , , , , , ,inst000000,cpu,memory,disk,proc,rta;	
			// ieaapdz1,     1,      0,0,0,0,0,0,0,         0,  0,     0,   0,   0,  0,0,0,0,0,0,0,
			// telnet 은 되는데 was가 down 되었을 때를 생각해보라.
			
			if( infos.length >= 14 ) {
				
				if( "1" == infos[1] ) { // host Alive
					
					setHostBasic(type, step);

// 					setRTAdapterStatus(type, step, infos[14]);
					
// 					setAdapterStatus(type, step, infos[2]);
					
					setInstStatus( type, step, infos[9]);
					
					setResouceStatus('cpu', type, step, infos[10]);
					
					setResouceStatus('memory', type, step, infos[11]);
					
					setResouceStatus('disk', type, step, infos[12]);
					
// 					setCpuStatus( type, step, infos[10]);

					procCnt += parseInt(infos[13],10);
					
					setProcStatus( type, step, procCnt);
				} else {
					//alert( infos[1] + ":" + lines[i] );					
					setHostBasicDown(type, step);
					
					setInstBasic( type, step, infos[9]);
					
// 					procCnt += parseInt(infos[13],10);
					
// 					setProcStatus( type, step, procCnt);
					
				}
			} else {				
				setHostBasicDown(type, step);
				//alert( 'invalid host info : ' + infos.length ) ;
			}
		} // end for
	}	
}


function updateTranInfo() {
	var msg      = getAjaxData("Tran");
	if(debug) if(msg != null) console.log("updateTranInfo() msg : " + msg);
	//통신에러 추가
	//결과 : DSG,0,0,0,0;ZSG,0,0,0,0;TOTAL,0,0,0,0;BATCH,0,0,0,0,0,0,;EAI_BATCH,0,0,0,0,0,0,   
	//결과 : NSG,9,21,17;DSG,26,3,2;GSG,43,18,49;ZSG,34,1,27;TOTAL,73,12,10;8;8
	var tmpVal   = 0 ;
	
	var totalPos = 6;
	
	if( null != msg ) {
		var totalProc    = 0 ;
		var totalTimeout = 0 ;
		var totalError   = 0 ;
		var totalSysError   = 0 ;
		
		var lines = msg.split(";");
		for( var i = 0 ; i < lines.length ; i++ ) {
			var step = i+1;
			var infos = lines[i].split(",");
			
// 			if(debug) if(infos != null) console.log("step : "+step + "   infos : "+infos + "   length : "+infos.length);
			
			// batch : service,send,recv,esend,erecv,rsend,rrecv
			if( infos.length > totalPos && infos[0] == 'BAP' ) {  // BAP,0,0,0,0,0,0,
				step = (totalPos + 1) ;
				for( var k = 1 ; k < 7 ; k++ ) {
					var obj = document.getElementById("tranTable" + step + k);  //tranTable71~76 일괄전송
					var old = 0;
					if (obj != null) {
						old = obj.innerText ;
					}
					obj = null ;
					var beforeVal = commanum(old) ;
					var currVal   = "" + infos[k];
					if( beforeVal != currVal ) {
						rollingScore("tranTable" + step + k, currVal, old);
						rollingScore("tranTableBig" + step + k, currVal, old);
					}
				}
			}
			// eai_batch : service,send,recv,esend,erecv,rsend,rrecv
			else if( infos.length > totalPos && infos[0] == 'BAT' ) {  // BAT,0,0,0,0,0,0,			
				step = (totalPos + 2) ;
				for( var k = 1 ; k < 7 ; k++ ) {
					var obj = document.getElementById("tranTable" + step + k);  //tranTable81~87 배치
					var old = 0;
					if (obj != null) {						
						old = obj.innerText ;
					}
					obj = null ;
					var beforeVal = commanum(old) ;
					var currVal   = "" + infos[k];
					if( beforeVal != currVal ) {
						rollingScore("tranTable" + step + k, currVal, old);
						rollingScore("tranTableBig" + step + k, currVal, old);
					}
				}
			}
			// service,proc,timeout,error,syserror
			else if( infos.length > 3 ) {

				for (var k = 0; k < srvCnt; k++) {
					if( infos[0] == srvList[k].get("name") ) {
						step = k + 1 ;
						break;
					}
				}

				if( infos[0] == 'TOTAL' ) {
					step = totalPos ; // total
				}				
				
				// 거래건수
				
				if( step == totalPos ) { // 합계
					tableObj1 = null ;
					tableObj2 = null ;					
					tmpVal = '' + totalProc ;					
					rollingScore("tranTotal1", infos[1], old);
					rollingScore("tranTotalBig1", infos[1], old);
					rollingScoreArrow("tranTotal2", tmpVal, '0', '0');
					rollingScoreArrow("tranTotalBig2", tmpVal, '0', '0');
					
				} else {
					
					var tableObj1 = document.getElementById("tranTable" + step + 1);
					var tableObj2 = document.getElementById("tranTable" + step + 2);
					var old       = tableObj1.innerText ;
					
					var beforeVal = commanum(old) ;
									
					if( beforeVal == "0" || beforeVal == "" ) {
						tmpVal = 0 ;
					} else {
						tmpVal =  commanum(infos[1]) - beforeVal ;
					}
					
					if( tmpVal < 0 ) tmpVal = 0 ;
					totalProc += tmpVal ;		
// 					tableObj1.innerText = commify( infos[1] );
					//tableObj2.innerText = '↑ ' + tmpVal ;
// 					setArrowTextBody( tableObj2, '' + tmpVal );
					rollingScore("tranTable" + step + 1, infos[1], old);
					rollingScore("tranTableBig" + step + 1, infos[1], old);
					rollingScoreArrow("tranTable" + step + 2, '' + tmpVal, '0', '1' );
					rollingScoreArrow("tranTableBig" + step + 2, '' + tmpVal, '0', '1' );
					tableObj1 = null ;
					tableObj2 = null ;
				}
				
				// 타임아웃 건수
				
				if( step == totalPos ) {
					tableObj1 = null ;
					tableObj2 = null ;
					tmpVal = '' + totalTimeout ;
					rollingScore("tranTotal3", infos[2], old);
					rollingScore("tranTotalBig3", infos[2], old);
					rollingScoreArrow("tranTotal4", '' + tmpVal, '0', '0');
					rollingScoreArrow("tranTotalBig4", '' + tmpVal, '0', '0');
					
				} else {
					
					tableObj1 = document.getElementById("tranTable" + step + 3);
					tableObj2 = document.getElementById("tranTable" + step + 4);
					old       = tableObj1.innerText ;
					beforeVal = commanum(old) ;
					
					if( beforeVal == "0" || beforeVal == "" ) {
						tmpVal = 0 ;
					} else {
						tmpVal =  commanum(infos[2]) - beforeVal ;
					}
					
					if( tmpVal < 0 ) tmpVal = 0 ;
					totalTimeout += tmpVal ;
// 					tableObj1.innerText = commify( infos[2] );
					//tableObj2.innerText = tmpVal ;
// 					setArrowTextBody( tableObj2, '' + tmpVal );
					rollingScore("tranTable" + step + 3, infos[2], old );
					rollingScore("tranTableBig" + step + 3, infos[2], old );
					rollingScoreArrow("tranTable" + step + 4, '' + tmpVal, '0', '1' );
					rollingScoreArrow("tranTableBig" + step + 4, '' + tmpVal, '0', '1' );
					tableObj1 = null ;
					tableObj2 = null ;
				}

				// 에러건수
				if( step == totalPos ) {
					tableObj1 = null ;
					tableObj2 = null ;
					tmpVal = '' + totalError ;
					rollingScore("tranTotal5", infos[3], old);
					rollingScore("tranTotalBig5", infos[3], old);
					rollingScoreArrow("tranTotal6", '' + tmpVal, '0', '0');
					rollingScoreArrow("tranTotalBig6", '' + tmpVal, '0', '0');
					
				} else {
					
					tableObj1 = document.getElementById("tranTable" + step + 5);
					tableObj2 = document.getElementById("tranTable" + step + 6);
					old       = tableObj1.innerText ;
					beforeVal = commanum(old) ;
					
					if( beforeVal == "0" || beforeVal == "" ) {
						tmpVal = 0 ;
					} else {
						tmpVal = commanum(infos[3]) - beforeVal ;
					}
					
					if( tmpVal < 0 ) tmpVal = 0 ;
					totalError += tmpVal ;
// 					tableObj1.innerText = commify( infos[3] );
					//tableObj2.innerText = tmpVal ;
// 					setArrowTextBody( tableObj2, '' + tmpVal );
					rollingScore("tranTable" + step + 5, infos[3], old);
					rollingScore("tranTableBig" + step + 5, infos[3], old);
					rollingScoreArrow("tranTable" + step + 6, '' + tmpVal, '0', '1' );
					rollingScoreArrow("tranTableBig" + step + 6, '' + tmpVal, '0', '1' );
					tableObj1 = null ;
					tableObj2 = null ;
				}
				
				//-------------------------------------
				// 통신에러(시스템에러)
				if(infos.length > 4) {
					
					if( step == totalPos ) {
						tableObj1 = null ;
						tableObj2 = null ;
						tmpVal = '' + totalSysError ;
						rollingScore("tranTotal7", infos[4], old);
						rollingScore("tranTotalBig7", infos[4], old);
						rollingScoreArrow("tranTotal8", '' + tmpVal, '0', '0');
						rollingScoreArrow("tranTotalBig8", '' + tmpVal, '0', '0');
					} else {
						
						tableObj1 = document.getElementById("tranTable" + step + 7);
						tableObj2 = document.getElementById("tranTable" + step + 8);
						old       = tableObj1.innerText ;
						beforeVal = commanum(old) ;
						
						if( beforeVal == "0" || beforeVal == "" ) {
							tmpVal = 0 ;
						} else {
							tmpVal = commanum(infos[4]) - beforeVal ;
						}
						
						if( tmpVal < 0 ) tmpVal = 0 ;
						totalSysError += tmpVal ;
						rollingScore("tranTable" + step + 7, infos[4], old);
						rollingScore("tranTableBig" + step + 7, infos[4], old);
						rollingScoreArrow("tranTable" + step + 8, '' + tmpVal, '0', '1' );
						rollingScoreArrow("tranTableBig" + step + 8, '' + tmpVal, '0', '1' );
						tableObj1 = null ;
						tableObj2 = null ;
					}
				}
				
				tableObj1 = null ;
				tableObj2 = null ;
			}			
		}		
	}
}


function updatePeakInfo( ) {
	var msg      = getAjaxData("Peak");
	console.log("updatePeakInfo( ) msg : " + msg);
	//  DSG,20191021,25394,11;ZSG,20090623,0,0
	if( null != msg ) {
		var lines = msg.split(";");
		for( var i = 0 ; i < lines.length ; i++ ) {
			
 			//if(debug) console.log("step i : "+ i + "   infos : "+lines);
			
			var infos = lines[i].split(",");
			// service,date,proc,tps
			if( infos.length > 3 ) {
				var tableObj1 = document.getElementById("peakTable" + infos[0] + 1);
				var tableObj2 = document.getElementById("peakTable" + infos[0] + 2);
				var tableObj3 = document.getElementById("peakTable" + infos[0] + 3);
				tableObj1.innerText = formdate1( infos[1] ) ;
				tableObj2.innerText = commify( infos[2] ) ;
				tableObj3.innerText = commify( infos[3] ) ;

				tableObj1 = null ;
				tableObj2 = null ;
				tableObj3 = null ;
			}
		}
	}
}


function updateSmsInfo( ) {
	var msg      = getAjaxData("Sms");
	if(debug) if(msg != null) console.log("updateSmsInfo() msg : " + msg);
	if( null != msg && msg != "") {	
		var lines = msg.split(";");
		var len = lines.length < 10 ? lines.length : 10;
		for( var i = 0 ; i < len ; i++ ) {
			var step = i;
			var infos = lines[i].split(",");
			// type,inst       ,date        ,message
			// 개발  ,EAIDS01_i02,03-31 10:24:,01.409] ERROR [37]Di02 수동어댑터|KMB0630051KMBS01
			if( infos.length > 3 ) {
				var tableObj1 = document.getElementById("smsTable" + step + "1");
				var tableObj2 = document.getElementById("smsTable" + step + "2");
				var tableObj3 = document.getElementById("smsTable" + step + "3");
				var tableObj4 = document.getElementById("smsTable" + step + "4");	
				
				tableObj1.innerText = infos[0] ;
				tableObj2.innerText = infos[1] ;
				tableObj3.innerText = infos[2] ;
				tableObj4.innerText = infos[3] ;				
				
				tableObj1 = null ;
				tableObj2 = null ;
				tableObj3 = null ;
				tableObj4 = null ;
			}
		}
	}	
}


function updateSmsInit( ) {
	for( var i = 1 ; i <= 10 ; i++ ) {
		var tableObj1 = document.getElementById("smsTable" + i + "1");
		var tableObj2 = document.getElementById("smsTable" + i + "2");
		var tableObj3 = document.getElementById("smsTable" + i + "3");
		var tableObj4 = document.getElementById("smsTable" + i + "4");	
		
		tableObj1.innerText = "" ;
		tableObj2.innerText = "" ;
		tableObj3.innerText = "" ;
		tableObj4.innerText = "" ;				
		
		//tableObj1 = null ;
		//tableObj2 = null ;
		//tableObj3 = null ;
		//tableObj4 = null ;		
	}
}


function clearSmsInfo() {	
	$("span[id*='smsTable']").html("");
}


function getHostEmptyHtml() {
	var bodyHtml = '' ;
	bodyHtml += '<button>Adapter<span>▼</span></button>';
	bodyHtml += '  <ul class="cpuMonitor">';
	bodyHtml += '    <li><p>CPU</p><span></span></li>';
	bodyHtml += '    <li><p>MEM</p><span></span></li>';
	bodyHtml += '    <li><p>DISK</p><span></span></li>';
	bodyHtml += '  </ul>';
	bodyHtml += '  <ul class="monitorNumWrap">';  //instDSGDisplay1
	bodyHtml += '  </ul>';
	bodyHtml += '  <p class="monitorNone"><%= localeMessage.getString("dashMain.nA") %></p>';
	return bodyHtml;
}


function getHostDownHtml(type, no) {
	var bodyHtml = '' ;
	bodyHtml += '<button>Adapter<span>▼</span></button>';
	bodyHtml += '  <ul class="cpuMonitor">';
	bodyHtml += '    <li><p>CPU</p><span>--%</span></li>';
	bodyHtml += '    <li><p>MEM</p><span>--%</span></li>';
	bodyHtml += '    <li><p>DISK</p><span>--%</span></li>';
	bodyHtml += '  </ul>';
	bodyHtml += '  <ul class="monitorNumWrap" id="'+ getInstId(type, no) +'">';  //instDSGDisplay1
	bodyHtml += '  </ul>';	
	bodyHtml += '  <p class="monitorDown">Node down</p>';
// 	bodyHtml += '  <p class="monitorTotal" id="' + getProcId(type, no) +'"></p>';
	return bodyHtml;
}


function getHostHtml(type, no) {
	var bodyHtml = '' ;	
	bodyHtml += '<h2>'+ no +'</h2>';
	bodyHtml += '<button>Adapter<span>▼</span></button>';
	bodyHtml += '  <ul class="cpuMonitor">';
	bodyHtml += '    <li><p>CPU</p><span id="'+ getCpuId(type, no) +'" >0%</span></li>';
	bodyHtml += '    <li><p>MEM</p><span id="'+ getMemoryId(type, no) +'">0%</span></li>';
	bodyHtml += '    <li><p>DISK</p><span id="'+ getDiskId(type, no) +'">0%</span></li>';
	bodyHtml += '  </ul>';
	bodyHtml += '  <ul class="monitorNumWrap" id="'+ getInstId(type, no) +'" style="background:url(<%=request.getContextPath()%>/images/dashboard2/back_num.png)no-repeat;" ></ul>';  //instDSGDisplay1
	bodyHtml += '  <p class="monitorTotal" id="' + getProcId(type, no) +'">ready</p>';  //procDSGVal1
	return bodyHtml;
}

function getAdapterId(type,id) { return "adapter" + type + "Display" + id; }
function getRTAdapterId(type,id) { return "adapterRT" + type + "Display" + id; }

function getInstId(type, id) { return "inst" + type + "Display" + id; }
function getInstLineId(type, id) { return "inst" + type + "Line" + id; } //instDSGLine1

function getCpuId(type, id) { return "cpu" + type + "Val" + id; }
function getMemoryId(type, id) { return "memory" + type + "Val" + id; }
function getDiskId(type, id) { return "disk" + type + "Val" + id; }

function getProcId(type, id) { return "proc" + type + "Val" + id; }
function getHostId(type,id) { return "host" + type + "Display" + id; }

function getAdapterObject(type, id) { 
	return document.getElementById( getAdapterId(type, id) );
}

function getRTAdapterObject(type, id) {
	return document.getElementById( getRTAdapterId(type, id) );
}

function getHostObject(type, id) {
	return document.getElementById("host" + type + "Display" + id );
}

function getInstLineObject(type, id) {
	return document.getElementById( "inst" + type + "Line" + id ); //instDSGLine1
}

function getInstObject(type, id) {
	return document.getElementById( "inst" + type + "Display" + id);  //instDSGDisplay1
}

function getProcObject(type, id ) { return document.getElementById( getProcId(type, id) ); }


// Draw empty host box image
function setHostBasicEmpty(type, no) {
	var hostObj = getHostObject(type,no);
	if( hostObj != null ) {		
 		hostObj.className = "monitorOff";
		hostObj.innerHTML = getHostEmptyHtml();
	}
	hostObj = null ;
}

function setHostBasicDown(type, no) {
	var hostObj = getHostObject(type, no);
	if( hostObj != null ) {
		
		hostObj.className = "monitorOff";
		hostObj.innerHTML = getHostDownHtml(type, no);
	}
	hostObj = null ;
}

// Draw basic host box image
function setHostBasic( type, no ) { 
	var hostObj = getHostObject(type, no);
	if( hostObj != null ) {
		
		hostObj.className = "monitorOn" ;		
		hostObj.innerHTML = getHostHtml( type, no);
	}
	hostObj = null ;
}


function setInstBasic( type, id, arrInsts ) {

// 	if(debug) console.log("7번. setInstBasic[ "+ type +" , id = "+ id +"] 인스턴스상태 : "+arrInsts);	
	var instObj = getInstObject(type, id);  

	if( instObj != null ) {		
		var htmlSrc = "" ;
		for( var i = 1 ; i <= arrInsts.length ; i++ ) {
			htmlSrc += '<li class="monitorNumGrey">'+i+'</li>';
		}
		instObj.innerHTML = htmlSrc;
	}
	instObj = null;
}


function setInstStatus( type, id, stat ) {

	var bAlarm = false ;
	var msg1 = getMsgTitleByType(type) + ' ' + id + ' <%= localeMessage.getString("dashMain.ser") %>' ;
	var msg2 = '<li>' ;	
	var htmlSrc = "" ;
	
	for( var i = 1 ; i <= stat.length ; i++ ) {
		if( '1' == stat.charAt(i-1) ) {  //인스턴스 정상
			htmlSrc += '<li class="monitorNumBlue">'+i+'</li>';
		} else {  //인스턴스 에러
			bAlarm = true ;
			htmlSrc += '<li class="monitorNumRed">'+i+'</li>';			
			msg2 += '<%= localeMessage.getString("dashMain.no") %>' + i ;
		}
	}
	
	$("#inst"+type+"Display"+id).html(htmlSrc);

	htmlSrc = null;

	if( bAlarm == true ) {
		msg2 += '</li><li><%= localeMessage.getString("dashMain.msg") %></li>'
		alarmSound( 'alert' );
// 		showAlarmMsg(type, idx, true, msg1, msg2 );
		showAlarmMsgNew(type, id, msg1, msg2 );
	} else {
		if($("#obstacle"+ type + id).css('display') != 'none'){
			clickCloseAlarmMsg(type,id);
		}
	}	
}


function getMsgIdxByType(type) {  // 미사용

	for (var i = 0; i < srvCnt; i ++) {
		var srvName = srvList[i].get("name");
		if (type == srvName) {
			return ( i + 1 ) + "";			
			// 굳이 +1을 해서 return을 해야했니? id가 있는데??
		}
	}

	if( type == 'BATCH' ) {
		return 4 ; 
	} else {
		return 0 ;
	}
}


function getMsgTitleByType(type) {
	
	for (var i = 0; i < srvCnt; i ++) {
		var srvName = srvList[i].get("name");
		if (type == srvName) {
			return srvList[i].get("text");
		}
	}
			
	if( type == 'BAP' ) {
		return '일괄전송' ;
	} else if( type == 'BAT' ) {
		return '배치' ;
	} else {
		return '' ;
	}
}


function setResouceStatus( Re, type, id, val ) {
	if( Number(val) >= 75 ) {
		$("#"+Re+type+"Val"+id).css({color:"red"});
		alarmSound( 'alert' );
	} else if( Number(val) >= 50 ) {
		$("#"+Re+type+"Val"+id).css({color:"#feff16"});
	} else {
		$("#"+Re+type+"Val"+id).css({color:"#fff"});
	}	
	$("#"+Re+type+"Val"+id).html(val + "%");
}


function setCpuStatus( type, id, val ) {	
	if( Number(val) >= 75 ) {
		$("#cpu"+type+"Val"+id).css({color:"red"});
		alarmSound( 'alert' );
	} else if( Number(val) >= 50 ) {
		$("#cpu"+type+"Val"+id).css({color:"#feff16"});
	} else {
	$("#cpu"+type+"Val"+id).css({color:"#fff"});
	}
	$("#cpu"+type+"Val"+id).html(val + "%");
}


function setProcStatus( type, id, val ) {
	var procObj = getProcObject(type, id);
	val = commify(val);
	procObj.innerHTML = val ;
	procObj = null ;
}


function setRTAdapterStatus( type, id, stat ) {
	var adapterObj = getRTAdapterObject(type, id);
	if( adapterObj == null ) {
		return ;
	}

	// RT가 존재하는지 확인 필요
	stat = 3;

	if( stat == "0" ) { // 에러
		adapterObj.innerHTML = '<img src="<%=request.getContextPath()%>/image/node/adapterBallRed.gif"  style=\"cursor:pointer\" align=\"right\"/>' ;
	} else if( stat == "1" ) { // 부분정상
		adapterObj.innerHTML = '<img src="<%=request.getContextPath()%>/image/node/adapterBallYellow.gif"  style=\"cursor:pointer\" align=\"right\"/>' ;
	} else if( stat == "2" ) { // 정상
		adapterObj.innerHTML = '<img src="<%=request.getContextPath()%>/image/node/adapterBallGreen.gif"  style=\"cursor:pointer\" align=\"right\"/>' ;	
	} else if ( stat == "3" ) { // 없음
		adapterObj.innerHTML = '<img src="<%=request.getContextPath()%>/image/node/adapterBallGray.gif"  style=\"cursor:pointer\" align=\"right\"/>' ;
	}
	
	adapterObj = null ;
}


function setAdapterStatus( type, id, stat ) {
	var adapterObj = getAdapterObject(type, id);
	if( adapterObj == null ) {
		return ;
	}

	if( stat == "0" ) { // 에러
		adapterObj.innerHTML = '<img src="<%=request.getContextPath()%>/image/node/adapterBallRed.gif"  style=\"cursor:pointer\" align=\"right\"/>' ;
	} else if( stat == "1" ) { // 부분정상
		adapterObj.innerHTML = '<img src="<%=request.getContextPath()%>/image/node/adapterBallYellow.gif"  style=\"cursor:pointer\" align=\"right\"/>' ;
	} else if( stat == "2" ) { // 정상
		adapterObj.innerHTML = '<img src="<%=request.getContextPath()%>/image/node/adapterBallGreen.gif"  style=\"cursor:pointer\" align=\"right\"/>' ;	
	} else if ( stat == "3" ) { // 없음
		adapterObj.innerHTML = '<img src="<%=request.getContextPath()%>/image/node/adapterBallGray.gif"  style=\"cursor:pointer\" align=\"right\"/>' ;
	}
	
	adapterObj = null ;
}


function checkHostNames( lines ) {
	var arrHosts = new Array();
	var cntHost = 0 ;
	var back = "" ;
	if( lines != null ) {
		for( var i = 0 ; i < lines.length ; i++ ) {
			var infos = lines[i].split(",");
			// inst, ip, port, host
			if( infos.length > 3 ) {
				if( infos[3] != back ) {
					cntHost ++ ;
					back = infos[3];
					arrHosts[cntHost-1] = infos[3];
				}
			}
		}		
	}
	
	return arrHosts;
}


function checkInstNames( lines, host ) {
	var arrInst = new Array();
	var step = 0 ;
	if( lines != null ) {
		for( var i = 0 ; i < lines.length ; i++ ) {
			var infos = lines[i].split(",");
			if( infos.length > 3 ) {
				if( infos[3] == host ) {
					arrInst[step++] = infos[0];
				}
			}		
		}
	}
	return arrInst;
}


function setTopTime() {
	var t = new Date();
	var month = lPadTime(t.getMonth()+1);
	var week;
	if( t.getDay() == 0 ) {week = "일";}
	else if( t.getDay() == 1 ) {week = "월";}
	else if( t.getDay() == 2 ) {week = "화";}
	else if( t.getDay() == 3 ) {week = "수";}
	else if( t.getDay() == 4 ) {week = "목";}
	else if( t.getDay() == 5 ) {week = "금";}
	else if( t.getDay() == 6 ) {week = "토";}
	var time = ( t.getFullYear() + "." 
			   + month + "." 
			   + lPadTime(t.getDate()) + "(" 
			   + week + ") "
			   + lPadTime(t.getHours()) + ":" 
			   + lPadTime(t.getMinutes()) + ":" 
			   + lPadTime(t.getSeconds()) );

	$(".time").html(time);
		
	if( t.getHours() == 4 && t.getMinutes() == 30 ) {
		if( t.getSeconds() == 20 || t.getSeconds() == 21 ) {
			opener.reopenDashboard();
		}
	}		
	
	t = null;
	week = null;
	month = null;	
}


function changeFullTrade() {	
	if( isFullTrade == false ) {
		$("#peakTable").hide(250);
		$("#smsTable").hide(250);
		$("#tradeTable").hide(250);
		
		
		$(".tradeTableBig").show(250);
		
		isFullTrade = true ;
	} else {
		$(".tradeTableBig").hide(250);
		$("#tradeTable").show(250);
		$("#peakTable").show(250);
		$("#smsTable").show(250);
		
		isFullTrade = false ; 
	}
}

// 거래처리집계현황 크게보기
function getLargeTradeTable() {  // thead 업무그룹,거래처리,거래처리증가,timeout,timeout증가,에러건수,에러건수증가,합계
		
	var src = '';
	src += '<h1 class="titTableBig" onclick="javascript:changeFullTrade()" style="cursor:pointer">거래처리 집계현황</h1>';
	src += '<table class="tradeGroupBig">';
	src +=   '<thead>';
	src +=	   '<tr>';
	src +=	     '<th>업무그룹</th>';
	src +=	     '<th>거래처리</th>';
	src +=	     '<th>거래처리증가</th>';
	src +=	     '<th>TIMEOUT</th>';
	src +=	     '<th>TIMEOUT증가</th>';
	src +=	     '<th>업무에러</th>';
	src +=	     '<th>업무에러증가</th>';
	src +=	     '<th>통신에러</th>';
	src +=	     '<th>통신에러증가</th>';
	src +=	   '</tr>';
	src +=	 '</thead>';
	src +=	 '<tbody>';

	for (var i = 0; i < srvCnt; i ++) {
		var srvName = srvList[i].get("name");
		if (srvName != null && srvName != "") {
			src += '<tr>';
			src +=   '<th>'+srvName+'</th>';
		    src +=   '<td onclick="javascript:goMainMenu(\'transaction\', \''+srvName+'\');" title="내부 거래현황" style="cursor:pointer"><span id="tranTable'+(i+1)+'1">0</span></td>';
			src +=   '<td><span id="tranTable'+(i+1)+'2">0</span></td>';
			src +=   '<td onclick="javascript:popupError(\''+srvName+'\',\'TIMEOUT\',0);" title="타임아웃화면 팝업" style="cursor:pointer"><span id="tranTable'+(i+1)+'3">0</span></td>';
			src +=   '<td><span id="tranTable'+(i+1)+'4">0</span></td>';
			src +=   '<td onclick="javascript:popupError(\''+srvName+'\',\'ERROR\',0);" title="에러화면 팝업" style="cursor:pointer"><span id="tranTable'+(i+1)+'5">0</span></td>';
			src +=   '<td><span id="tranTable'+(i+1)+'6">0</span></td>';	
			src +=   '<td onclick="javascript:popupError(\''+srvName+'\',\'CONNECTION\',0);" title="통신에러화면 팝업" style="cursor:pointer"><span id="tranTable'+(i+1)+'7">0</span></td>';
			src +=   '<td><span id="tranTable'+(i+1)+'8">0</span></td>';			

			src += '</tr>';
		}
	}
	

	src +=     '<tr class="total">';
	src +=		 '<th>합계</th>';
	src +=		 '<td id="tranTotal1">0</td>';
	src +=		 '<td id="tranTotal2">0</td>';
	src +=		 '<td class="sumRight"><span id="tranTotal3">0</span></td>';
	src +=		 '<td class="sumRight"><span id="tranTotal4">0</span></td>';
	src +=		 '<td class="sumRight"><span id="tranTotal5">0</span></td>';
	src +=		 '<td class="sumRight"><span id="tranTotal6">0</span></td>';
	src +=		 '<td class="sumRight"><span id="tranTotal7">0</span></td>';
	src +=		 '<td class="sumRight"><span id="tranTotal8">0</span></td>';	
	src +=	    '</tr>';
	src +=    '</tbody>';
	src +=  '</table>';

	src += '<table class="allTransBig">';	
	src +=   '<tr>';
	src +=     '<th>일괄전송</th>';
// 	src +=		'<td onclick="javascript:goBatch(\'FEP\');" title="일괄전송" style="cursor:pointer" align="center"><span class="textGroup">일괄전송</span></td>';	
	src +=     '<td><p>정상송신</p><span id="tranTable71">0</span></td>';
	src +=     '<td><p>정상수신</p><span id="tranTable72">0</span></td>';
	src +=     '<td onclick="javascript:goMainMenu(\'senderr\', \'ISG\');" style="cursor:pointer"><p>에러송신</p><span id="tranTable73">0</span></td>';
	src +=     '<td onclick="javascript:goMainMenu(\'recverr\', \'ISG\');" style="cursor:pointer"><p>에러수신</p><span id="tranTable74">0</span></td>';
	src +=     '<td onclick="javascript:goMainMenu(\'sendwait\', \'ISG\');" style="cursor:pointer"><p>대기송신</p><span id="tranTable75">0</span></td>';
	src +=     '<td onclick="javascript:goMainMenu(\'recvwait\', \'ISG\');" style="cursor:pointer"><p>대기수신</p><span id="tranTable76">0</span></td>';	
	src +=   '</tr>';
	src +=   '<tr>';
	src +=     '<th>배치</th>';
	src +=     '<td><p>정상송신</p><span id="tranTable81">0</span></td>';
	src +=     '<td><p>정상수신</p><span id="tranTable82">0</span></td>';
	src +=     '<td><p>에러송신</p><span id="tranTable83">0</span></td>';
	src +=     '<td><p>에러수신</p><span id="tranTable84">0</span></td>';
	src +=     '<td><p>대기송신</p><span id="tranTable85">0</span></td>';
	src +=     '<td><p>대기수신</p><span id="tranTable86">0</span></td>';	
	src +=   '</tr>';
	src += '</table>';
	
	return src ;
}

//거래처리집계현황 작게보기 (원래크기로 복원)
function getSmallTradeTable() {
	var src = '';
	src += '<h1 class="titTable" onclick="javascript:changeFullTrade()" style="cursor:pointer">거래처리 집계현황</h1>';
	src +=   '<table class="tradeGroup">';
	src +=   '<thead>';
	src +=     '<tr>';
	src +=       '<th>업무그룹</th>';
	src +=       '<th>거래처리</th>';
	src +=       '<th>거래처리증가</th>';
	src +=       '<th>TIMEOUT</th>';
	src +=       '<th>TIMEOUT증가</th>';
	src +=       '<th>업무에러</th>';
	src +=       '<th>업무에러증가</th>';
	src +=	     '<th>통신에러</th>';
	src +=	     '<th>통신에러증가</th>';
	src +=     '</tr>';
	src +=   '</thead>';
	src +=   '<tbody>';
	
	
	var j;
	if (srvCnt > 3) j = 3;
	else j = srvCnt;	
	
	for (var i = 0; i < j ; i ++) {
		var srvName = srvList[i].get("name");		
		if (srvName != null && srvName != "") {
			src +=  '<tr>';
			src +=    '<th>'+srvName+'</th>';
		    src +=    '<td onclick="javascript:goMainMenu(\'transaction\', \''+srvName+'\');" title="내부 거래현황" style="cursor:pointer"><span id="tranTable'+(i+1)+'1">0</span></td>';
			src +=    '<td><span id="tranTable'+(i+1)+'2">0</span></td>';
			src +=    '<td onclick="javascript:popupError(\''+srvName+'\',\'TIMEOUT\',0);" title="타임아웃화면 팝업" style="cursor:pointer"><span id="tranTable'+(i+1)+'3">0</span></td>';
			src +=    '<td><span id="tranTable'+(i+1)+'4">0</span></td>';
			src +=    '<td onclick="javascript:popupError(\''+srvName+'\',\'ERROR\',0);" title="에러화면 팝업" style="cursor:pointer"><span id="tranTable'+(i+1)+'5">0</span></td>';
			src +=    '<td><span id="tranTable'+(i+1)+'6">0</span></td>';
			src +=    '<td onclick="javascript:popupError(\''+srvName+'\',\'CONNECTION\',0);" title="통신에러화면 팝업" style="cursor:pointer"><span id="tranTable'+(i+1)+'7">0</span></td>';
			src +=    '<td><span id="tranTable'+(i+1)+'8">0</span></td>';	
			src +=  '</tr>';
		}
	}
	
	src +=   '</tbody>';
	src +=   '</table>';	
	
	src +=   '<table class="tradeGroup" style="float:right;margin-right:14px;">';
	src +=   '<thead>';
	src +=     '<tr>';
	src +=       '<th>업무그룹</th>';
	src +=       '<th>거래처리</th>';
	src +=       '<th>거래처리증가</th>';
	src +=       '<th>TIMEOUT</th>';
	src +=       '<th>TIMEOUT증가</th>';
	src +=       '<th>업무에러</th>';
	src +=       '<th>업무에러증가</th>';
	src +=       '<th>통신에러</th>';
	src +=       '<th>통신에러증가</th>';	
	src +=     '</tr>';
	src +=   '</thead>';
	src +=   '<tbody>';
	
	for (var i = j; i < srvCnt ; i ++) {
		var srvName = srvList[i].get("name");		
		if (srvName != null && srvName != "") {
			src +=  '<tr>';
			src +=    '<th>'+srvName+'</th>';
		    src +=    '<td onclick="javascript:goMainMenu(\'transaction\', \''+srvName+'\');" title="내부 거래현황" style="cursor:pointer"><span id="tranTable'+(i+1)+'1">0</span></td>';
			src +=    '<td><span id="tranTable'+(i+1)+'2">0</span></td>';
			src +=    '<td onclick="javascript:popupError(\''+srvName+'\',\'TIMEOUT\',0);" title="타임아웃화면 팝업" style="cursor:pointer"><span id="tranTable'+(i+1)+'3">0</span></td>';
			src +=    '<td><span id="tranTable'+(i+1)+'4">0</span></td>';
			src +=    '<td onclick="javascript:popupError(\''+srvName+'\',\'ERROR\',0);" title="에러화면 팝업" style="cursor:pointer"><span id="tranTable'+(i+1)+'5">0</span></td>';
			src +=    '<td><span id="tranTable'+(i+1)+'6">0</span></td>';	
			src +=    '<td onclick="javascript:popupError(\''+srvName+'\',\'CONNECTION\',0);" title="통신에러화면 팝업" style="cursor:pointer"><span id="tranTable'+(i+1)+'7">0</span></td>';
			src +=    '<td><span id="tranTable'+(i+1)+'8">0</span></td>';	
			src +=  '</tr>';
		}
	}

	src +=	  '<tr class="total">';
	src +=      '<th style="width:160px">합계</th>';
	src +=		 '<td class="sumRight"><span id="tranTotal1">0</span></td>';
	src +=		 '<td class="sumRight"><span id="tranTotal2">0</span></td>';
	src +=		 '<td class="sumRight"><span id="tranTotal3">0</span></td>';
	src +=		 '<td class="sumRight"><span id="tranTotal4">0</span></td>';
	src +=		 '<td class="sumRight"><span id="tranTotal5">0</span></td>';
	src +=		 '<td class="sumRight"><span id="tranTotal6">0</span></td>';
	src +=		 '<td class="sumRight"><span id="tranTotal7">0</span></td>';
	src +=		 '<td class="sumRight"><span id="tranTotal8">0</span></td>';
	src +=	    '</tr>';
	src +=    '</tbody>';
	src +=  '</table>';

	src +=   '<table class="tradeGroup" style="height:40px">';
	src +=   '</table>'; 
	
	
	src += '<table class="allTrans">';	
	src +=   '<tr>';
	src +=     '<th>일괄전송</th>';
	src +=     '<td><p>정상송신</p><span id="tranTable71">0</span></td>';
	src +=     '<td><p>정상수신</p><span id="tranTable72">0</span></td>';
	src +=     '<td onclick="javascript:goMainMenu(\'senderr\', \'ISG\');" style="cursor:pointer"><p>에러송신</p><span id="tranTable73">0</span></td>';
	src +=     '<td onclick="javascript:goMainMenu(\'recverr\', \'ISG\');" style="cursor:pointer"><p>에러수신</p><span id="tranTable74">0</span></td>';
	src +=     '<td onclick="javascript:goMainMenu(\'sendwait\', \'ISG\');" style="cursor:pointer"><p>대기송신</p><span id="tranTable75">0</span></td>';
	src +=     '<td onclick="javascript:goMainMenu(\'recvwait\', \'ISG\');" style="cursor:pointer"><p>대기수신</p><span id="tranTable76">0</span></td>';
	src +=   '</tr>';
	src += '</table>';
	src += '<table class="allTrans" style="float:right;margin-right:14px;">';
	src +=   '<tr>';
	src +=     '<th style="">배치</th>';
	src +=     '<td><p>정상송신</p><span id="tranTable81">0</span></td>';
	src +=     '<td><p>정상수신</p><span id="tranTable82">0</span></td>';
	src +=     '<td><p>에러송신</p><span id="tranTable83">0</span></td>';
	src +=     '<td><p>에러수신</p><span id="tranTable84">0</span></td>';
	src +=     '<td><p>대기송신</p><span id="tranTable85">0</span></td>';
	src +=     '<td><p>대기수신</p><span id="tranTable86">0</span></td>';
	src +=   '</tr>';
	src += '</table>';
	
	return src ;
}


function goBatch( service ) {
	var url = '' ;
	
	if( service == 'FEP' ) {
		url = '<%=fepBatchUrl%>' ;
	} else if( service == 'EAI' ) {
		url = '<%=eaiBatchUrl%>' ;
	}
	
	window.open(url,service + 'BATCH');	
} // end goBatch

// 상단 드롭다운 메뉴
function goMainMenu( type, service, mod ) {
	var url = "<%=request.getContextPath()%>" ;
	
	if( type == "monitor" ) {
		url = url + "/main.do?serviceType=" + service ;
	} else if( type == "transaction" ) {
		url = url + "/main/adapter.do?adapterType=TRANSACTION&serviceType=" + service ;
	} else if( type == "rule" ) {
		url = url + "/main/adapter.do?adapterType=RULE&serviceType=" + service ;
	} else if( type == "status" && mod != null ) {
		url = url + "/main/adapter.do?adapterType=STATUS&mod=" + (mod == 1 ? 'ERR' : '24E') +"&serviceType=" + service ;
	} else if( type == "status" ) {
		url = url + "/main/adapter.do?adapterType=STATUS&serviceType=" + service ;
	} else if( type == "senderr" ) {
		url = url + "/main.do?mainPage=/monitoring/bap/transaction/transactionStatusMan.view&menuId=0305001&serviceType=ISG";
		localStorage.setItem("searchProcessType", "S");
		localStorage.setItem("searchStatus", "E");
	} else if( type == "recverr" ) {
		url = url + "/main.do?mainPage=/monitoring/bap/transaction/transactionStatusMan.view&menuId=0305001&serviceType=ISG";
		localStorage.setItem("searchProcessType", "R");
		localStorage.setItem("searchStatus", "E");
	} else if( type == "sendwait" ) {
		url = url + "/main.do?mainPage=/monitoring/bap/transaction/transactionStatusMan.view&menuId=0305001&serviceType=ISG";
		localStorage.setItem("searchProcessType", "S");
		localStorage.setItem("searchStatus", "Q");
	} else if( type == "recvwait" ) {
		url = url + "/main.do?mainPage=/monitoring/bap/transaction/transactionStatusMan.view&menuId=0305001&serviceType=ISG";
		localStorage.setItem("searchProcessType", "R");
		localStorage.setItem("searchStatus", "Q");
	} else {

	}	
	
	try {
		parent.opener.location.href = url ;
 		
	} catch(e) {
		//alert(e);
		var tail = window.parent.name;
		tail = tail.substr(tail.length-1);
		var RMSOnline = window.open(url,'RMSOnline' + tail);
		RMSOnline.moveTo(0, 0);
		RMSOnline.resizeTo(screen.availWidth, screen.availHeight);
		
	}
}


function btnSound() {
	if(isSoundOn == true){		
		isSoundOn = false ;
		$('#soundOption').addClass("soundOff");
		$('#soundOption').removeClass("soundOn");
		$('#soundOption').attr("title", "<%= localeMessage.getString("dashMain.soundOpt1") %>");
	}else{
		isSoundOn = true ;
		$('#soundOption').addClass("soundOn");
		$('#soundOption').removeClass("soundOff");
		$('#soundOption').attr("title", "<%= localeMessage.getString("dashMain.soundOpt2") %>");
	}
}


function btnPopupClose() {
	$("div[id*='obstacle']").css({ display : "none" });
}


function btnPopup() {
	if(isPopupOn == true){
		btnPopupClose();
		isPopupOn = false;
		$('#popOption').addClass("popMin");
		$('#popOption').removeClass("popMax");
		$('#popOption').attr("title", "<%= localeMessage.getString("dashMain.popup1") %>");
	}else{
		isPopupOn = true;
		$('#popOption').addClass("popMax");
		$('#popOption').removeClass("popMin");
		$('#popOption').attr("title", "<%= localeMessage.getString("dashMain.popup2") %>");
		
	}
}


function lPadTime(n) {
	if( n.toString(10).length == 1 ) {
		return "0" + n;
	}
	return n;
}


function popupError(  svc, type, commDiv ) {
	var stats = 'toolbar=no'
	          + ',location=no'
	          + ',directories=no'
	          + ',status=no'
	          + ',menubar=no'
	          + ',dependent=yes'
	          + ',scrollbars=yes'
	          + ',resizable=yes'
	          + ',width=1375'
	          + ',height=900'
	          + ',top=75'
	          + ',left=100';	          
	
	var t = new Date();
	window.open("<%=request.getContextPath()%>/dashboard2/popupError.do"
						+ "?logTime=" + lPadTime(t.getHours()) + ":"
						+ lPadTime(t.getMinutes()) + "&domainType=" + svc
						+ "&commDiv=" + commDiv + "&errorType=" + type + "&cmd=new" , "rmsERROR", stats);
		t = null;
		stats = null;
// 		win = null;
}


function convertPeakDay() {
	
	if (peakStat == "tps") {
		$("#titPeak").text("Peak Day (TPS)");
		peakStat = "tran";
		peakDiv = "tps";
	} else {
		$("#titPeak").text("Peak Day (Count)");
		peakStat = "tps";
		peakDiv = "tran";
	}
	requestPeakInfo();
}


function rollingScore(objID, val, old) {
	var iter = 8;
	if( old == '' ) 	
		old = '0' ;
	
	var currentScore = toNumber(old);
	var maxScore     = toNumber(val);
	var step = Math.round((maxScore-currentScore)/iter);	
	
	setScore(currentScore, maxScore, iter, step, objID, false, null);
}


function rollingScoreArrow(objID, val, old, a) {
	
	var iter = 8;
	if( old == '' ) 
		old = '0' ;	
	
	if( a == '0') {
		old = old.replace('▲ ', '');
	} else {
		old = old.replace('↑ ', '');
	}

	var currentScore = toNumber( old );
	var maxScore     = toNumber( val );
	var step = Math.round((maxScore-currentScore)/iter);	
	
	setScore(currentScore, maxScore, iter, step, objID, true, a);
	
}


function setScore(currentScore, maxScore, iter, step, objID, arrow, a) {
		
	iter = 0;
	if(iter == 0) { 
		updateScoreObj( objID, maxScore, arrow, a);
// 		if(currentScore != maxScore) {
// 			updateScoreObj( objID, maxScore, arrow, a);
// 		}
		return;
	}

	if (currentScore >= maxScore) {
		updateScoreObj(objID, maxScore, arrow, a);
		return;
	}

	currentScore = Number(currentScore) + step;
	iter = iter - 1;
	window.setTimeout('setScore(' + currentScore + ',' + maxScore + ', ' + iter + ', ' + step + ', "' + objID + '", ' + arrow + ', ' + a + ')', 50);

	updateScoreObj(objID, currentScore, arrow, a);

// 	alert("currentScore ="+currentScore +"\nmaxScore ="+maxScore +"\niter ="+iter +"\nstep ="+step);	
// 	console.log("setScoreTest: old: " +  currentScore +" | curr: "+ maxScore +" | iter: "+ iter +" | step: "+ step +" | arrow | ");
}


function updateScoreObj(id, val, arrow, a) {
	if (arrow == true && val > 0) {
		if (a != null && a == '0') {
			document.getElementById(id).innerHTML = '▲ ' + commify(val);
		} else if (a != null && a == '1') {
			document.getElementById(id).innerHTML = '↑ ' + commify(val);
		}
	} else {
		document.getElementById(id).innerHTML = commify(val);
	}
}


function setArrowTextBody(obj, t) {
	if (t == null || t == '' || t == '0' || t.charAt(0) == '-') {
		obj.innerText = commify(t);
	} else {
		obj.innerText = '↑ ' + commify(t);
	}
}
</script>
</head>
<!--
****************************************************************************
* body 코드 start
****************************************************************************
-->
<body>

<!------------------------------ 숨김 GNB ------------------------------>
<div id="gnb_effect">
	<div id="gnb_content">
		<!-- 메뉴 -->
		<div id="gnb_container">
			<ul class="gnb_menu">
				<li><a href="#" id="gnb_tit1"><%= localeMessage.getString("dashMain.allMoni") %></a>
					<ul class="gnb_sub" id="gnb_sub1">
					<%
					for (DataSourceType d : srvList) { 
						if (d.getName() != null && !"".equals(d.getName())) { 
			 		%>
						<li><a href="javascript:goMainMenu('monitor','<%= d.getName() %>');"><%= d.getText() %></a></li>
					<%}} %>
					</ul></li>					
				<li><a href="#" id="gnb_tit2"><%= localeMessage.getString("dashMain.tranInfo") %></a>
					<ul class="gnb_sub" id="gnb_sub2">
					<%
					for (DataSourceType d : srvList) { 
						if (d.getName() != null && !"".equals(d.getName())) { 
			 		%>
						<li><a href="javascript:goMainMenu('transaction','<%= d.getName() %>');"><%= d.getText() %></a></li>
					<%}} %>
					</ul></li>
				<li><a href="#" id="gnb_tit3"><%= localeMessage.getString("dashMain.mngm") %></a>
					<ul class="gnb_sub" id="gnb_sub3">
					<%
					for (DataSourceType d : srvList) { 
						if (d.getName() != null && !"".equals(d.getName())) { 
			 		%>
						<li><a href="javascript:goMainMenu('status','<%= d.getName() %>');"><%= d.getText() %></a></li>
					<%}} %>
					</ul></li>
			</ul>
		</div>
		<!-- //메뉴 -->
	</div>
	<div id="gnb_button">button</div>
</div>
<!------------------------------ //숨김 GNB ------------------------------>

<!------------------------------ 로고 영역 start ------------------------------>
<header>
	<ul class="logo">
		<li>logo</li>
		<% 
		String envCd = SystemUtil.getSysOperEvirnDstcd();		
		if (envCd == "O") { %>
		<li><%= localeMessage.getString("dashMain.eaiPRDSys") %></li>
		<% } else if (envCd == "S") {%>
		<li><%= localeMessage.getString("dashMain.eaiStaSys") %></li>
		<% } else if (envCd == "D") {%>
		<li><%= localeMessage.getString("dashMain.eaiDevSys") %></li>
		<% } else { %>
		<li><%= localeMessage.getString("dashMain.eaiSysLoc") %></li>
		<% } %>
	</ul>
	<p class="time">2020.02.26(수) 15:19:59</p>
<!-- 	<div class="quickLink"> -->
<!-- 		<span>그룹회사코드</span> <select name=""> -->
<!-- 			<option value="ALL">전체</option> -->
<!-- 			<option value="KB0">은행</option> -->
<!-- 			<option value="KC0">카드</option> -->
<!-- 		</select> -->
<!-- 	</div> -->
	<ul class="topMenu">
		<li class="reLoad"   title="<%= localeMessage.getString("dashMain.initSmsDet") %>" onclick="javascript:clearSmsInfo();" onfocus="blur();">SMS초기화</li>
		<li class="soundOn"  title="<%= localeMessage.getString("dashMain.souOff") %>"      onclick="javascript:btnSound();"     onfocus="blur();" id="soundOption" >소리끄기</li> 
		<li class="popOff"   title="<%= localeMessage.getString("dashMain.allPopClo") %>"   onclick="javascript:btnPopupClose();" onfocus="blur();" >전체팝업닫기</li>
		<li class="popMax"   title="<%= localeMessage.getString("dashMain.popFuncOff") %>"   onclick="javascript:btnPopup();"      onfocus="blur();" id="popOption">팝업끄기</li>
	</ul>
</header>
<!-- top include Section end -->
<!------------------------------ 로고 영역 end ------------------------------>


<!------------------------------ 서버 영역 start ------------------------------>
<div class="moniwrap">
	<div class="moniMCI">
		<h1 class="titMoni">MCI</h1>
		<% for(int j = 1; j < 5; j++){ %>
		<div class="monitorOff" id="hostMCIDisplay<%=j%>">
		<button>Adapter<span>▼</span></button>
			<ul class="cpuMonitor">
				<li><p>CPU</p><span></span></li>
				<li><p>MEM</p><span></span></li>
				<li><p>DISK</p><span></span></li>
			</ul>
			<p class="monitorNone"><%= localeMessage.getString("dashMain.nA") %></p>
		</div>
		<%} %>
	</div>
	
	<div class="moniEAI">
		<h1 class="titMoni">EAI</h1>
		<% for(int j = 1; j < 5; j++){ %>
		<div class="monitorOff" id="hostEAIDisplay<%=j%>">
		<button>Adapter<span>▼</span></button>
			<ul class="cpuMonitor">
				<li><p>CPU</p><span></span></li>
				<li><p>MEM</p><span></span></li>
				<li><p>DISK</p><span></span></li>
			</ul>
			<p class="monitorNone"><%= localeMessage.getString("dashMain.nA") %></p>
		</div>
		<%} %>
	</div>

	<div class="moniFEP">
		<h1 class="titMoni">FEP</h1>
		<% for(int j = 1; j < 5; j++){ %>
		<div class="monitorOff" id="hostFEPDisplay<%=j%>">		
			<button>Adapter<span>▼</span></button>
			<ul class="cpuMonitor">
				<li><p>CPU</p><span></span></li>
				<li><p>MEM</p><span></span></li>
				<li><p>DISK</p><span></span></li>
			</ul>
			<p class="monitorNone"><%= localeMessage.getString("dashMain.nA") %></p>
		</div>
		<%} %>
	</div>

	<div class="moniOPA">
		<h1 class="titMoni">OPA</h1>
		<% for(int j = 1; j < 3; j++){ %>
		<div class="monitorOff" id="hostOPADisplay<%=j%>">
			<button>Adapter<span>▼</span></button>
			<ul class="cpuMonitor">
				<li><p>CPU</p><span></span></li>
				<li><p>MEM</p><span></span></li>
				<li><p>DISK</p><span></span></li>
			</ul>
			<p class="monitorNone"><%= localeMessage.getString("dashMain.nA") %></p>
		</div>
		<%} %>
	</div>
	
	<div class="moniBAT">
		<h1 class="titMoni"><%= localeMessage.getString("dashMain.bat") %></h1>		
		<% for(int j = 1; j < 3; j++){ %>
		<div class="monitorOff" id="hostBATDisplay<%=j%>">
			<button>Adapter<span>▼</span></button>
			<ul class="cpuMonitor">
				<li><p>CPU</p><span></span></li>
				<li><p>MEM</p><span></span></li>
				<li><p>DISK</p><span></span></li>
			</ul>
			<p class="monitorNone"><%= localeMessage.getString("dashMain.nA") %></p>
		</div>
		<%} %>
	</div>
	
	<div class="moniBAP">
		<h1 class="titMoni"><%= localeMessage.getString("dashMain.bap") %></h1>
		<% for(int j = 1; j < 3; j++){ %>
		<div class="monitorOff" id="hostBAPDisplay<%=j%>">
		<button>Adapter<span>▼</span></button>
			<ul class="cpuMonitor">
				<li><p>CPU</p><span></span></li>
				<li><p>MEM</p><span></span></li>
				<li><p>DISK</p><span></span></li>
			</ul>
			<p class="monitorNone"><%= localeMessage.getString("dashMain.nA") %></p>
		</div>
	<%} %>

	</div>
</div>
<!-- //moniwrap -->

<!-------------- 거래처리 집계현황 시작 -------------->
<div class="tradeTable" id="tradeTable">
	<h1 class="titTable" onclick="javascript:changeFullTrade()" style="cursor: pointer"><%= localeMessage.getString("dashMain.tranProgTotSta") %></h1>
	<table class="tradeGroup">
		<thead>
			<tr>
				<th><%= localeMessage.getString("dashMain.bizGrp") %></th>
				<th><%= localeMessage.getString("dashMain.tran") %></th>
				<th><%= localeMessage.getString("dashMain.tranInc") %></th>
				<th>TIMEOUT</th>
				<th><%= localeMessage.getString("dashMain.timeOutInc") %></th>
				<th><%= localeMessage.getString("dashMain.traErr") %></th>
				<th><%= localeMessage.getString("dashMain.traErrInc") %></th>
				<th><%= localeMessage.getString("dashMain.connErr") %></th>
				<th><%= localeMessage.getString("dashMain.connErrInc") %></th>
			</tr>
		</thead>
		<tbody>
			<%
			int j;
			if (srvCnt > 3) j = 3;
			else j = srvCnt;

			for (int i = 0; i < j; i++) {
				DataSourceType d = srvList.get(i);

				if (d.getName() != null && !"".equals(d.getName())) {
			%>
			<tr>
				<th><%=d.getText()%></th>
				<td id="tranTable<%=i + 1%>1" onclick="javascript:goMainMenu('transaction', '<%=d.getName()%>');"
					title="<%= localeMessage.getString("dashMain.tranSta") %>" style="cursor: pointer">0</td>
				<td id="tranTable<%=i + 1%>2">0</td>
				<td id="tranTable<%=i + 1%>3" onclick="javascript:popupError('<%=d.getName()%>','TIMEOUT',0);"
					title="<%= localeMessage.getString("dashMain.timOutMoniPop") %>" style="cursor: pointer">0</td>
				<td id="tranTable<%=i + 1%>4">0</td>
				<td id="tranTable<%=i + 1%>5" onclick="javascript:popupError('<%=d.getName()%>','ERROR',0);"
					title="<%= localeMessage.getString("dashMain.errMoniPop") %>" style="cursor: pointer">0</td>
				<td id="tranTable<%=i + 1%>6">0</td>
				<td id="tranTable<%=i + 1%>7" onclick="javascript:popupError('<%=d.getName()%>','CONNECTION',0);"
				    title="<%= localeMessage.getString("dashMain.connErrMoniPop") %>" style="cursor: pointer">0</td>
				<td id="tranTable<%=i + 1%>8">0</td>
			</tr>
			<%
				}
			}
			%>
		</tbody>
	</table>

	<table class="tradeGroup" style="float: right; margin-right: 14px;">
		<thead>
			<tr>
				<th><%= localeMessage.getString("dashMain.bizGrp") %></th>
				<th><%= localeMessage.getString("dashMain.tran") %></th>
				<th><%= localeMessage.getString("dashMain.tranInc") %></th>
				<th>TIMEOUT</th>
				<th><%= localeMessage.getString("dashMain.timeOutInc") %></th>
				<th><%= localeMessage.getString("dashMain.traErr") %></th>
				<th><%= localeMessage.getString("dashMain.traErrInc") %></th>
				<th><%= localeMessage.getString("dashMain.connErr") %></th>
				<th><%= localeMessage.getString("dashMain.connErrInc") %></th>
			</tr>
		</thead>
		<tbody>
			<%
			for (int i = j; i < srvCnt; i++) {
				DataSourceType d = srvList.get(i);

				if (d.getName() != null && !"".equals(d.getName())) {
			%>
			<tr>
				<th><%=d.getText()%></th>
				<td id="tranTable<%=i + 1%>1" onclick="javascript:goMainMenu('transaction', '<%=d.getName()%>');"
					title="거래현황" style="cursor: pointer">0</td>
				<td id="tranTable<%=i + 1%>2">0</td>
				<td id="tranTable<%=i + 1%>3" onclick="javascript:popupError('<%=d.getName()%>','TIMEOUT',0);"
					title="타임아웃화면 팝업" style="cursor: pointer">0</td>
				<td id="tranTable<%=i + 1%>4">0</td>
				<td id="tranTable<%=i + 1%>5" onclick="javascript:popupError('<%=d.getName()%>','ERROR',0);"
					title="에러화면 팝업" style="cursor: pointer">0</td>
				<td id="tranTable<%=i + 1%>6">0</td>
				<td id="tranTable<%=i + 1%>7" onclick="javascript:popupError('<%=d.getName()%>','CONNECTION',0);"
				    title="통신에러화면 팝업" style="cursor: pointer">0</td>
				<td id="tranTable<%=i + 1%>8">0</td>
			</tr>
			<%
				}
			}

			%>

			<tr class="total">
				<th><%= localeMessage.getString("dashMain.tot") %></th>
				<td style="width:160px"><span id="tranTotal1">0</span></td>
				<td><span id="tranTotal2">0</span></td>
				<td><span id="tranTotal3">0</span></td>
				<td><span id="tranTotal4">0</span></td>
				<td><span id="tranTotal5">0</span></td>
				<td><span id="tranTotal6">0</span></td>
				<td><span id="tranTotal7">0</span></td>
				<td><span id="tranTotal8">0</span></td>
			</tr>
		</tbody>
	</table>
	<table class="tradeGroup" style="height:40px"></table>

	<table class="allTrans">
		<tr>
			<th><%= localeMessage.getString("dashMain.bap") %></th>
			<td><p><%= localeMessage.getString("dashMain.norSend") %></p> <span id="tranTable71">0</span></td>
			<td><p><%= localeMessage.getString("dashMain.norRecv") %></p> <span id="tranTable72">0</span></td>
			<td onclick="javascript:goMainMenu('senderr', 'BAP');" style="cursor:pointer"><p><%= localeMessage.getString("dashMain.errSend") %></p> <span id="tranTable73">0</span></td>
			<td onclick="javascript:goMainMenu('recverr', 'BAP');" style="cursor:pointer"><p><%= localeMessage.getString("dashMain.errRecv") %></p> <span id="tranTable74">0</span></td>
			<td onclick="javascript:goMainMenu('sendwait', 'BAP');" style="cursor:pointer"><p><%= localeMessage.getString("dashMain.waitSend") %></p> <span id="tranTable75">0</span></td>
			<td onclick="javascript:goMainMenu('recvwait', 'BAP');" style="cursor:pointer"><p><%= localeMessage.getString("dashMain.waitRecv") %></p> <span id="tranTable76">0</span></td>
		</tr>
	</table>
	<table class="allTrans" style="float: right; margin-right: 14px;">
		<tr>
			<th><%= localeMessage.getString("dashMain.bat") %></th>
			<td><p><%= localeMessage.getString("dashMain.norSend") %></p> <span id="tranTable81">0</span></td>
			<td><p><%= localeMessage.getString("dashMain.norRecv") %></p> <span id="tranTable82">0</span></td>
			<td><p><%= localeMessage.getString("dashMain.errSend") %></p> <span id="tranTable83">0</span></td>
			<td><p><%= localeMessage.getString("dashMain.errRecv") %></p> <span id="tranTable84">0</span></td>
			<td><p><%= localeMessage.getString("dashMain.waitSend") %></p> <span id="tranTable85">0</span></td>
			<td><p><%= localeMessage.getString("dashMain.waitRecv") %></p> <span id="tranTable86">0</span></td>
		</tr>
	</table>

</div>
<!-- //tradeTable -->


<!-- tradeTableBig -->
<div class="tradeTableBig">
	<h1 class="titTableBig" onclick="javascript:changeFullTrade()" style="cursor:pointer">거래처리 집계현황</h1>
	 <table class="tradeGroupBig">
	   <thead>
		   <tr>
		     <th>업무그룹</th>
		     <th>거래처리</th>
		     <th>거래처리증가</th>
		     <th>TIMEOUT</th>
		     <th>TIMEOUT증가</th>
		     <th>업무에러</th>
		     <th>업무에러증가</th>
		     <th>통신에러</th>
		     <th>통신에러증가</th>
		   </tr>
		 </thead>
		 <tbody>
<%
	for (int i = 0; i < srvCnt; i++) {
	DataSourceType d = srvList.get(i);

		if (d.getName() != null && !"".equals(d.getName())) {

%>
			 <tr>
			   <th><%=d.getText()%></th>
		       <td onclick="javascript:goMainMenu('transaction', '<%=d.getName()%>');" title="내부 거래현황" style="cursor:pointer"><span id="tranTableBig<%=i + 1%>1">0</span></td>
			   <td><span id="tranTableBig<%=i + 1%>2">0</span></td>
			   <td onclick="javascript:popupError('<%=d.getName()%>','TIMEOUT',0);" title="타임아웃화면 팝업" style="cursor:pointer"><span id="tranTableBig<%=i + 1%>3">0</span></td>
			   <td><span id="tranTableBig<%=i + 1%>4">0</span></td>
			   <td onclick="javascript:popupError('<%=d.getName()%>','ERROR',0);" title="에러화면 팝업" style="cursor:pointer"><span id="tranTableBig<%=i + 1%>5">0</span></td>
			   <td><span id="tranTableBig<%=i + 1%>6">0</span></td>
			   <td onclick="javascript:popupError('<%=d.getName()%>','CONNECTION',0);" title="통신에러화면 팝업" style="cursor:pointer"><span id="tranTableBig<%=i + 1%>7">0</span></td>
			   <td><span id="tranTableBig<%=i + 1%>8">0</span></td>
			 </tr>
<%
		}
	}
		
%>
     <tr class="total">
			 <th>합계</th>
			 <td><span id="tranTotalBig1">0</span></td>
			 <td><span id="tranTotalBig2">0</span></td>
			 <td><span id="tranTotalBig3">0</span></td>
			 <td><span id="tranTotalBig4">0</span></td>
			 <td><span id="tranTotalBig5">0</span></td>
			 <td><span id="tranTotalBig6">0</span></td>
			 <td><span id="tranTotalBig7">0</span></td>
			 <td><span id="tranTotalBig8">0</span></td>		
		    </tr>
	    </tbody>
	  </table>

	 <table class="allTransBig">	
	   <tr>
	     <th>일괄전송</th>
	     <td><p>정상송신</p><span id="tranTableBig71">0</span></td>
	     <td><p>정상수신</p><span id="tranTableBig72">0</span></td>
	     <td onclick="javascript:goMainMenu('senderr', 'ISG');" style="cursor:pointer"><p>에러송신</p><span id="tranTableBig73">0</span></td>
	     <td onclick="javascript:goMainMenu('recverr', 'ISG');" style="cursor:pointer"><p>에러수신</p><span id="tranTableBig74">0</span></td>
	     <td onclick="javascript:goMainMenu('sendwait', 'ISG');" style="cursor:pointer"><p>대기송신</p><span id="tranTableBig75">0</span></td>
	     <td onclick="javascript:goMainMenu('recvwait', 'ISG');" style="cursor:pointer"><p>대기수신</p><span id="tranTableBig76">0</span></td>	
	   </tr>
	   <tr>
	     <th>배치</th>
	     <td><p>정상송신</p><span id="tranTableBig81">0</span></td>
	     <td><p>정상수신</p><span id="tranTableBig82">0</span></td>
	     <td><p>에러송신</p><span id="tranTableBig83">0</span></td>
	     <td><p>에러수신</p><span id="tranTableBig84">0</span></td>
	     <td><p>대기송신</p><span id="tranTableBig85">0</span></td>
	     <td><p>대기수신</p><span id="tranTableBig86">0</span></td>	
	   </tr>
	 </table>
</div>
<!-------------- 거래처리 집계현황 끝 -------------->

<section>
	<!-------------- 장애통보현황 시작 -------------->
	<div class="smsTable" id="smsTable">
		<h1 class="titTable"><%= localeMessage.getString("dashMain.errNotiSta") %></h1>
		<table class="tradeGroup">
			<thead>
				<tr>
					<th><%= localeMessage.getString("dashMain.bizGrp") %></th>
					<th><%= localeMessage.getString("dashMain.inst") %></th>
					<th><%= localeMessage.getString("dashMain.time") %></th>
					<th><%= localeMessage.getString("dashMain.mess") %></th>
				</tr>
			</thead>
			<tbody>
				<%
// 					for (int i = 1; i <= 6; i++) {
					for (int i = 0; i < srvCnt+2; i++) {						
				%>
				<tr <%=i % 2 == 0 ? "class=\"second\"" : ""%>>
					<th><span id="smsTable<%=i%>1"></span></th>
					<td><span id="smsTable<%=i%>2"></span></td>
					<td><span id="smsTable<%=i%>3"></span></td>
					<td><span id="smsTable<%=i%>4"></span></td>
				</tr>
				<%
					}
				%>
			</tbody>
		</table>
	</div>
	<!-------------- 장애통보현황 끝 -------------->

	<!---------- Peak Day ---------->
	<div id="peakTable" class="peakTable">
		<h1 class="titTable" id="titPeak"
			onclick="javascript:convertPeakDay();">Peak Day (TPS)</h1>
		<table class="tradeGroup">
			<thead>
				<tr>
					<th><%= localeMessage.getString("dashMain.bizGrp") %></th>
					<th style="width: 170px"><%= localeMessage.getString("dashMain.date") %></th>
					<th style="width: 170px"><%= localeMessage.getString("dashMain.proUni") %></th>
					<th style="width: 170px">TPS</th>
				</tr>
			</thead>
			<tbody>
				<%
				for (int i = 0; i < srvCnt; i++) {
					DataSourceType d = srvList.get(i);
					if (d.getName() != null && !"".equals(d.getName())) {
				%>
				<tr>
					<th><%=d.getText()%></th>
					<td align="center" ><span id="peakTable<%=d.getName()%>1"></span></td>
					<!-- 일자 -->
					<td style="text-align: right; padding-right: 10px;"><span id="peakTable<%=d.getName()%>2"></span></td>
					<!-- 처리건수 -->
					<td style="text-align: right; padding-right: 10px;"><span id="peakTable<%=d.getName()%>3"></span></td>
					<!-- TPS -->
				</tr>
				<%
					}
				}
				%>
				<tr>
					<th><%= localeMessage.getString("dashMain.bap") %></th>
					<td align="center"><span id="peakTableBAP1"></span></td>
					<td style="text-align: right; padding-right: 10px;"><span id="peakTableBAP2"></span></td>
					<td style="text-align: right; padding-right: 10px;"><span id="peakTableBAP3"></span></td>
				</tr>
				<tr>
					<th><%= localeMessage.getString("dashMain.bat") %></th>
					<td align="center"><span id="peakTableBAT1"></span></td>
					<td style="text-align: right; padding-right: 10px;"><span id="peakTableBAT2"></span></td>
					<td style="text-align: right; padding-right: 10px;"><span id="peakTableBAT3"></span></td>
				</tr>
			</tbody>
		</table>
	</div>
	<!---------- Peak Day 끝 ---------->
</section>


	<!------------------------------ 중간 영역 end ------------------------------>

	<!------------------------------ 하단 영역 start ------------------------------>
	<!-- btm include Section Start -->
	<!-- btm include Section end-->
	<!------------------------------ 하단 영역 end ------------------------------>

	<!-- 팝업  시작 **************************** -->

	<%-- 	<div id="obstaclePopup<%=i+1%>1" style="display: none ; width: 150px; height: 60px; top: <%=top+140%>px; left: <%=left+140%>px; position: absolute; z-index: 700; visibility: visible;"> --%>
	<div id="obstacleMCI1" style="display: none; position: absolute; top: 55px; left: 20px; z-index: 700; visibility: visible;"></div>
	<div id="obstacleMCI2" style="display: none; position: absolute; top: 55px; left: 315px; z-index: 700; visibility: visible;"></div>
	<div id="obstacleMCI3" style="display: none; position: absolute; top: 275px; left: 20px; z-index: 700; visibility: visible;"></div>
	<div id="obstacleMCI4" style="display: none; position: absolute; top: 275px; left: 315px; z-index: 700; visibility: visible;"></div>

	<div id="obstacleEAI1" style="display: none; position: absolute; top: 55px; left: 645px; z-index: 700; visibility: visible;"></div>
	<div id="obstacleEAI2" style="display: none; position: absolute; top: 55px; left: 940px; z-index: 700; visibility: visible;"></div>
	<div id="obstacleEAI3" style="display: none; position: absolute; top: 275px; left: 645px; z-index: 700; visibility: visible;"></div>
	<div id="obstacleEAI4" style="display: none; position: absolute; top: 275px; left: 940px; z-index: 700; visibility: visible;"></div>

	<div id="obstacleFEP1" style="display: none; position: absolute; top: 55px; left: 1250px; z-index: 700; visibility: visible;"></div>
	<div id="obstacleFEP2" style="display: none; position: absolute; top: 55px; left: 1550px; z-index: 700; visibility: visible;"></div>
	<div id="obstacleFEP3" style="display: none; position: absolute; top: 275px; left: 1250px; z-index: 700; visibility: visible;"></div>
	<div id="obstacleFEP4" style="display: none; position: absolute; top: 275px; left: 1550px; z-index: 700; visibility: visible;"></div>

	<div id="obstacleOPA1" style="display: none; position: absolute; top: 410px; left: 20px; z-index: 700; visibility: visible;"></div>
	<div id="obstacleOPA2" style="display: none; position: absolute; top: 410px; left: 315px; z-index: 700; visibility: visible;"></div>

	<div id="obstacleBAT1" style="display: none; position: absolute; top: 410px; left: 645px; z-index: 700; visibility: visible;"></div>
	<div id="obstacleBAT2" style="display: none; position: absolute; top: 410px; left: 940px; z-index: 700; visibility: visible;"></div>

	<div id="obstacleBAP1" style="display: none; position: absolute; top: 410px; left: 1250px; z-index: 700; visibility: visible;"></div>
	<div id="obstacleBAP2" style="display: none; position: absolute; top: 410px; left: 1550px; z-index: 700; visibility: visible;"></div>

	<!-- 팝업 끝 **************************** -->

<script type="text/javascript">
	$(document).ready(function() {	
		
		$("#gnb_button").click(function() {
			$("#gnb_effect").toggleClass("down");
		});
		
		
		$(".tradeTableBig").hide();
		
	});

	$("#gnb_tit1").hover(function() {
		$("#gnb_sub2").css({ "display" : "none" });
		$("#gnb_sub3").css({ "display" : "none" });
		$("#gnb_sub1").css({ "display" : "block", "z-index" : "999999" });
		$(this).css({ "color" : "#3afdff" });
		$("#gnb_tit2").css({ "color" : "#fff" });
		$("#gnb_tit3").css({ "color" : "#fff" });
	});

	$("#gnb_tit2").hover(function() {
		$("#gnb_sub1").css({ "display" : "none" });
		$("#gnb_sub3").css({ "display" : "none" });
		$("#gnb_sub2").css({ "display" : "block", "z-index" : "999999" });
		$(this).css({ "color" : "#3afdff" });
		$("#gnb_tit1").css({ "color" : "#fff" });
		$("#gnb_tit3").css({ "color" : "#fff" });
	});

	$("#gnb_tit3").hover(function() {
		$("#gnb_sub1").css({ "display" : "none" });
		$("#gnb_sub2").css({ "display" : "none" });
		$("#gnb_sub3").css({ "display" : "block", "z-index" : "999999" });
		$(this).css({ "color" : "#3afdff" });
		$("#gnb_tit1").css({ "color" : "#fff" });
		$("#gnb_tit2").css({ "color" : "#fff" });
	});

	reqAjaxMap.set("BAP", createAjaxRequest()); //일괄전송 추가
	reqAjaxMap.set("BAT", createAjaxRequest()); //배치 추가
	reqAjaxMap.set("Tran", createAjaxRequest());
	reqAjaxMap.set("Peak", createAjaxRequest());
	reqAjaxMap.set("Sms", createAjaxRequest());
	reqAjaxMap.set("SmsInit", createAjaxRequest());
	reqAjaxMap.set("BaseInfo", createAjaxRequest());

	for (var i = 0; i < srvCnt; i++) { // MCI, MCU, EAI, FEP, OPA
		reqAjaxMap.set(srvList[i].get("name"), createAjaxRequest());
	}
	
	setTimeout("requestBaseInfo();", 1000);
	setInterval("setTopTime();", 2000);
	setInterval("checkConnection();", 5000);

	// peakTable 보이지 않는 현상때문에 임시조치함
	// 	isFullTrade = true;
	// 	changeFullTrade();
	//	showAlarmMsg(11,true,'ASG 1 번 서버','1번 인스턴스 에러!<BR>2번 인스턴스 에러!<BR>3번 인스턴스 에러!<BR>4번 인스턴스 에러!');
</script>

<!--
****************************************************************************
* body 코드 end
****************************************************************************
-->
</body>
<embed src="<%=request.getContextPath()%>/common/sound/alert2.wav" name="player" hidden="true" autostart="false" width="1" height="1" />

</html>