var loginUrl = "https://cyber.kepco.co.kr/ckepco/front/jsp"; var cyberUrl = "https://cyber.kepco.co.kr/ckepco"; var kepcoUrl = "https://home.kepco.co.kr/kepco"; var httpUrl = "https://cyber.kepco.co.kr"; var docuUrl = "kepco.co.kr"; //if (document.domain.toString().indexOf(docuUrl) != -1) document.domain=docuUrl; var fncPrint = function(menuCd){ window.open("/kepco/cmmn/print.do?menuCd="+menuCd, "printWindow", "status=no,toolbar=no,resizable=no,menubar=no,location=yes, width=760, height=800, scrollbars=yes"); }; var fncFrontEmail = function(menuCd){ window.open("/kepco/cmmn/email.po?menuCd="+menuCd, "emailWindow", "status=no,toolbar=no,resizable=no,menubar=no,location=yes, width=500, height=633, scrollbars=no"); }; var fncLogin = function(strScript, loginType){ if(loginType == ""){ loginType = "1"; } if(isLogin == "N" && loginType == "1"){ $("#frmLoginDefault").attr({"action": loginUrl + "/ME/C/A/MECALP001.jsp", "method": "get"}); $("#inpFrmLoginType").val(loginType); $("#frmLoginDefault").submit(); }else if(isLogin == "N" && isAuthCert == "N" && loginType == "2"){ $("#frmLoginDefault").attr({"action": loginUrl + "/ME/C/A/MECALP001.jsp", "method": "get"}); $("#inpFrmLoginType").val(loginType); $("#frmLoginDefault").submit(); }else{ if(strScript.length > 0){ eval(strScript); } } }; function loadCookie(name){ var cname = name + "="; var dc = document.cookie; var val = ""; if (dc.length > 0) { begin = dc.indexOf(cname); if (begin != -1) { begin += cname.length; end = dc.indexOf(";", begin); if (end == -1) end = dc.length; val += unescape(dc.substring(begin, end)); } } return val; } //sns 스크랩 var goSnsScrap = function (media, title, urlPathLong) { var urlPathLong = urlPathLong.replace("http://localhost", httpUrl); var defaults = { version: '2.0.1', login: 'iamkepco', apiKey: 'R_4bf0a342507f42d2252e47ec76a9b721', history: '0', longUrl: urlPathLong }; var message = "[한국전력] "+title; var message2 = "한국전력공사(KEPCO)"; var urlPath = ""; var daurl = "http://api.bit.ly/shorten?" +"version="+defaults.version +"&longUrl="+escape(defaults.longUrl) +"&login="+defaults.login +"&apiKey="+defaults.apiKey +"&history="+defaults.history +"&format=json&callback=?"; $.getJSON(daurl, function(data){ urlPath = data.results[defaults.longUrl].shortUrl; switch(media){ case "F": sendUrl = "http://www.facebook.com/sharer.php?s=100&p[title]="+encodeURIComponent(message)+"&p[url]="+encodeURIComponent(urlPath)+"&p[summary]="+encodeURIComponent(message2); openSnsWin(sendUrl); break; case "T": sendUrl = "http://twitter.com/home?status="+encodeURIComponent(message)+"+"+escape(urlPath); openSnsWin(sendUrl); break; case "M": sendUrl = 'http://me2day.net/posts/new?new_post[body]=\"'+encodeURIComponent(message)+'\":'+escape(urlPath)+'&new+post[tags]=한전'; openSnsWin(sendUrl); break; case "naver": sendUrl = "http://bookmark.naver.com/post?ns=1&title="+encodeURIComponent(message)+"&url="+escape(urlPath); openSnsWin(sendUrl); break; case "google": sendUrl = "http://www.google.com/bookmarks/mark?op=add&title="+encodeURIComponent(message)+"&bkmk="+escape(urlPath); openSnsWin(sendUrl); break; case "yozm": sendUrl = "http://yozm.daum.net/api/popup/prePost?link="+encodeURIComponent(urlPath)+"&prefix="+encodeURIComponent(message)+"¶meter=한전"; var win = window.open(sendUrl,'yozmSend', 'width=466, height=356'); if (win){ win.focus(); } break; } }); }; var goSnsScrap2 = function (media, title, url2) { url = httpUrl+url2; var defaults = { version: '2.0.1', login: 'iamkepco', apiKey: 'R_4bf0a342507f42d2252e47ec76a9b721', history: '0', longUrl: url }; var message = "[한국전력] "+title; var message2 = "한국전력공사(KEPCO)"; var urlPath = ""; var daurl = "http://api.bit.ly/shorten?" +"version="+defaults.version +"&longUrl="+escape(defaults.longUrl) +"&login="+defaults.login +"&apiKey="+defaults.apiKey +"&history="+defaults.history +"&format=json&callback=?"; $.getJSON(daurl, function(data){ urlPath = data.results[defaults.longUrl].shortUrl; switch(media){ case "F": sendUrl = "http://www.facebook.com/sharer.php?s=100&p[title]="+encodeURIComponent(message)+"&p[url]="+encodeURIComponent(urlPath)+"&p[summary]="+encodeURIComponent(message2); openSnsWin(sendUrl); break; case "T": sendUrl = "http://twitter.com/home?status="+encodeURIComponent(message)+"+"+escape(urlPath); openSnsWin(sendUrl); break; case "M": sendUrl = 'http://me2day.net/posts/new?new_post[body]=\"'+encodeURIComponent(message)+'\":'+escape(urlPath)+'&new+post[tags]=한전'; openSnsWin(sendUrl); break; case "naver": sendUrl = "http://bookmark.naver.com/post?ns=1&title="+encodeURIComponent(message)+"&url="+escape(urlPath); openSnsWin(sendUrl); break; case "google": sendUrl = "http://www.google.com/bookmarks/mark?op=add&title="+encodeURIComponent(message)+"&bkmk="+escape(urlPath); openSnsWin(sendUrl); break; case "yozm": sendUrl = "http://yozm.daum.net/api/popup/prePost?link="+encodeURIComponent(urlPath)+"&prefix="+encodeURIComponent(message)+"¶meter=한전"; var win = window.open(sendUrl,'yozmSend', 'width=466, height=356'); if (win){ win.focus(); } break; } }); }; var openSnsWin = function(openUrl){ var winObj; winObj = window.open(openUrl, "sendSnsWin", "status=no,toolbar=no,resizable=no,menubar=no,location=yes, width=1024, height=800, scrollbars=yes"); winObj.focus(); }; function setCookie( name, value, expiredays ){ var todayDate = new Date(); todayDate.setDate( todayDate.getDate() + expiredays ); document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"; } var fncGoSite = function(strUrl){ if(strUrl != ""){ window.open(strUrl); } }; var fncGoHomepageResearch = function() { window.open("/kepco/CU/E/B/CUEBPP00102.po", "","width=800, height=640, scrollbars=yes"); }; /*var fncFileExtCheck = function(varType){ var extList = null; var fType = "ppt, xls, doc, hwp, pdf, zip, jpg, png, bmp, gif"; if(varType == "image"){ extList = new Array("jpg", "gif", "png", "bmp"); fType = "jpg, png, bmp, gif"; }else if(varType == "document"){ extList = new Array("doc", "docx", "xls", "xlsx", "ppt", "pptx", "jpg", "gif", "png", "bmp", "pdf", "hwp", "zip"); }else{ extList = new Array("doc", "docx", "xls", "xlsx", "ppt", "pptx", "jpg", "gif", "png", "bmp", "pdf", "hwp", "zip"); } $("input[type=file]").each(function(index, element) { var sFilePath = $(this).val(); if(sFilePath != ""){ var file = sFilePath.substring(sFilePath.lastIndexOf('\\')+1, sFilePath.length); if(file.indexOf('.')>=0) { exp = file.substring(file.lastIndexOf('.')+1,file.length).toLowerCase(); if($.inArray(exp, extList) > -1){ return true; }else{ alert(exp+" 확장자 파일은 허용되지 않습니다. \n\n "+fType+" \n\n 파일만 업로드할 수 있습니다."); return false; } } } }); };*/ var fncFileExtCheck = function(varType){ var Format= "\.(ppt|pptx|xls|xlsx|doc|docx|hwp|pdf|zip|gif|jpg|jpeg|png)$"; var fType = "ppt, xls, doc, hwp, pdf, zip, gif, jpg, jpeg, png"; if(varType == "image"){ Format= "\.(gif|jpg|jpeg|png)$"; fType = "gif, jpg, jpeg, png"; } var cnt = 0; for(var i = 0; i < $("#frmDefault input[type=file]").length; i++){ if($("#frmDefault input[type=file]").eq(i).val() != ""){ if(!(new RegExp(Format, "i")).test($("#frmDefault input[type=file]").eq(i).val())){ cnt = cnt + 1; } } } if(cnt != 0){ alert("유효하지 않은 첨부파일이 "+cnt+"개 있습니다.\n\n "+fType+" \n\n 파일만 업로드 가능합니다."); return false; }else{ return true; } }; //숫자 콤마 마이너스만 (onkeydown="check_number()") function check_number(){ if((event.keyCode != 8 && event.keyCode != 9 && event.keyCode != 37 && event.keyCode != 39 && event.keyCode != 188 && event.keyCode != 189) && (event.keyCode < 48 || event.keyCode > 57) && (event.keyCode < 96 || event.keyCode > 105)){ event.returnValue=false; } } //숫자만 입력(소수점 허용) (onkeyup="check_numDicimal(this)") var check_numDicimal = function(obj){ var num = Number(obj.value); if(isNaN(num)){ alert("숫자만 입력가능합니다."); obj.value = ""; } }; $(document).ready(function(){ //class="noime" 한글빼고 모두 $("input.noime").css("ime-mode", "disabled"); //숫자만 입력 (class="num_only") $('.num_only').css('imeMode','disabled').keypress(function(event) { if(event.which && (event.which < 48 || event.which > 57) ) { event.preventDefault(); } }).keyup(function(){ if( $(this).val() != null && $(this).val() != '' ) { $(this).val( $(this).val().replace(/[^0-9]/g, '') ); } }); }); //숫자만 입력+숫자 입력시 3자리마다 콤마 찍어주기 (class="comma_won") $(document).ready(function() { $('.comma_won').css('imeMode','disabled').keypress(function(event) { if(event.which && (event.which < 48 || event.which > 57) ) { event.preventDefault(); } }).keyup(function(){ if( $(this).val() != null && $(this).val() != '' ) { $(this).val( $(this).val().replace(/[^0-9]/g, '') ); $(this).val( setComma($(this).val() ) ); } }); //스킵메뉴 포커스 - 150413민승우 추가 if($("#container").children("div").is( "#lnb")){//lnb가 없을경우 스킵네비게이션에서 lnb >>dislpay:none처리 //alert("aa"); }else{ $(".skipMenu > a").each(function(){ if($(this).attr("href") == "#lnb"){ $(this).remove(); } }); } $(".skipMenu > a").on("click",function(event){ var skipM = $(this).attr("href"); if($("#container").children().attr("id") == "lnb"){//컨테이너에 lnb가 있을경우 컨테이너 클릭시 컨텐츠로 이동 $("#content").attr("tabindex","0").focus(); }else{ $(skipM).attr("tabindex","0").focus(); } return false; }); }); //이메일 onKeyup="checkExTest(this);" function checkExTest(obj){ for(var i=0; i0; i--){ if(num.substring(i,i-1) != ","){ val = num.substring(i, i-1) + val; } } x = val.length; for(var i=x; i>0; i--){ if(j%3 == 0 && j!=0){ rtn = val.substring(i,i-1)+","+rtn; }else{ rtn = val.substring(i,i-1)+rtn; } j++; } return rtn; } var g1; /** 상세보기 클릭 이벤트 */ var fncMainGraph = function () { var divnColor = ""; var divnText = ""; $("#g1").html(""); $.getJSON("/kepco/main/getGraph.json", {}, function (returnJson) { var objData = returnJson.mainVO; if(objData.reserveValue >= 500){ divnColor = "00aaf9"; divnText = "정상"; }else if(objData.reserveValue >= 400 && objData.reserveValue < 500){ divnColor = "60a969"; divnText = "준비"; }else if(objData.reserveValue >= 300 && objData.reserveValue < 400){ divnColor = "00c9e3"; divnText = "관심"; }else if(objData.reserveValue >= 200 && objData.reserveValue < 300){ divnColor = "ffc016"; divnText = "주의"; }else if(objData.reserveValue >= 100 && objData.reserveValue < 200){ divnColor = "ff7200"; divnText = "경계"; }else if(objData.reserveValue >= 0 && objData.reserveValue < 100){ divnColor = "ff3d33"; divnText = "심각"; } var g1 = new JustGage({ id: "g1", value: eval(objData.reserveValue), min: 0, max: 1000, title: divnText, label: "", levelColors: ["#"+divnColor] }); $("#currentStatus").removeClass("col_00aaf9"); $("#currentStatus").removeClass("col_60a969"); $("#currentStatus").removeClass("col_00c9e3"); $("#currentStatus").removeClass("col_ffc016"); $("#currentStatus").removeClass("col_ff7200"); $("#currentStatus").removeClass("col_ff3d33"); $("#currentStatus").addClass("col_"+divnColor); $("#currentValue").text(setComma(objData.currentValue)+" 만 kW"); $("#totalValue").text(setComma(objData.totalValue)+" 만 kW"); $("#reserveValue").text(setComma(objData.reserveValue)+" 만 kW"); $("#reservePercent").text(objData.reservePercent+" %"); $("#frequencyVal").text(objData.frequencyVal); $("#currentDate").text(objData.currentDate); }); }; var fncElecMoney = function() { window.open('/kepco/KO/G/htmlView/KOGAHP003.po', '', 'width=935, height=610'); }; var fncDictionary = function() { window.open('/kepco/KO/E/A/KOEAPP001.po', '', 'width=975, height=569'); }; var autoLogout = function(){ setPopAutoLogout('autologout.html'); }; var secVal = 60; var fncCountSec = function(){ secVal = secVal - 1; $("#countSec").text(secVal+"초"); if(secVal == 0){ fncGoLogout(); } }; function fncClearCountSec() { clearInterval(autoLogout); } var fncGoLogout = function(){ location.href="/kepco/cmmn/logout.do"; }; var fncLoginDelay = function(){ fncClearCountSec(); defaultFrame.location.href=cyberUrl+"/front/jsp/ME/A/A/loginDelay.jsp?returnUrl="+kepcoUrl+"/cmmn/loginDelay.do"; }; var fncAutoLogoutClose = function(){ $(".overlay_autologout").hide(); $(".content_autologout").hide(); setTimeout('autoLogout()', 520*1000); };