//####################################################### // 프로그램 명 : 자바스크립트 유틸리티 //####################################################### var MB_OK = 0x00000000; var MB_OKCANCEL = 0x00000001; var MB_ABORTRETRYIGNORE = 0x00000002; var MB_YESNOCANCEL = 0x00000003; var MB_YESNO = 0x00000004; var MB_RETRYCANCEL = 0x00000005; var MB_ICONHAND = 0x00000010; var MB_ICONQUESTION = 0x00000020; var MB_ICONEXCLAMATION = 0x00000030; var MB_ICONASTERISK = 0x00000040; var MB_USERICON = 0x00000080; var MB_ICONWARNING = 0x00000030; var MB_ICONERROR = 0x00000010; var MB_ICONINFORMATION = 0x00000040; var MB_ICONSTOP = 0x00000010; // 서브릿 초기화 실행 function initServlet(oIframe) { oIframe.location.href = "/servlet/InitServlet"; } // ############### 문자열 내의 모든 공백 문자 존재 여부 확인 ########### function IsIncludeSpace(data){ var lszTrim = data; var j = 0; for(var i = 0; i < data.length; i++) { if(data.substring(i, i+1) == ' ') return true; } return false; } // 빈 문자열인지 검사 (빈칸만 포함하는 문자열도 빈 문자열로 간주) function IsEmpty(data) { var length = 0; var trimdata = TrimAll(data); if(trimdata.length == 0) return true; else return false; } // 빈 문자열인지 검사하여 빈 문자열일 경우 메세지(failMessage) 출력 function checkEmpty(data, msg) { if(IsEmpty(data)) { alert(msg); return false; } else return true; } // RADIO 버튼이 선택되었는지 검사하여 선택되지 않았으면... 메시지(failMessage) 출력 function checkRadio(obj, msg) { try { var check = false; if (obj.length) { for (i=0; i 255) { return false; } } } return true; } // ######################## 날짜인지 검사 ######################## function IsDate(str, format){ var szFormat = format; if(mtrim(str).length < szFormat.length) return false; var cCurr = ''; var arrDelim = new Array(); var arrDateFormat = new Array(); var nPartIndex = -1; var nDelimPartIndex = -1; var cLastChar = ''; for(nIndex = 0; nIndex < szFormat.length; nIndex++) { cCurr = szFormat.charAt(nIndex); // 이전 문자와 같은 문자가 아닌 경우 if(cCurr != cLastChar) { // 날짜 구분자인 경우 if(cCurr != 'Y' && cCurr != 'M' && cCurr != 'D') { nDelimPartIndex++; arrDelim[nPartIndex] = new Object(); arrDelim[nDelimPartIndex].nStartIndex = nIndex; arrDelim[nDelimPartIndex].cDelimChar = szFormat.charAt(nIndex); // 날짜 형식 문자인 경우 } else { nPartIndex++; arrDateFormat[nPartIndex] = new Object(); arrDateFormat[nPartIndex].nStartIndex = nIndex; arrDateFormat[nPartIndex].nCount = 1; } cLastChar = szFormat.charAt(nIndex); } // 이전 문자와 같은 문자인 경우 else { arrDateFormat[nPartIndex].nCount++; } } // 날짜 검사 for(nIndex = 0; nIndex < arrDateFormat.length; nIndex++) { if(IsNumber( str.substring( arrDateFormat[nIndex].nStartIndex , arrDateFormat[nIndex].nStartIndex + arrDateFormat[nIndex].nCount)) == false) { return false; } } // 구분자 검사 for(nIndex = 0; nIndex < arrDelim.length; nIndex++) { if(str.charAt(arrDelim[nIndex].nStartIndex) != arrDelim[nIndex].cDelimChar) { return false; } } return true; } // ######################## 시간인지 검사 ######################## function IsHour(hour, msg) { if (hour == "" || (hour > -1 && hour <= 24)) return true; else { alert (msg); return false; } } // ######################## 분인지 검사 ######################## function IsMinute(minute, msg) { if (minute == "" || (minute > -1 && minute <= 59)) return true; else { return false; alert (msg); } } //######################## 숫자인지 검사 ######################## //ime-mode:disabled function keyPressOnlyNumber(){ if((event.keyCode<48)||(event.keyCode>57)){ event.returnValue=false; } } // ######################## 숫자인지 검사 ######################## function IsNumber(str){ var Number = '1234567890'; var kiki = Number; var i; for (i=0; i 255) { ByteLength += 2; } else{ ByteLength++; } } if(ByteLength>len){ alert(inputName + ' '+ len + 'Byte를 넘습니다. 현재' + ByteLength + 'Byte 입니다.'); obj.focus(); return false; } return true; } function diplayByte(obj,len,dispName){ var ThisString = obj.value; var ByteLength = 0; for(var i=0;i < ThisString.length; i++){ if(ThisString.charCodeAt(i) > 255) { ByteLength += 3; } else{ ByteLength++; } } var div = document.getElementById(dispName) ; if ( ByteLength > len ) { div.innerHTML = "[ " + ByteLength + " / " + len + " bytes ]" ; } else { div.innerHTML = "[ " + ByteLength + " / " + len + " bytes ]" ; } } function checkDefaultInput(obj,len,inputName,emptyMsg){ //업체명 Null체크 if(IsEmpty(obj.value)){ alert(emptyMsg); obj.focus(); return false; } //업체명 바이트 체크 if(!checkByte(obj,len,inputName)){ obj.focus(); return false; } return true; } // ############### 전화번호 형식 체크 ###### function chkPatten(val,patten) { var regPhone =/^[0-9]{2,3}-[0-9]{3,4}-[0-9]{4}$/; // 형식 : 033-1234-5678 var regMail =/^[_a-zA-Z0-9-]+@[._a-zA-Z0-9-]+\.[a-zA-Z]+$/; patten = eval(patten); if(!patten.test(val)){ return false; } return true; } // ######################## 체크박스 모두 선택 ######################## function checkAll(id, checks, isCheck){ var fobj = document.getElementsByName(checks); if(fobj == null) return; if(fobj.length){ for(var i=0; i < fobj.length; i++){ if(fobj[i].disabled==false){ fobj[i].checked = isCheck; } } }else{ if(fobj.disabled==false){ fobj.checked = isCheck; } } if(isCheck){ document.getElementById(id).innerHTML="취소"; }else{ document.getElementById(id).innerHTML="선택"; } } // ######################## 체크박스 TEXT 초기화 ######################## function InitText(id, checks){ var fobj = document.getElementsByName(checks); document.getElementById(id).innerHTML="선택"; //document.getElementById(id).innerHTML="선택"; //document.getElementById(id).innerHTML="선택"; } // ######################## 체크박스 모두 선택(사용자용) ######################## function checkUserAll(id, checks, isCheck,rootPath){ var fobj = document.getElementsByName(checks); if(fobj.length){ for(var i=0; i < fobj.length; i++){ if(fobj[i].disabled==false){ fobj[i].checked = isCheck; } } }else{ if(fobj.disabled==false){ fobj.checked = isCheck; } } if(isCheck){ document.getElementById(id).innerHTML=""; }else{ document.getElementById(id).innerHTML=""; } } function checkBoxAll(obj, checks){ var fobj = document.getElementsByName(checks); isCheck = obj.checked; if(fobj.length){ for(var i=0; i < fobj.length; i++){ if(fobj[i].disabled==false){ fobj[i].checked = isCheck; } } }else{ if(fobj.disabled==false){ fobj.checked = isCheck; } } } // 체크된 값을 가져온다.(디폴트 구분자 : ',') function getCheckedValue(checks, divstring) { var fobj = document.getElementsByName(checks); var index = 0; var result = ""; if(divstring == null) divstring = "','"; if(fobj.length){ for(index = 0; index < fobj.length; index++){ if(fobj[index].disabled == false && fobj[index].checked == true) { if(result == "") result += fobj[index].value; else result += divstring + fobj[index].value; } } } else { if(fobj.disabled==false && fobj.checked == true) { result = fobj.value; } } if(result != "") result = "'" + result + "'"; return result; } // 체크된 값을 가져온다.(디폴트 구분자 : ',') function getCheckedNumValue(checks, divstring) { var fobj = document.getElementsByName(checks); var index = 0; var result = ""; if(divstring == null) divstring = ","; if(fobj.length){ for(index = 0; index < fobj.length; index++){ if(fobj[index].disabled == false && fobj[index].checked == true) { if(result == "") result += fobj[index].value; else result += divstring + fobj[index].value; } } } else { if(fobj.disabled==false && fobj.checked == true) { result = fobj.value; } } return result; } // 체크안된 값을 가져온다.(디폴트 구분자 : ',') function getUnCheckedValue(checks, divstring) { var fobj = document.getElementsByName(checks); var index = 0; var result = ""; if(divstring == null) divstring = "','"; if(fobj.length){ for(index = 0; index < fobj.length; index++){ if(fobj[index].disabled == false && fobj[index].checked == false) { if(result == "") result += fobj[index].value; else result += divstring + fobj[index].value; } } } else { if(fobj.disabled==false && fobj.checked == false) { result = fobj.value; } } if(result != "") result = "'" + result + "'"; return result; } // ######################## 브라우져 체크(네스케이프, 익스플로러) ######################## function check_browser() { var ret; ret = navigator.appName; if (ret == "Netscape") return "NE"; else if (ret == "Microsoft Internet Explorer") return "IE"; else return -1; } // ######################## 정수체크 ######################## function is_valid_float(object) { if (object.getAttribute("required") != null && !object.value) return false; if (object.value.length != 0) { if (object.getAttribute("float") != null) { var regExpFloat = /^(([\+-])?(\d+)(\.\d+)?)$/; if(!regExpFloat.test(object.value)) return false; } } return true; } // ######################## Upper Case ######################## function is_upper(value) { var i; for(i = 0 ; i < _upperValue.length ; i++) if(value == _upperValue.charAt(i)) return true; return false; } // ######################## 대문자 변환 ######################## function to_upper(obj) { var strNew; var str = obj.value; for(i = 0 ; i < str.length ; i++) { if(str.charAt(i) >= 'a' && str.charAt(i) <= 'z') strNew = strNew + str.charAt(i).toUpperCase() ; else strNew = strNew + str.charAt(i); } obj.value = strNew; } // ######################## Lower Case ######################## function is_lower(value) { var i; for(i = 0 ; i < _lowerValue.length ; i++) if(value == _lowerValue.charAt(i)) return true; return false; } // ######################## is Int ######################## function is_int(value) { var j; for(j = 0 ; j < _intValue.length ; j++) if(value == _intValue.charAt(j)) return true; return false; } // ######################## 문자길이 체크 ######################## function check_length(obj,len,str) { obj.value = ltrim(obj.value); complen = check_byte(obj.value); if(complen > len) { alert(str + len + 'Byte를 넘습니다. 현재' + complen + 'Byte 입니다.'); obj.focus(); return false; } return true; } // ######################## 좌측공백제거 ######################## function ltrim(para) { while(para.substring(0,1) == ' ') para = para.substring(1, para.length); return para; } // ######################## 중간공백제거 ######################## function mtrim(para) { for(var i = 0 ; i < para.length ;) if(para.substring(i,i+1) == ' ') para = para.substring(0,i) + para.substring(i+1,para.length); else i++; return para; } // ######################## 오른쪽공백제거 ######################## function rtrim(para) { while(para.substring(para.length-1,para.length) == ' ') para = para.substring(0,para.length-1); return para; } // ############### 문자열 내의 모든 공백 문자 제거 ################## function TrimAll(data) { var lszTrim = data; var j = 0; for(var i = 0; i < data.length; i++) { if(data.substring(i, i+1) == ' ') { if(i > 0) lszTrim = data.substring(0, i); else lszTrim = ""; lszTrim = lszTrim + data.substring(i+1); data = lszTrim; i--; } } for(var i = 0; i < data.length; i++) { if(data.charCodeAt(i) == 12288) { if(i > 0) lszTrim = data.substring(0, i); else lszTrim = ""; lszTrim = lszTrim + data.substring(i+1); data = lszTrim; i--; } } return lszTrim; } // ############### 오늘(YYYY-MM-DD)날짜 리턴 ################## function to_day() { var now = new Date(); var yr = now.getYear(); var mName = now.getMonth() + 1; var dName = now.getDate(); if(yr < 100) year = ("19" + yr).toString(); else year = yr.toString(); if(mName < 10) month = ("0" + mName).toString(); else month = mName.toString(); if(dName < 10) day = ("0" + dName).toString(); else day = dName.toString(); return year + "-" + month + "-" + day; } function to_day2() { var now = new Date(); var yr = now.getYear(); var mName = now.getMonth() + 1; var dName = now.getDate(); var hName = now.getHours(); if(yr < 100) year = ("19" + yr).toString(); else year = yr.toString(); if(mName < 10) month = ("0" + mName).toString(); else month = mName.toString(); if(dName < 10) day = ("0" + dName).toString(); else day = dName.toString(); return year + month + day + hName; } function to_day3() { var now = new Date(); var yr = now.getYear(); var mName = now.getMonth() + 1; var dName = now.getDate(); var hName = now.getHours(); if(yr < 100) year = ("19" + yr).toString(); else year = yr.toString(); if(mName < 10) month = ("0" + mName).toString(); else month = mName.toString(); if(dName < 10) day = ("0" + dName).toString(); else day = dName.toString(); if(hName < 10) hName = ("0" + hName).toString(); else hName = hName.toString(); return year + month + day + ":" + hName; } // ############### 문자열 인코딩 ################## function str_encoding(str) { var ret = ''; var c = ''; var temp = ''; if(check_browser() != 'IE') return str; for(i = 0 ; i < str.length ; i++) { temp = str.charCodeAt(i); if(temp > 122 || temp == 32) c = escape(str.charAt(i)); else c = str.charAt(i); ret = ret + c; } return ret; } // ############### 금액 콤마 추가 ################## function add_comma(obj) { var str = String(obj.value); str = str.replaceAll(",", ""); var x = 0; if(str.length < 1) { return ""; } else { var tm = ""; var ck = ""; if(str.substring(0,1) == "-") { tm = str.substring(1,str.length); ck = "Y"; } else { tm = str; ck = "N"; } var st = ""; var cm = ","; for(var i = tm.length, j = 0 ; i > 0 ; i--, j++) { if((j % 3) == 2) { if(tm.length == j+1) st = tm.substring(i-1,i) + st; else st = cm + tm.substring(i-1,i) + st; } else { st = tm.substring(i-1,i) + st; } } if(ck == "Y") st = "-" + st; return st; } } // ############### 금액 콤마 추가 ################## function add_comma_value(value) { var str = String(value); str = str.replaceAll(",", ""); var x = 0; if(str.length < 1) { return ""; } else { var tm = ""; var ck = ""; if(str.substring(0,1) == "-") { tm = str.substring(1,str.length); ck = "Y"; } else { tm = str; ck = "N"; } var st = ""; var cm = ","; for(var i = tm.length, j = 0 ; i > 0 ; i--, j++) { if((j % 3) == 2) { if(tm.length == j+1) st = tm.substring(i-1,i) + st; else st = cm + tm.substring(i-1,i) + st; } else { st = tm.substring(i-1,i) + st; } } if(ck == "Y") st = "-" + st; return st; } } // ########### 날짜 형식 검사(yyyy-mm-dd) ############### function checkDateFormat(obj, objName) { var str = String(obj.value); var year; var month; var day; var dash_1; var dash_2; var msg; if(str.length < 1 || str.length.length > 10) { msg = "입력하신 " + objName + "의 길이가 형식에 맞지 않습니다."; alert(msg); return false; } else { year = str.substring(0, 4); dash_1 = str.substring(4, 5); month = str.substring(5, 7); dash_2 = str.substring(7, 8); day = str.substring(8, 10); if(!(IsNumber(year) && IsNumber(month) && IsNumber(day))) { msg = objName + "는 숫자로 입력되어야 합니다."; alert(msg); return false; } if(dash_1 != "-" || dash_2 != "-") { msg = objName + "의 년월일 구분은 -로 입력되어야 합니다."; alert(msg); return false; } } return true; } // ############### 날짜 문자열에 '-' 추가 ################## function addStringToDate(strDate, sep) { var str = ''; var t_date = removeDashFromDate(strDate); if (t_date.length < 1 || t_date.length < 8) { return ""; } else { str = t_date.substring(0, 4) + sep + t_date.substring(4, 6) + sep + t_date.substring(6, 8); } return str; } // ############### 날짜 문자열에 '-' 추가 ################## function addDashToObjDate(obj) { var sep = '-'; var str = ''; var t_date = removeDashFromDate(obj.value); if (t_date.length < 1 || t_date.length < 8) { return ""; } else { str = t_date.substring(0, 4) + sep + t_date.substring(4, 6) + sep + t_date.substring(6, 8); obj.value = str; } return obj.value; } // ############### 날짜 문자열에 '-' 추가 ################## function addDashToDate(strDate) { var sep = '-'; var str = ''; var t_date = removeDashFromDate(strDate); if (t_date.length < 1 || t_date.length < 8) { return ""; } else { str = t_date.substring(0, 4) + sep + t_date.substring(4, 6) + sep + t_date.substring(6, 8); } return str; } // ############### 날짜 문자열에서 '-' 제거 ################## function removeDashFromDate(strDate) { if(strDate.length < 1) { return ""; } else { var st = ""; var sp = "-"; for(var i = 0 ; i < strDate.length ; i++) if(sp.indexOf(strDate.substring(i,i+1)) == -1) st += strDate.substring(i,i+1); return st; } } // ############### 슬러쉬 / 제거 ################## function del_slash(obj) { var str = String(obj.value); if(str.length < 1) { return ""; } else { var st = ""; var sp = "/"; for(var i = 0 ; i < str.length ; i++) if(sp.indexOf(str.substring(i,i+1)) == -1) st += str.substring(i,i+1); return st; } } // ############### 하이픈 (-) 제거 ################## function del_hyphen(obj) { var str = String(obj.value); if(str.length < 1) { return ""; } else { var st = ""; var sp = "-"; for(var i = 0 ; i < str.length ; i++) if(sp.indexOf(str.substring(i,i+1)) == -1) st += str.substring(i,i+1); return st; } } function del_hyphen_value(value) { var str = value; if(str.length < 1) { return ""; } else { var st = ""; var sp = "-"; for(var i = 0 ; i < str.length ; i++) if(sp.indexOf(str.substring(i,i+1)) == -1) st += str.substring(i,i+1); return st; } } // ############### 이메일 형식 체크 ################## function is_email(obj) { var s = String(obj.value); if ( s == "" || s == null) { alert("이메일을 입력하십시요."); return false; } else { var i = 1; var sLength = s.length; while ((i < sLength) && (s.charAt(i) != "@")) i++; if ((i >= sLength) || (s.charAt(i) != "@")) { alert("이메일이 형식에 맞지 않습니다."); return false; } else i += 2; while ((i < sLength) && (s.charAt(i) != ".")) i++; if ((i >= sLength - 1) || (s.charAt(i) != ".")) { alert("이메일이 형식에 맞지 않습니다."); return false; } else return true; } } // ############### 오브젝트 갯수 체크 ################## function getLength(obj) { for(f = 0 ; f < document.forms.length ; f++) { var mForm = document.forms[f]; var iElements = mForm.elements.length; var cnt = 0; for(i = 0 ; i < iElements ; i++) { if(mForm.elements[i].name == obj) { cnt = cnt + 1; } } return cnt; } } // ############### 오브젝트명을 받아와서 체크박스일 경우 체크된 갯수 리턴 ################## function getChecked(obj) { for(f = 0 ; f < document.forms.length ; f++) { var mForm = document.forms[f]; var iElements = mForm.elements.length; var cnt = 0; for(i = 0 ; i < iElements ; i++) { if(mForm.elements[i].name == obj) { if(mForm.elements[i].checked) { cnt = cnt + 1; } } } } return cnt; } // ############### 입력 글자수 알려주고 초과시 삭제 ################## function cal_byte(cont,txtbox,lengbox,length){ var onechar; var tcount=0; var tmpStr = new String(txtbox.value); for (k=0;k 4) { tcount += 2; } else { tcount++; } } lengbox.value = tcount; if(tcount>length) { reserve = tcount-length; alert(cont+ "은 " + length + " Byte 이상 입력할 수가 없습니다. \r\n\n 입력한 " + cont + "는 " + reserve + "Byte초과가 되었습니다. \r\n\n 초과된 부분은 자동 삭제됩니다."); cutText(txtbox,lengbox,length); return; } } /** * @author mingoo * @param txtbox - input * @param lengbox - span * @param length - integer */ function cal_byte2(txtbox,lengbox,length){ var onechar; var tcount=0; var tmpStr = new String(txtbox.value); for (k=0;k 4) { tcount += 2; } else { tcount++; } } lengbox.innerHTML = tcount; if(tcount>length) { reserve = tcount-length; alert(length + "Byte 이상 입력할 수가 없습니다. \r\n\n " + reserve + "Byte초과가 되었습니다. \r\n\n 초과된 부분은 자동 삭제됩니다."); event.returnValue=false; txtbox.value = tmpStr.cutstring(length); lengbox.innerHTML = length; } } String.prototype.cutstring = function(len) { var str = this; var l = 0; for (var i=0; i 128) ? 2 : 1; if (l > len) return str.substring(0,i); } return str; } function findFormElement(form, name) { var arrObj = new Array(); var obj = null; var nCount = 0; for(var i = 0; i < form.elements.length; i++) { if(form.elements[i].name == name) nCount++; } if(nCount <= 1) { for(var i = 0; i < form.elements.length; i++) { if(form.elements[i].name == name) { obj = form.elements[i]; break; } } return obj; } else { nCount = 0; for(var i = 0; i < form.elements.length; i++) { if(form.elements[i].name == name) { arrObj[nCount] = form.elements[i]; nCount++; } } return arrObj; } } // 윈도우 팝업 function openWindow(surl, type, name) { var pop_size = type.split("*"); var popupwidth = pop_size[0]; var popupheight = pop_size[1]; if(isNaN(parseInt(popupwidth))) { Top = (window.screen.availHeight - 600) / 2; Left = (window.screen.availWidth - 800) / 2; } else { Top = (window.screen.availHeight - popupheight) / 2; Left = (window.screen.availWidth - popupwidth) / 2; } if(Top < 0) Top = 0; if(Left < 0) Left = 0; var delim = (surl.indexOf("?") == -1) ? "?" : "&"; Feature = "toolbar=0,menubar=0,scrollbars=auto,resizable=no,left=" + Left + ",top=" + Top + ",width=" + popupwidth + ",height=" + popupheight; if(name == "") name = "popupWindow"; PopUpWindow = window.open(surl, name, Feature); PopUpWindow.focus(); } // 윈도우 팝업 function openWindowScroll(surl, type, name) { var pop_size = type.split("*"); var popupwidth = pop_size[0]; var popupheight = pop_size[1]; if(isNaN(parseInt(popupwidth))) { Top = (window.screen.availHeight - 600) / 2; Left = (window.screen.availWidth - 800) / 2; } else { Top = (window.screen.availHeight - popupheight) / 2; Left = (window.screen.availWidth - popupwidth) / 2; } if(Top < 0) Top = 0; if(Left < 0) Left = 0; var delim = (surl.indexOf("?") == -1) ? "?" : "&"; Feature = "toolbar=0,menubar=0,scrollbars=yes,resizable=no,left=" + Left + ",top=" + Top + ",width=" + popupwidth + ",height=" + popupheight; if(name == "") name = "popupWindow"; PopUpWindow = window.open(surl, name, Feature); PopUpWindow.focus(); } // 타겟지정 새창열기 function openTargetWindow(surl, name) { PopUpWindow = window.open(surl, name); if (PopUpWindow != null) { PopUpWindow.focus(); } } // round 함수 ( val = 값, precision= 소숫점 자릿수) function round(val,precision) { val = val * Math.pow(10,precision); val = Math.round(val); return val/Math.pow(10,precision); } // TRIM String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/gi, ""); } // 문자열 치환 String.prototype.replaceAll = function(_findValue, _replaceValue) { /* var temp_str = ""; if (this.trim() != "" && str1 != str2) { temp_str = this.trim(); while (temp_str.indexOf(str1) > -1) { temp_str = temp_str.replace(str1, str2); } } return temp_str; */ return this.replace(new RegExp(_findValue, "g"), _replaceValue); } function encodeURL(str){ var s0, i, s, u; s0 = ""; // encoded str for (i = 0; i < str.length; i++){ // scan the source s = str.charAt(i); u = str.charCodeAt(i); // get unicode of the char if (s == " "){s0 += "+";} // SP should be converted to "+" else { if ( u == 0x2a || u == 0x2d || u == 0x2e || u == 0x5f || ((u >= 0x30) && (u <= 0x39)) || ((u >= 0x41) && (u <= 0x5a)) || ((u >= 0x61) && (u <= 0x7a))){ // check for escape s0 = s0 + s; // don't escape } else { // escape if ((u >= 0x0) && (u <= 0x7f)){ // single byte format s = "0"+u.toString(16); s0 += "%"+ s.substr(s.length-2); } else if (u > 0x1fffff){ // quaternary byte format (extended) s0 += "%" + (oxf0 + ((u & 0x1c0000) >> 18)).toString(16); s0 += "%" + (0x80 + ((u & 0x3f000) >> 12)).toString(16); s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16); s0 += "%" + (0x80 + (u & 0x3f)).toString(16); } else if (u > 0x7ff){ // triple byte format s0 += "%" + (0xe0 + ((u & 0xf000) >> 12)).toString(16); s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16); s0 += "%" + (0x80 + (u & 0x3f)).toString(16); } else { // double byte format s0 += "%" + (0xc0 + ((u & 0x7c0) >> 6)).toString(16); s0 += "%" + (0x80 + (u & 0x3f)).toString(16); } } } } return s0; } function decodeURL(str){ var s0, i, j, s, ss, u, n, f; s0 = ""; // decoded str for (i = 0; i < str.length; i++){ // scan the source str s = str.charAt(i); if (s == "+"){s0 += " ";} // "+" should be changed to SP else { if (s != "%"){s0 += s;} // add an unescaped char else{ // escape sequence decoding u = 0; // unicode of the character f = 1; // escape flag, zero means end of this sequence while (true) { ss = ""; // local str to parse as int for (j = 0; j < 2; j++ ) { // get two maximum hex characters for parse sss = str.charAt(++i); if (((sss >= "0") && (sss <= "9")) || ((sss >= "a") && (sss <= "f")) || ((sss >= "A") && (sss <= "F"))) { ss += sss; // if hex, add the hex character } else {--i; break;} // not a hex char., exit the loop } n = parseInt(ss, 16); // parse the hex str as byte if (n <= 0x7f){u = n; f = 1;} // single byte format if ((n >= 0xc0) && (n <= 0xdf)){u = n & 0x1f; f = 2;} // double byte format if ((n >= 0xe0) && (n <= 0xef)){u = n & 0x0f; f = 3;} // triple byte format if ((n >= 0xf0) && (n <= 0xf7)){u = n & 0x07; f = 4;} // quaternary byte format (extended) if ((n >= 0x80) && (n <= 0xbf)){u = (u << 6) + (n & 0x3f); --f;} // not a first, shift and add 6 lower bits if (f <= 1){break;} // end of the utf byte sequence if (str.charAt(i + 1) == "%"){ i++ ;} // test for the next shift byte else {break;} // abnormal, format error } s0 += String.fromCharCode(u); // add the escaped character } } } return s0; } // 입력받은 값(숫자)이 0일 경우, 포커싱 function zeroSelect(obj) { if (obj.value == 0) { obj.select(); } } // 입력받은 키보드값이 숫자인지 판단 function isDigit(e) { if (e.ctrlKey == true) { return true; } var sKeyCode = e.keyCode; if (sKeyCode == 8 || sKeyCode == 9 || sKeyCode == 37 || sKeyCode == 39 || sKeyCode == 46 || (sKeyCode >= 48 && sKeyCode <= 57) || (sKeyCode >= 96 && sKeyCode <= 105) ||sKeyCode == 110 ||sKeyCode == 190) { window.event.returnValue = true; } else { window.event.returnValue = false; } } // 숫자만 입력 받음. function inputNumber() { var inputs = document.getElementsByTagName("INPUT"); for(i=0; i 6) radius = 6; MAX = radius * 2 + 1; Table = document.createElement('TABLE'); TBody = document.createElement('TBODY'); Table.cellSpacing = 0; Table.cellPadding = 0; for (trIDX=0; trIDX < MAX; trIDX++) { TR = document.createElement('TR'); Space = Math.abs(trIDX - parseInt(radius)); for (tdIDX=0; tdIDX < MAX; tdIDX++) { TD = document.createElement('TD'); styleWidth = '1px'; styleHeight = '1px'; if (tdIDX == 0 || tdIDX == MAX - 1) styleHeight = null; else if (trIDX == 0 || trIDX == MAX - 1) styleWidth = null; else if (radius > 2) { if (Math.abs(tdIDX - radius) == 1) styleWidth = '2px'; if (Math.abs(trIDX - radius) == 1) styleHeight = '2px'; } if (styleWidth != null) TD.style.width = styleWidth; if (styleHeight != null) TD.style.height = styleHeight; if (Space == tdIDX || Space == MAX - tdIDX - 1) TD.style.backgroundColor = bdcolor; else if (tdIDX > Space && Space < MAX - tdIDX - 1) TD.style.backgroundColor = bgcolor; if (Space == 0 && tdIDX == radius) TD.appendChild(obj); TR.appendChild(TD); } TBody.appendChild(TR); } Table.appendChild(TBody); // insert table and remove original table Parent.insertBefore(Table, objTmp); } function convertToUTF8(s) { var c, d = ""; for (var i = 0; i < s.length; i++) { c = s.charCodeAt(i); if (c <= 0x7f) { d += s.charAt(i); } else if (c >= 0x80 && c <= 0x7ff) { d += String.fromCharCode(((c >> 6) & 0x1f) | 0xc0); d += String.fromCharCode((c & 0x3f) | 0x80); } else { d += String.fromCharCode((c >> 12) | 0xe0); d += String.fromCharCode(((c >> 6) & 0x3f) | 0x80); d += String.fromCharCode((c & 0x3f) | 0x80); } } return d; } function convertFromUTF8(s) { var c, d = "", flag = 0, tmp; for (var i = 0; i < s.length; i++) { c = s.charCodeAt(i); if (flag == 0) { if ((c & 0xe0) == 0xe0) { flag = 2; tmp = (c & 0x0f) << 12; } else if ((c & 0xc0) == 0xc0) { flag = 1; tmp = (c & 0x1f) << 6; } else if ((c & 0x80) == 0) { d += s.charAt(i); } else { flag = 0; } } else if (flag == 1) { flag = 0; d += String.fromCharCode(tmp | (c & 0x3f)); } else if (flag == 2) { flag = 3; tmp |= (c & 0x3f) << 6; } else if (flag == 3) { flag = 0; d += String.fromCharCode(tmp | (c & 0x3f)); } else { flag = 0; } } return d; } // HTML 특수 문자들을 치환한다. // '(작은따옴표) -> ' // " (큰따옴표) -> " // & (앰퍼센트) -> & // < (보다작은) -> < // > (보다 큰) -> > function HtmlSpecialChars(str) { var ret_str = str; // search = new Array(/'/g, /"/g, /&/g, //g); // replace = new Array("'", """, "&", "<", ">"); search = new Array(/&/g, //g); replace = new Array("&", "<", ">"); cnt = search.length; for(i = 0; i < cnt; i++) { ret_str = ret_str.replace(search[i], replace[i]); } return ret_str; } var PopUp = { open: function(pop,width,height,flag) { var win = null; var url = pop; var wd = width; var he = height; var winName = ""; var Top = 0; var Left = 0; Top = (window.screen.availHeight - height) / 2; Left = (window.screen.availWidth - width) / 2; if(Top < 0) Top = 0; if(Left < 0) Left = 0; if ((window.navigator.userAgent.indexOf("SV1") != -1) || (window.navigator.userAgent.indexOf("MSIE 7") != -1)) { wd = wd + 8; he = he + 10; if(flag == "0" ){ win = window.open(url,"","toolbar=0,menubar=0,scrollbars=no,resizable=no,width=" + wd + ",height=" + he + ",left=" + Left + ",top=" + Top + ";"); }else{ win = window.open(url,"","toolbar=0,menubar=0,scrollbars=yes,resizable=no,width=" + wd + ",height=" + he + ",left=" + Left + ",top=" + Top + ";"); } } else { if (flag == "0" ) { win = window.open(url,"","toolbar=0,menubar=0,scrollbars=no,resizable=no,width=" + wd +",height=" + he + ",left=" + Left + ",top=" + Top + ";"); } else { win = window.open(url,"","toolbar=0,menubar=0,scrollbars=yes,resizable=no,width=" + wd +",height=" + he + ",left=" + Left + ",top=" + Top + ";"); } } return win; }, open_name: function(pop,name,width,height,flag) { var win = null; var url = pop; var wd = width; var he = height; var Top = 0; var Left = 0; Top = (window.screen.availHeight - height) / 2; Left = (window.screen.availWidth - width) / 2; if(Top < 0) Top = 0; if(Left < 0) Left = 0; if ((window.navigator.userAgent.indexOf("SV1") != -1) || (window.navigator.userAgent.indexOf("MSIE 7") != -1)) { wd = wd + 8; he = he + 10; if(flag == "0" ){ win = window.open(url,name,"toolbar=0,menubar=0,scrollbars=no,resizable=no,width=" + wd + ",height=" + he + ",left=" + Left + ",top=" + Top + ";"); win.focus(); }else{ win = window.open(url,name,"toolbar=0,menubar=0,scrollbars=yes,resizable=no,width=" + wd + ",height=" + he + ",left=" + Left + ",top=" + Top + ";"); win.focus(); } } else { if (flag == "0" ) { win = window.open(url,name,"toolbar=0,menubar=0,scrollbars=no,resizable=no,width=" + wd +",height=" + he + ",left=" + Left + ",top=" + Top + ";"); win.focus(); } else { win = window.open(url,name,"toolbar=0,menubar=0,scrollbars=yes,resizable=no,width=" + wd +",height=" + he + ",left=" + Left + ",top=" + Top + ";"); win.focus(); } } return win; }, open_name_size: function(pop,name,width,height,left,top,flag) { var win = null; var url = pop; var wd = width; var he = height; if ((window.navigator.userAgent.indexOf("SV1") != -1) || (window.navigator.userAgent.indexOf("MSIE 7") != -1)) { //wd = wd + 8; //he = he + 10; if(flag == "0" ){ win = window.open(url,name,"toolbar=0,menubar=0,scrollbars=no,resizable=no,left="+left+",top="+top+",width=" + wd + ",height=" + he + ";"); win.focus(); }else{ win = window.open(url,name,"toolbar=0,menubar=0,scrollbars=yes,resizable=no,left="+left+",top="+top+",width=" + wd + ",height=" + he + ";"); win.focus(); } } else { if (flag == "0" ) { win = window.open(url,name,"toolbar=0,menubar=0,scrollbars=no,resizable=no,left="+left+",top="+top+",width=" + wd + ",height=" + he + ";"); win.focus(); } else { win = window.open(url,name,"toolbar=0,menubar=0,scrollbars=yes,resizable=no,left="+left+",top="+top+",width=" + wd + ",height=" + he + ";"); win.focus(); } } return win; } }; function display_obj(obj_name) { obj_array = obj_name.split("|"); l1 = obj_array.length; for (i=0;i' ; Tag += '' ; Tag += '' ; return Tag ; } // 문자열 중간에 문자열을 집어넣음 String.prototype.putChar = function(index , char) { var newStr = this ; if ( TrimAll(newStr) != '' ) { var str1 = newStr.substr(0,index) ; var str2 = newStr.substr(index, newStr.length) ; return str1 + char + str2 ; } else { return "" ; } } // 날짜로 변환 String.prototype.toDate = function (deli) { var t_date = removeDashFromDate(this); if (t_date.length < 1 || t_date.length < 8) { return ""; } else { str = t_date.substring(0, 4) + deli + t_date.substring(4, 6) + deli + t_date.substring(6, 8); } return str; } // 날짜&시간으로 변환 String.prototype.toDatetime = function (delimDate, delimTime, bIncludeSecond) { var t_date = this.replaceAll("-", ""); t_date = t_date.replaceAll(":", ""); if(typeof(delimDate) == "undefined") delimDate = "-"; if(typeof(delimTime) == "undefined") delimTime = ":"; if(typeof(bIncludeSecond) == "undefined") bIncludeSecond = false; if (t_date.length < 1 || t_date.length < 13) { return ""; } else { str = t_date.substring(0, 4) + delimDate + t_date.substring(4, 6) + delimDate + t_date.substring(6, 8); str = str + " " + t_date.substring(9, 11) + delimTime + t_date.substring(11, 13) if(bIncludeSecond) str = str + delimTime + t_date.substring(13, 15); } return str; } // 날짜&시간으로 변환 String.prototype.toTime = function (delimTime, bIncludeSecond) { var t_date = this.replaceAll("-", ""); t_date = t_date.replaceAll(":", ""); if(typeof(delimDate) == "undefined") delimDate = "-"; if(typeof(delimTime) == "undefined") delimTime = ":"; if(typeof(bIncludeSecond) == "undefined") bIncludeSecond = false; if (t_date.length < 1 || t_date.length < 13) { return ""; } else { str = t_date.substring(9, 11) + delimTime + t_date.substring(11, 13) if(bIncludeSecond) str = str + delimTime + t_date.substring(13, 15); } return str; } // 지정한 사이즈 보다 크면 문자열 자름 String.prototype.cutString = function (len, addStr){ var ThisString = this ; var ByteLength = 0; var limit = len ; for(var i=0;i < ThisString.length; i++){ if(ThisString.charCodeAt(i) > 255) { ByteLength += 2; if ( i == 0 ) limit = limit * 2 ; } else{ ByteLength++; } } if(ByteLength>limit){ ThisString = ThisString.substring(0 , len ) + addStr ; } return ThisString; } // 지정된 문자로 왼쪽에 채워 지정된 길이의 문자열을 만든다. String.prototype.fillLeft = function(len, fillStr){ var ThisString = this ; for(var i=0; ThisString.length < len; i++){ ThisString = fillStr + ThisString; } return ThisString; } //이미지 미리보기 function goImageView(attach_idx){ if(attach_idx == ''){ alert('이미지가 없습니다.'); return; }else{ this.openWindow("/actions/CommonPageAction?cmd=imagePreview&attach_idx="+attach_idx, "toolbar=0,menubar=0,width=100,height=100", "opendata"); } } //이미지 미리보기 function goImageView_bbs(attach_idx){ if(attach_idx == ''){ alert('이미지가 없습니다.'); return; }else{ this.openWindow("/actions/CommonPageAction?cmd=imagePreview_bbs&attach_idx="+attach_idx, "toolbar=0,menubar=0,width=100,height=100", "opendata"); } } //샘플 동영상 보기 function goSampleView(url,title){ //라디오 다시듣기 맛보기 sample if(!isNaN(url)){ if(url != ''){ window.open("http://home.ebs.co.kr/servlet/wizard.servlet.admin.program.vodaodListServlet?command=aodplayer2&charge=A&type=E&seq="+url+"","sample", "width=517, height=190"); }else{ alert('URL 데이터가 존재하지 않습니다.'); return; } }else{ if(url != ''){ window.open("/jsp/player/player_sample.jsp?mms_data="+url+"&title="+title+"", "VODView", "toolbar=0 scrolling=yes,menubar=0,width=510px height=500px"); }else{ alert('URL 데이터가 존재하지 않습니다.'); return; } } } // cp업체 공통 팝업 function goCpPopup(url,formName,codeField,nameField){ var url = url+"?cmd=listPopup"; url +="&formName="+formName; url +="&codeField="+codeField; url +="&nameField="+nameField; openWindow(url, "800*600", "postpop"); } /************************************************** * Input box에서 엔터시 PreventSubmitOnEnter 함수 호출 * PreventSubmitOnEnter는 파라미터 없음 * OnLoad 또는 페이지의 맨 마지막에 chkEnter 호출 **************************************************/ function chkEnter(){ var inputs = document.getElementsByTagName("INPUT") ; if(typeof(PreventSubmitOnEnter) != 'undefined') { for(var i = 0; i < inputs.length ; i++){ if(inputs[i].type == "text"){ inputs[i].attachEvent("onkeypress", PreventSubmitOnEnter); } } } } /************************************************** * 텍스트를 길이에 맞게 줄임 (...)으로 표시하여 나타낸다) **************************************************/ function decreaseString(szContent, bIsLink, width, bIsDisplayAlt, bAddSpaceOnBegin) { var szResult = ""; if(typeof(bIsLink) == "undefined") bIsLink = false; if(typeof(width) == "undefined") width = "100%"; if(typeof(bIsDisplayAlt) == "undefined") bIsDisplayAlt = true; if(typeof(bAddSpaceOnBegin) == "undefined") bAddSpaceOnBegin = true; szContent = szContent.replaceAll("'", "\\'"); szContent = szContent.replaceAll("\"", "\\\""); if(bAddSpaceOnBegin) szResult = " "; szResult = szResult + ""; return szResult; } function AddComboOption(combo, optionText, optionValue) { var oOption = document.createElement("option") ; oOption.text = optionText ; oOption.value = optionValue ; combo.options.add(oOption); return oOption ; } /************************************************************ * MoveFocus(obj , limit , tgObjName) * * obj : 해당 object * limit : 글자 제한 Length * tgObjName : target Object Name * * 해당 Object의 limit 만큼 글을 쓰면 대상오브젝트로 포커스 이동 ************************************************************/ function MoveFocus(obj , limit , tgObjName) { var objValue = obj.value ; if ( objValue.length == limit ) { document.getElementById(tgObjName).focus() ; } } /* function alert(msg) { window.showModalDialog("/jsp/test.jsp", "", "dialogWidth: 300px; dialogHeight:200px"); } */ /************************************************************ * checkDuration(objStartDate, objEndDate) * * objStartDate (M) : 시작일자 object (반드시 Object이어야 함) * objEndDate (M) : 종료일자 object (반드시 Object이어야 함) * bAllowEmpty (O) : 유효성 검사에서 빈문자열을 허용할지 여부 (default : true) * * 반환 : 검사 결과 (true:유효한값, false:유효하지않은값) * * 시작일자와 종료일자에 입력된 데이터가 "-"이 없이 입력되면 날짜 형식에 맞게 * "-"를 넣어 완성시키고, 시작일이 종료일보다 큰경우에 대한 처리 검사를 한다. * ************************************************************/ function checkDuration(objStartDate, objEndDate, bAllowEmpty) { if(typeof(bCheckValidation) == "undefined") bCheckValidation = false; if(typeof(bAllowEmpty) == "undefined") bAllowEmpty = true; var szStartDate = removeDashFromDate(objStartDate.value); var szEndDate = removeDashFromDate(objEndDate.value); ////////////////////////////////////////// // 시작일/종료일 형식 교정 ////////////////////////////////////////// // 날짜에 숫자가 아닌 문자가 포함되어 있는지 검사 if(!IsEmpty(szStartDate) && (!IsNumber(szStartDate) || szStartDate.length != 8)) { alert("날짜 형식이 맞지 않습니다."); objStartDate.focus(); objStartDate.select(); return false; } if(!IsEmpty(szEndDate) && (!IsNumber(szEndDate) || szEndDate.length != 8)) { alert("날짜 형식이 맞지 않습니다."); objEndDate.focus(); objEndDate.select(); return false; } // 시작일자 날짜 형식 맞춤 (자동 변경) if(!IsEmpty(objStartDate.value) && !IsDate(objStartDate.value, "YYYY-MM-DD")) objStartDate.value = objStartDate.value.toDate("-"); // 종료일자 날짜 형식 맞춤 (자동 변경) if(!IsEmpty(objEndDate.value) && !IsDate(objEndDate.value, "YYYY-MM-DD")) objEndDate.value = objEndDate.value.toDate("-"); ////////////////////////////////////////// // 시작일/종료일 유효성 검사 ////////////////////////////////////////// // 빈문자열을 허용하지 않는 경우, 시작일/종료일이 입력되어 있는지 여부 검사 if(!bAllowEmpty && IsEmpty(szStartDate)) { alert("시작일을 입력하여 주세요."); objStartDate.focus(); objStartDate.select(); return false; } if(!bAllowEmpty && IsEmpty(szEndDate)) { alert("종료일을 입력하여 주세요."); objEndDate.focus(); objEndDate.select(); return false; } // 종료일이 시작일 보다 큰지 여부 검사 if(!IsEmpty(szStartDate) && !IsEmpty(szEndDate) && szStartDate > szEndDate) { alert("종료일자가 시작일자 보다 이전 입니다."); objEndDate.focus(); objEndDate.select(); return false; } return true; } /** * 지정한 일수의 날짜가 넘으면 false * frDate : 시작일 * toDay : 종료일 * dtLength : 최대 허용 기간 * return : true, false **/ function getCalculating( frDate, toDay, dtMax ) { var fromDay = frDate; var toDay = toDay; var dateLength = dtMax; fromDay = fromDay.split('-'); toDay = toDay.split('-'); var frYear = eval(fromDay[0]); var frMonth = eval(fromDay[1]); var frDay = eval(fromDay[2]); var toYear = eval(toDay[0]); var toMonth = eval(toDay[1]); var toDay = eval(toDay[2]); //월은 0~11까지가 12개월로 표기 fromDay = new Date(toYear, toMonth-1, toDay); toDay = new Date(frYear, frMonth-1, frDay); var distencet = fromDay.getTime() - toDay.getTime(); var dtRange= Math.floor( ( 1+distencet / (1000*60*60*24) ) ); if ( dtRange > dateLength ) { return true; } else { return false; } } /** * 폰트 확대 / 축소 * contentsTagId : 폰트 변경 대상 * fontMax : 확대시 폰트 최대값 * fontMin : 축소시 폰트 최소값 * addValue : 증가 / 감소 값 * addCategory : +,- 구분 **/ function fontSizeAdd( contentsTagId, fontMax, fontMin, addValue, addCategory ) { if(!document.getElementById(contentsTagId)) return false; var contents = document.getElementById(contentsTagId); var contents_nSize = contents.style.fontSize ? contents.style.fontSize : "12px"; var contents_iSize = parseInt(contents_nSize.replace("px","")); var source_contenst = document.getElementById(contentsTagId).getElementsByTagName("a"); var nSize = new Array(); var iSize = new Array(); var source_contenst2 = document.getElementById(contentsTagId).getElementsByTagName("li"); var nSize2 = new Array(); var iSize2 = new Array(); var source_contenst3 = document.getElementById(contentsTagId).getElementsByTagName("td"); var nSize3 = new Array(); var iSize3 = new Array(); if(addCategory == "+"){ if(contents_iSize < fontMax){ contents.style.fontSize = (contents_iSize + addValue)+"px"; contents.style.lineHeight = "140%"; } for(i=0; i fontMin){ contents.style.fontSize = (contents_iSize - addValue)+"px"; contents.style.lineHeight = "140%"; } for(i=0; i fontMin){ source_contenst[i].style.fontSize = (iSize[i] - addValue)+"px"; source_contenst[i].style.lineHeight = "140%"; } } for(i=0; i fontMin){ source_contenst2[i].style.fontSize = (iSize2[i] - addValue)+"px"; source_contenst2[i].style.lineHeight = "140%"; } } for(i=0; i fontMin){ source_contenst3[i].style.fontSize = (iSize3[i] - addValue)+"px"; source_contenst3[i].style.lineHeight = "140%"; } } } } /** * 파일 다운로드 Active X 팝업 */ function GeneralDownload(){ if (getCookie('ebsdown') == 'Y') { alert('다운로드가 진행중입니다.\r\n완료 후 다시 클릭해 주시기 바랍니다.'); return; } else { var chkIdx = getCheckedValue("chkDown"); if ( chkIdx !="" ) { if (confirm("선택한 강의를 다운로드 받으시겠습니까?")) { var chkLec = getChkLectureValue(chkIdx); var url = "/actions/LectureAction"; var attributes = "scrollbars=no, resizable=no, menubar=no, toolbar=no, location=no, status=no, width=647, height=393"; var win = window.open("", "ebsDownloader", attributes); f.action = url; f.target = "ebsDownloader"; f.cmd.value = "down"; f.chkIdx.value = chkIdx; f.arrLec.value = chkLec; f.submit(); } } else { alert("선택된 항목이 없습니다."); } } } /** * 다운로드 갯수 제한 * @param {Object} val */ function chkCount(val){ var arrChkVal = new Array; var chkCnt = getCheckedValue("chkDown"); chkCnt = chkCnt.replaceAll("'", ""); arrChkVal = chkCnt.split(','); if (arrChkVal.length > 10) { alert('다운로드는 한 번에 10개까지 받으실 수 있습니다.'); document.getElementById("chkDown_"+val).checked = false; return; } } /** * 체크된 강의 ID를 가져온다. * @param {Object} obj */ function getChkLectureValue (obj) { var chkCnt = ''; var returnVal = ''; var arrLecVal = new Array; chkCnt = obj.replaceAll("'", ""); arrLecVal = chkCnt.split(','); for ( i = 0; i < arrLecVal.length; i++ ) { if ( returnVal == '' ) returnVal += document.getElementById("chkLec_"+arrLecVal[i]).value; else returnVal += "','" + document.getElementById("chkLec_"+arrLecVal[i]).value; } if(returnVal != "") returnVal = "'" + returnVal + "'"; return returnVal; } function setDownCookie( name, value, expiredays ){ if (expiredays == '') expiredays = 1; var todayDate = new Date(); todayDate.setDate( todayDate.getDate() + parseInt(expiredays, 10) ); document.cookie = name + "=" + escape( value ) + "; path=/; domain=ebs.co.kr; expires=" + todayDate.toGMTString() + ";" } // 쿠키지우기 function clearDownCookie(name) { today = new Date(); today.setDate(today.getDate() - 1); document.cookie = name + "=; path=/; domain=ebs.co.kr; expires=" + today.toGMTString() + ";"; } //최상위 페이지로 이동 function goTopPage(url) { top.location.href = url; }