PageSourceSearch

https://e-health.go.kr/js/cm/common.js

js e-health.go.kr collected 2026-10-02 14:59:27 UTC 33,556 bytes, 998 lines download raw bytes

1/**
2 ----------------------------------------------------------
3 * @프로그램명 : 공통 javascript
4 * @파일명 : common.js
5 * @작성일 : 2021.10.04
6 ----------------------------------------------------------
7 */
8
9
10/*
11  * @method gfn_isNull
12  * @description check null
13  * @param {String} value
14  */
15function gfn_isNull(value) {
16    if (value === "" || value === null || value === undefined || (value !== null && typeof value == "object" && !Object.keys(value).length)) {
17        return true;
18    }  else {
19        return false;
20    }
21}
22
23
24/*
25 * @method gfn_isIe
26 * @description ie check
27 * @param null
28 */
29function gfn_isIe() {
30    var _ua = navigator.userAgent;
31    var rv = -1;
32
33    //IE 11,10,9,8
34    var trident = _ua.match(/Trident\/(\d.\d)/i);
35    if( trident != null )
36    {
37        if( trident[1] === "7.0" ) return true;
38        if( trident[1] === "6.0" ) return true;
39        if( trident[1] === "5.0" ) return true;
40        if( trident[1] === "4.0" ) return true;
41    }
42
43    //IE 7...
44    if( navigator.appName === 'Microsoft Internet Explorer' ) return true;
45
46    //other
47    var agt = _ua.toLowerCase();
48    if (agt.indexOf("chrome") !== -1) return false;
49    if (agt.indexOf("opera") !== -1) return false;
50    if (agt.indexOf("staroffice") !== -1) return false;
51    if (agt.indexOf("webtv") !== -1) return false;
52    if (agt.indexOf("beonex") !== -1) return false;
53    if (agt.indexOf("chimera") !== -1) return false;
54    if (agt.indexOf("netpositive") !== -1) return false;
55    if (agt.indexOf("phoenix") !== -1) return false;
56    if (agt.indexOf("firefox") !== -1) return false;
57    if (agt.indexOf("safari") !== -1) return false;
58    if (agt.indexOf("skipstone") !== -1) return false;
59    if (agt.indexOf("netscape") !== -1) return false;
60    if (agt.indexOf("mozilla/5.0") !== -1) return false;
61}
62
63
64/*
65 * @method gfn_setCommCode
66 * @description 공통코드 call
67 * @param {array} codeparam
68 */
69function gfn_setCommCode(codeparam) {
70    var list = [];
71	var bizCd = "";
72
73    $.each(codeparam, function (idx, group) {
74    	list.push(group.gCode);
75        
76        if(group.bizCd) {
77        	bizCd = group.bizCd;
78        }
79        
80    });
81
82    var obj = {
83        url : '/gh/cmn/selectCmnCdDtList.do',
84        param : 'code=' + list + (bizCd ? '&heBizCd=' + bizCd : ''),
85        callback : function (json) {
86            $.each(codeparam, function (idx, param) {
87                var prmCd = param.gCode;
88                gfn_setCommObject(param, json.list[prmCd]);
89            });
90            gfn_afterOnLoad();
91        }
92    };
93    callAjax(obj.url, obj.param, obj.callback);
94}
95
96/*
97 * @method gfn_afterOnLoad
98 * @description 공통코드 호출 후 after처리
99 * @param {array} codeparam
100 */
101function gfn_afterOnLoad() {
102    if (typeof fn_afterOnLoad !== 'undefined') {
103        fn_afterOnLoad();
104    }
105}
106
107
108/*
109 * @method gfn_setCommObject
110 * @description 공통코드 component setting
111 * @param {array} prm, list
112 */
113function gfn_setCommObject(prm, list) {
114    var obj = prm.objId,
115        type = prm.type,
116        selTy = prm.selectType;
117
118    if (list.length > 0) {
119        $(obj).empty();
120
121        // Item 필터링
122        if(prm.item1 !== undefined || prm.item2 !== undefined || prm.item3 !== undefined || prm.item4 !== undefined || prm.item5 !== undefined)	{
123        	for(var itemIdx = Object.keys(list).length-1 ; itemIdx >- 1 ; itemIdx--)	{
124        		var row = list[itemIdx];
125        		var isRemove = false;
126        		
127        		if((list[itemIdx].item1Cn !== prm.item1 && prm.item1 !== undefined)
128                    || (list[itemIdx].item2Cn !== prm.item2 && prm.item2 !== undefined)
129                    || (list[itemIdx].item3Cn !== prm.item3 && prm.item3 !== undefined)
130                    || (list[itemIdx].item4Cn !== prm.item4 && prm.item4 !== undefined)
131                    || (list[itemIdx].item5Cn !== prm.item5 && prm.item5 !== undefined)) {
132        			isRemove = true;
133        		}
134        			
135        		// 2. heBizCd 필터링 (콤마 구분자 처리)
136        		if(prm.bizCd !== undefined && row.item2Cn !== undefined) {
137        			var bizArr = (row.item2Cn || "").split(",");
138        			var hasMatch = false;
139        			
140        			for(var i=0; i <bizArr.length; i++) {
141        				var codeVal = bizArr[i].trim();
142        				
143        				if(codeVal === prm.bizCd || codeVal.indexOf(prm.bizCd + "-") === 0) {
144        					hasMatch = true;
145        					break;
146        				}
147        			}
148        			
149        			// 매칭되는 것이 없으면 삭제
150        			if(!hasMatch) {
151        				isRemove = true;
152        			}
153        		}
154        		
155        		if(isRemove) {
156        			list.splice(itemIdx, 1);
157        		}
158            }
159        }
160
161        switch (type) {
162
163            case 'combo' :
164                if (selTy === 'A') {
165                    $(obj).append('<option value="">전체</option>');
166                } else if (selTy === 'S' || selTy === 'V') {
167                    $(obj).append('<option value="">선택</option>');
168                }
169                $.map(list, function (row) {
170                    var option = '';
171                    if (typeof prm.value !== 'undefined' && row.cmnDtlCd === prm.value) {
172                        option = 'selected';
173                    }
174                    $(obj).append('<option value="'+ row.cmnDtlCd +'" '+ option +'>'+ row.cmnDtlCdNm +'</option>');
175                });
176                break;
177
178            case 'check' :
179                $.map(list, function(row) {
180                    $(obj).append('<span><label><input type="checkbox" name="'+ row.cmnGrupCd +'" value="'+ row.cmnDtlCd +'"/>&nbsp;'+ row.cmnDtlCdNm +'</label></span>&nbsp;');
181                });
182                break;
183
184            case 'radio' :
185                $.map(list, function(row) {
186                    var nm = '', option = '';
187                    if (typeof prm.name !== 'undefined') {
188                        nm = prm.name;
189                    } else {
190                        nm = row.cmnGrupCd;
191                    }
192                    var id = row.cmnGrupCd + '_' + row.cmnDtlCd;
193
194                    if (typeof prm.value !== 'undefined' && row.cmnDtlCd === prm.value) {
195                        option = 'checked';
196                    }
197
198                    $(obj).append('<span><input type="radio" id="'+ id +'" name="'+ nm +'" value="'+ row.cmnDtlCd +'" '+ option +'/>'
199                        + '<label for="'+ id +'">'+ row.cmnDtlCdNm +'</label></span>');
200                });
201
202                if (selTy !== 'V') {
203                    $(obj).find('input:first').prop('checked', true);
204                }
205                break;
206
207            default :
208                break;
209        }
210    }
211}
212
213/*
214* @method gfn_isFrgnRrno
215* @description 주민등록번호(외국등록번호) 뒷자리 성별구분으로 외국인 여부 판별
216* @return boolean
217*/
218function gfn_isFrgnRrno(rrno2) {
219	var gen = String(rrno2).charAt(0);
220	return gen >= '5' && gen <= '8';
221}
222
223
224/*
225* @method gfn_chkRrno
226* @description 주민등록번호 유효성체크(앞자리6, 뒷자리7, 메세지opt[검사대상명칭, 외국인 검사여부])
227* @return boolean
228*/
229function gfn_chkRrno(rrno1, rrno2, opt){
230    var rrn = String(rrno1) + String(rrno2);//주민등록번호 13자리 (ex. 1234567654321)
231    var msg = "";
232    if(!gfn_isNull(opt)) msg += gfn_isNull(opt[0])? "":opt[0]+"의 ";//target
233    msg += '올바른 주민등록번호를 입력하여 주세요.';
234
235    //자릿수 and 숫자 체크
236    if (rrn.length !== 13 || isNaN(rrn)) {
237        alert(msg);
238        return false;
239    }
240
241    var genda = rrno2.substr(0,1) // 성별 1~4
242    var formalYear = (genda < 3) ? '19' : '20' // 연도 계산 - 1 또는 2: 1900년대, 3 또는 4: 2000년대
243    var yyyy = formalYear + rrno1.substr(0,2);
244    var MM = rrno1.substr(2,2);
245    var dd = rrno1.substr(4,2);
246
247    //날짜 유효성 검사
248    //month 검사
249    if( MM<1 || MM>12 ) {
250        alert(msg);
251        return false;
252    }
253    var maxDaysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
254    var maxDay = maxDaysInMonth[MM-1];
255
256    // 윤년 체크
257    if( MM===2 && ( yyyy%4===0 && yyyy%100!==0 || yyyy%400===0 ) ) {
258        maxDay = 29;
259    }
260    //날짜검사
261    if( dd<=0 || dd>maxDay ) {
262        alert(msg);
263        return false;
264    }
265    //외국인 주민등록번호 ㆍ성별:1900년대 남자 "5", 여자 "6"로, 2000년대 남자 "7", 여자 "8"로 주민등록번호와 구분하여 표시
266    if (genda >= 5 && genda <= 8) {
267        //외국인 확인여부 체크(메세지 처리 옵션이 있고, 확인클릭시)
268        if(!gfn_isNull(opt) && opt[1]) {
269            var cmsg = gfn_isNull(opt[0])? "":opt[0]+"의 ";
270            cmsg += "성별구분 주민번호 ["+genda+"]는 외국인 주민등록번호입니다.\n그래도 등록하시겠습니까?";
271            if(confirm(cmsg)){
272                return true;
273            }
274        }else{
275            return true;//외국인은 패턴 유효성 검사X
276        }
277
278        //내국인 주민등록번호 유효성// 성별 1 ~ 4
279    }else if (genda >= 1 && genda <= 4) {
280
281        var n = 2;
282        var sum = 0;
283        for (var i = 0; i < rrno1.length; i++){
284            sum += parseInt(rrno1.substr(i, 1)) * n++;
285        }
286        for (var i = 0; i < rrno2.length - 1; i++) {
287            sum += parseInt(rrno2.substr(i, 1)) * n++;
288            if (n === 10){
289                n = 2;
290            }
291        }
292        var checkSum = 11 - sum % 11;
293        if (checkSum === 11) checkSum = 1;
294        if (checkSum === 10) checkSum = 0;
295        if (checkSum === parseInt(rrno2.substr(6, 1))){
296            return true;
297        }
298
299    }
300    //내외국인 아닐시 및 조건통과 못했을시,
301    alert(msg);
302    return false;
303}
304
305
306/*
307 * @method gfn_calcRrnoToAge
308 * @description 주민등록번호(앞6자리, 뒤7자리)로 만나이 계산
309 * @return 만나이
310 */
311function gfn_calcRrnoToAge(rrno1, rrno2, opt) {
312    var curDateObj = new Date(); // 날짜 Object 생성
313    var curDate = ""; // 현재년월일
314    var curYear = curDateObj.getFullYear(); // 현재년도
315    var curMonth = curDateObj.getMonth() + 1; // 현재월
316    var curDay = curDateObj.getDate(); // 현재일
317
318    var tmpYear = parseInt(rrno1.substring(0, 2)); // 임시년도(생일 년도)
319    var tmpAge = 0; // 임시나이
320    var tmpBirthday = rrno1.substring(2, 6); // 주민번호 4자리 생일문자 추출
321    var genType = rrno2.substring(0, 1); // 주민번호 뒷자리 성별구분 문자 추출
322
323    if(curMonth < 10){ curMonth = "0" + curMonth; }// 현재 월이 10보다 작을경우 '0' 문자 합한다
324    if(curDay < 10){ curDay = "0" + curDay; }// 현재 일이 10보다 작을경우 '0' 문자 합한다
325    curDate = curYear.toString() + curMonth.toString() + curDay.toString();//현재년월일
326
327    //1900년대 생(5,6외국인)
328    if(genType === "1"|| genType === "2" || genType === "5" || genType === "6") {
329        tmpYear = 1900 + tmpYear;
330        //2000년대 이후 생(7,8외국인)
331    } else if(genType === "3"|| genType === "4" || genType === "7" || genType === "8") {
332        tmpYear = 2000 + tmpYear;
333        //0,9-> 1800년대 생
334    }else{
335        tmpYear = 1800 + tmpYear;
336    }
337
338    //달 (월)기준으로 만나이 계산하기
339    if(opt){
340        //다음달 첫째날짜 구하기
341        var tmpMonth = rrno1.substring(2, 4); // 임시달(생일 달)
342        var tmpDay = rrno1.substring(4, 6); // 임시달(생일 일자)
343        var birthDate = new Date(tmpYear, tmpMonth-1, 1);//날짜는 1일로 date만들기
344
345        birthDate.setMonth(birthDate.getMonth() + 1);//+1달
346        tmpYear = birthDate.getFullYear(); //+1달 처리한 생일의 년도
347        tmpMonth = birthDate.getMonth()+1; // +1달 처리한 생일월
348        tmpDay = birthDate.getDate(); //1일로 초기화된 날짜
349
350        if(tmpMonth < 10){ tmpMonth = "0" + tmpMonth; }// 현재 월이 10보다 작을경우 '0' 문자 합한다
351        if(tmpDay < 10){ tmpDay = "0" + tmpDay; }// 현재 일이 10보다 작을경우 '0' 문자 합한다
352        tmpBirthday = tmpMonth.toString() + tmpDay.toString();//기존 생일의 +1달 의 1일을 기준으로 계산된 월일
353    }
354
355    tmpAge = curYear - tmpYear;//년도로 나이계산
356
357    //생일이 지나지 않았으면 -1살 처리
358    if(curDate < Number(curYear.toString() + tmpBirthday.toString()) ) {
359        tmpAge += -1;
360    }
361    return tmpAge;
362}
363
364
365
366/*
367 * @method gfn_retLocParam
368 * @description 파라미터 스트링 값 생성
369 * @return param
370 */
371function gfn_retLocParam(param) {
372    if (String(param).length === 0 && typeof param === undefined) {
373        return "";
374    }
375
376    var arrLocParam = param.replace(/(\s*)/g, "").split(",");
377    var strRetValue = "";
378
379    arrLocParam.forEach(function (item, index) {
380        var prm = encodeURIComponent($("#"+item).val()) === 'null' ? '' : encodeURIComponent($("#"+item).val());
381        if(index === 0){
382            strRetValue += "?"+ item +"="+ prm;
383        }else{
384            strRetValue += "&"+ item +"="+ prm;
385        }
386    });
387    return strRetValue;
388}
389
390
391/*
392 * @method gfn_saveStfInfo
393 * @description 만족도 평가
394 * @param null
395 */
396function gfn_saveStfInfo() {
397    if (!$('#stfFrm').find('input[name="stfchrtPnt"]').is(':checked')) {
398        alert('평점을 선택하세요.');
399        return false;
400    }
401    if ($('#stfchrtOpinCn').val().getByte() > 3000) {
402        alert('기타의견은 1000자 이상 등록할 수 없습니다.');
403        return false;
404    }
405    var obj = {
406        url : "/gh/cmn/savePgeStfInfo.do",
407        param : $('#stfFrm').serialize(),
408        callback : function (json) {
409            if (json.cnt > 0) {
410                alert('평가가 전송되었습니다.');
411                //초기화
412                $('#stfFrm').find('input[name="stfchrtPnt"]').prop('checked', false);
413                $('#stfFrm').find('input[name="stfchrtOpinCn"]').val('');
414            }
415        }
416    }
417    if (typeof obj !== 'undefined') {
418        callAjax(obj.url, obj.param, obj.callback);
419    }
420}
421
422/*
423 * @method gfn_readCnt
424 * @description 조회수 증가
425 * @param null
426 */
427function gfn_readCnt(id, no) {
428    if (!no.isEmpty()) {
429        var obj = {
430            url : "/gh/cmn/saveBbsSrchCntInfo.do",
431            param : {bbsId : id, bbsNo : no},
432            callback : function (json) {}
433        }
434        if (typeof obj !== 'undefined') {
435            callAjax(obj.url, obj.param, obj.callback);
436        }
437    }
438}
439
440/*
441 * @method keyUpTel
442 * @description 전화번호 keyup
443 * @param null
444 */
445$.fn.keyUpTel = function () {
446    $(this).attr("maxlength", "13");
447
448    $(this).on('keyup', function(e) {
449        var v = gfn_addHypenPno($(this).val().korEx().engEx().trim());
450        if (v.length > 14) v = v.substring(0,13);//15자리 이상 넘을시 substring
451
452        $(this).val(v);
453        // 서울 지역번호(02)가 들어가는 경우 1을 삽입
454        if(v.substring(0, 2).indexOf('02') == 0) {
455            if($(this).attr("maxlength") != "12")
456                $(this).attr("maxlength", "12");
457        }else{
458            if($(this).attr("maxlength") != "13")
459                $(this).attr("maxlength", "13");
460        }
461    });
462}
463
464/*
465 * @method gfn_addHypenPno
466 * @description 전화번호 setting
467 * @param null
468 */
469function gfn_addHypenPno(number){
470    number = number.replace(/[^0-9]/gi, '');
471    var tel = "";
472
473    // 서울이라는 변수를 선언
474    var seoul = 0;
475
476    // 서울 지역번호(02)가 들어가는 경우 1을 삽입
477    if(number.substring(0, 2).indexOf('02') == 0) {
478        seoul = 1;
479        // if($(this).attr("maxlength") != "12")
480        //  	$(this).attr("maxlength", "12");
481    }else{
482        //if($(this).attr("maxlength") != "13")
483        //	$(this).attr("maxlength", "13");
484    }
485
486    // 문자열을 자르는 기준에서 서울의 값을 뺄쌤(-)한다.
487    // 값이 1일경우 -1이 될것이고, 값이 0일경우 변화가 없다.
488    if(number.length < (4-seoul)) {
489        return number;
490    } else if(number.length < (7-seoul)) {
491        tel += number.substr(0, (3-seoul ));
492        tel += "-";
493        tel += number.substr(3-seoul);
494    } else if(number.length < (11-seoul)) {
495        tel += number.substr(0, (3-seoul));
496        tel += "-";
497        tel += number.substr((3-seoul), 3);
498        tel += "-";
499        tel += number.substr(6-seoul );
500    } else {
501        tel += number.substr(0, (3-seoul));
502        tel += "-";
503        tel += number.substr((3-seoul), 4);
504        tel += "-";
505        tel += number.substr(7-seoul );
506    }
507    return tel;
508}
509
510
511/*
512 * @method gfn_openAddr
513 * @description open addrPop
514 */
515function gfn_openAddr(obj, appFlg) {
516    tgObj = $(obj);
517    gfn_addrPopup(appFlg);
518}
519
520/*
521 * @method gfn_openAddrApi
522 * @description open addrLayerPop
523 * 주소Api 검색 레이어 팝업 호출
524 */
525function gfn_openAddrApi(obj, addrFlg) {
526    tgObj = $(obj);
527    var prm = {menuId : $('#menuId').val(), addrFlg : addrFlg}
528    gfn_openLyPop('700', '/gh/cmm/addrSrchApiP.do', obj, prm);
529}
530
531/*
532 * @method gfn_addrPopup
533 * @description popup return object
534 * 주소선택 시 fn_addrCallBack(zipRoad) 호출
535 */
536function gfn_addrPopup(appFlg) {
537   /*
538    zipRoad.roadFullAddr	// 전체도로명주소
539    zipRoad.roadAddrPart1	// 도로명주소(참고항목제외)
540    zipRoad.roadAddrPart2	// 도로명주소참고항목
541    zipRoad.jibunAddr	    // 지번정보
542    zipRoad.engAddr	        // 도로명주소(영문)
543    zipRoad.zipNo	        // 우편번호
544    zipRoad.admCd	        // 행정구역코드
545    zipRoad.rnMgtSn	        // 도로명코드
546    zipRoad.bdMgtSn	        // 건물관리번호
547    zipRoad.addrDetail	    // 고객입력상세주소
548    zipRoad.detBdNmList	    // 상세건물명
549    zipRoad.bdNm	        // 건물명
550    zipRoad.bdKdcd	        // 공동주택여부 (1:공동주택, 0:비공동주택)
551    zipRoad.siNm	        // 시도명
552    zipRoad.sggNm	        // 시군구명
553    zipRoad.emdNm	        // 읍면동명
554    zipRoad.liNm	        // 법정리명
555    zipRoad.rn	            // 도로명
556    zipRoad.udrtYn	        // 지하여부 (0:지상 ,1:지하)
557    zipRoad.buldMnnm	    // 건물본번
558    zipRoad.buldSlno	    // 건물부번 (부번이없는경우0)
559    zipRoad.mtYn	        // 산여부 (0:대지, 1:산)
560    zipRoad.lnbrMnnm	    // 지번본번(번지)
561    zipRoad.lnbrSlno	    // 지번부번(호 )(부번이없는경우0)
562    zipRoad.emdNo	        // 읍면동일련번호
563    */
564    //document.domain = "e-health.go.kr";
565    //document.domain = "127.0.0.1";
566
567    var flg = 'P';
568    if (gfn_isMobile()) {
569        flg = 'M'; // 모바일
570    }
571
572    var width = 570;
573    var height = 420;
574
575    //Fixes dual-screen position					Most Browsers       Firefox
576    var dualLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left;
577    var dualTop	= window.screenTop !== undefined ? window.screenTop : screen.top;
578
579    var _width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
580    var _height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
581
582    var left = ((_width / 2) - (width / 2)) + dualLeft;
583    var top = ((_height / 2) - (height / 2)) + dualTop;
584
585    var specs = "scrollbars=yes, resizable=yes, left=" + left;
586    specs += ", top=" + top;
587    specs += ", width=" + width;
588    specs += ", height=" + height;
589
590    if (flg === 'M') {
591        specs = 'scrollbars=yes, resizable=yes';
592    }
593    window.open("/gh/cmm/addrSrchP.do?appFlg="+ appFlg +"&flg=" + flg,"addrPop", specs);
594}
595/*
596 * @method gfn_isMobile
597 * @description 모바일 접속여부
598 */
599function gfn_isMobile() {
600	var rslt = false;
601	if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){
602		rslt = true;
603	}else{
604		if(navigator.maxTouchPoints == '5'){ //아이패드 일때 모바일로 인식하게끔 (동시터치수 = 5)
605			rslt = true; 
606		}
607	}
608    return rslt;
609}
610
611/*
612 * @method gfn_isIos
613 * @description ios 접속여부
614 */ 
615function gfn_isIos() {
616	return /iPad|iPhone|iPod/.test(navigator.userAgent) ||
617			(navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1);
618}
619
620/*
621 * @method gfn_isIos
622 * @description ios 접속여부
623 */ 
624function gfn_isIosChrome() {
625	return gfn_isIos() && /CriOS/i.test(navigator.userAgent);
626}
627
628
629var lyBeObj = {}; // layer 팝업 호출 전 대상 obj
630/*
631 * @method gfn_openLyPop
632 * @description layer 팝업 호출
633 */
634function gfn_openLyPop(width, url, obj, param) {
635
636    var wid = width == null ? '_600' : width == '000' ? '' : '_'+width;
637    var ly_in_cls = width == '000' ? 'ly_in_pos' : '';
638    var prm = param ? param : {};
639
640    if ($('body > div:last').is('#layerPop') === false) {
641        $('<div id="layerPop" class="dark active" tabindex="0" >' +
642            '<div class="ly_wrap wid'+ wid +'"><div class="ly_in '+ly_in_cls+'"><div class="ly_box">' +
643            '</div></div></div></div>').insertAfter('body > div:last');
644
645        $('.ly_box').load(url, prm, function (json, status, xhr) {
646            // 민원서비스 session TimeOut 설정
647            if (xhr.responseText.indexOf("rsMsg") > -1) {
648                var data = JSON.parse(json);
649                if (data.rsMsg.statusCode === "E") {
650                    if (typeof data.msg !== 'undefined') {
651                        alert(data.msg);
652                        $('.ly_box').remove();
653                        location.href = data.Referer;
654                    }
655                }
656            }
657        });
658    }
659
660    $('#layerPop').focus();
661    lyBeObj = obj;
662}
663
664
665/*
666 * @method gfn_popClose
667 * @description layer 팝업 종료
668 */
669function gfn_popClose() {
670	
671    $('#layerPop').remove();
672    
673    if (typeof lyBeObj !== 'undefined') {
674        lyBeObj.focus();
675        lyBeObj = {}; // layer obj 초기화
676    }
677}
678
679//메인 팝업창 오픈
680function fn_openImsiPopup(pLocation, pName, pWidth, pHeight) {
681	var minWidth  = 1500;	// 최소 팝업 넓이
682	var minHeight = 900;	// 최소 팝업 높이
683
684	var nWidth  = pWidth;
685	var nHeight = pHeight;
686
687	if(nWidth === 'null' || nWidth === undefined || nWidth === '' || Number(nWidth) < minWidth)	{
688		nWidth = minWidth;
689	}
690	if(nHeight === 'null' || nHeight === undefined || nHeight === '' || Number(nHeight) < minHeight) {
691		nHeight = minHeight;
692	}
693
694	// 듀얼 모니터 고려한 윈도우 띄우기
695	var curX = window.screenLeft;
696	var curY = window.screenTop;
697	var curWidth = document.body.clientWidth;
698	var curHeight = document.body.clientHeight;
699
700	//var nLeft = curX + (curWidth / 2) - (nWidth / 2);
701	//var nTop = curY + (curHeight / 2) - (nHeight / 2);
702
703	var nLeft = curX + (curWidth / 2) - (nWidth / 2);
704	var nTop  = 50;
705
706	var strOption = "";
707	strOption += "left=" + nLeft + "px,";
708	strOption += "top=" + nTop + "px,";
709	strOption += "width=" + nWidth + "px,";
710	strOption += "height=" + nHeight + "px,";
711	strOption += "toolbar=no,menubar=no,location=no,";
712	strOption += "resizable=yes,status=no,scrollbars=yes";
713
714	var winObj = window.open(pLocation, pName, strOption);
715	if (winObj == null) {
716		return true;
717	}
718}
719
720
721/*
722 * @method gfn_layerFocus
723 * @description layer 첫번째 요소로 focus 이동
724 */
725function gfn_layerFocus() {
726    var lpObjTabable = $('#layerPop').find('button, input:not([type="hidden"]), select, iframe, textarea, [href], [tabindex]:not
726([tabindex="-1"])');
727    lpObjTabable.first().focus();
728}
729
730
731/*
732 * @method gfn_beforeForm
733 * @description 변경전 값 setting
734 * @param {form} obj
735 */
736function gfn_beforeForm(obj) {
737    return $(obj).serialize();
738}
739
740/*
741 * @method gfn_setFileTxt
742 * @description file txt setting
743 * @param {form} obj
744 */
745function gfn_setFileTxt(obj) {
746    var file = '';
747    var thum = '';
748    if ($(obj).find('#fileInfo_list').length > 0) {
749        file = $('#fileInfo_list').find('.MultiFile-title').text();
750    }
751    return file + thum;
752}
753
754
755/*
756 * @method gfn_setRadio
757 * @description 체크박스 하나만 선택
758 * @param {object} obj - chkeckbox
759 */
760function gfn_setRadio(obj) {
761    $(obj).on('click',function() {
762        if($(this).prop('checked')) {
763            $(obj).prop('checked', false);
764            $(this).prop('checked', true);
765        }
766    });
767}
768/*
769* @method gfn_setRadioT
770* @description 제목클릭하여 체크박스 선택
771* @param {object} obj - chkeckbox
772*/
773function gfn_setRadioT(obj) {
774    $(obj).closest('tbody').find('input[type="checkbox"]').prop("checked", false);
775    $(obj).closest('tr').find('input[type="checkbox"]').prop("checked", true);
776}
777
778
779/*
780 * @method gfn_chkAgree
781 * @description 정보 동의 확인
782 */
783function gfn_chkAgree() {
784    var cnt = 0;
785    $.each($('input[class^="agrY"]'), function (i, obj) {
786        if (!$(obj).is(':checked')) {
787            alert($('.pageNm').text() + '를(을) 위하여 안내사항에 동의해 주시기 바랍니다.');
788            $(obj).focus();
789            cnt++;
790            return false;
791        }
792    });
793    return cnt;
794}
795
796
797/*
798 * @method gfn_setFocus
799 * @description focus on
800 * @param obj
801 */
802function gfn_setFocus(obj) {
803    setTimeout(function() {
804        $(obj).focus();
805    });
806}
807
808/*
809 * @method gfn_getPage
810 * @description json으로 전달받은 페이지 정보 html로 리턴
811 * @return paging
812 */
813function gfn_getPage(obj, page, func, prm) {
814    $(obj).children().remove(); //paging 초기화
815
816    var firstPageNo = page.firstPageNo;
817    var firstPageNoOnPageList = page.firstPageNoOnPageList;
818    var totalPageCount = page.totalPageCount;
819    var pageSize = page.pageSize;
820    var lastPageNoOnPageList = page.lastPageNoOnPageList;
821    var currentPageNo = page.currentPageNo;
822    var lastPageNo = page.lastPageNo;
823    var minusPageNo = page.currentPageNo - 1;
824    var plusPageNo = page.currentPageNo + 1;
825
826    var fnSrc = 'fn_search('
827    if (typeof func !== 'undefined') {
828        fnSrc = func;
829    }
830    if (typeof prm !== 'undefined') {
831        fnSrc += '("' + prm.prm1 + '", ';
832    }
833
834    var strPage = "";
835    if (firstPageNoOnPageList > pageSize) {
836        strPage += "<a href='#' class='fir' title='처음' onclick='"+ fnSrc +"1); return false;'>처음</a>";
837        strPage += "<a href='#' class='prev mobile_none' title='이전' onclick='"+ fnSrc + (firstPageNoOnPageList-1)  +"); return false;' >이전</a>";
838        strPage += "<a href='#' class='prev mobile_view' title='이전' onclick='"+ fnSrc + minusPageNo +"); return false;'>" + "이전</a>";
839    } else {
840        strPage += "<a href='#' class='fir' title='처음' onclick='"+ fnSrc + firstPageNo +"); return false;'>처음</a>";
841        strPage += "<a href='#' class='prev mobile_none' title='이전' onclick='"+ fnSrc + firstPageNo +"); return false;'>이전</a>";
842        if (currentPageNo === 1){
843            strPage += "<a href='#' class='prev mobile_view' title='이전' onclick='"+ fnSrc + firstPageNo +"); return false;'>" + "이전</a>";
844        }else{
845            strPage += "<a href='#' class='prev mobile_view' title='이전' onclick='"+ fnSrc + minusPageNo +"); return false;'>" + "이전</a>";
846        }
847    }
848
849    for(var i=firstPageNoOnPageList; i<=lastPageNoOnPageList; i++) {
850        if (i === currentPageNo) {
851            strPage += "<span class='on' title='선택된 페이지'>"+ currentPageNo +"</span>";
852        } else {
853            strPage += "<a href='#' class='num' title='"+i+"번째 페이지' onclick='"+ fnSrc + i +"); return false;'>"+ i +"</a>";
854        }
855    }
856
857    if (lastPageNoOnPageList < totalPageCount) {
858        strPage += "<a href='#' class='next mobile_view' title='다음' onclick='"+ fnSrc + plusPageNo +"); return false;'>" + "다음</a>";
859        strPage += "<a href='#' class='next mobile_none' title='다음' onclick='"+ fnSrc + plusPageNo +"); return false;'>다음</a>";
860        strPage += "<a href='#' class='last' title='마지막' onclick='"+ fnSrc + lastPageNo +"); return false;'>마지막</a>";
861    } else {
862        if (currentPageNo === lastPageNo){
863            strPage += "<a href='#' class='next mobile_view' title='다음' onclick='"+ fnSrc + lastPageNo +"); return false;'>" + "다음</a>";
864        } else {
865            strPage += "<a href='#' class='next mobile_view' title='다음' onclick='"+ fnSrc + plusPageNo +"); return false;'>" + "다음</a>";
866        }
867        strPage += "<a href='#' class='next mobile_none' title='다음' onclick='"+ fnSrc + lastPageNo +"); return false;'>다음</a>";
868        strPage += "<a href='#' class='last' title='마지막' onclick='"+ fnSrc + lastPageNo +"); return false;'>마지막</a>";
869    }
870    $(obj).append(strPage);
871}
872
873
874/*
875 * @method gfn_setPage
876 * @description json으로 전달받은 페이지 정보 html로 리턴
877 * @return paging
878 */
879function gfn_setPage(obj, page, func) {
880    $(obj).children().remove(); //paging 초기화
881
882    var curPage = page.curPage;
883    var totalPages = page.totalPages;
884
885    var fnSrc = 'fn_search'
886    if (typeof func !== 'undefined') {
887        fnSrc = func;
888    }
889
890    var strPage = '';
891    var pageLimit = 5;
892    var startPage = parseInt((curPage - 1) / pageLimit) * pageLimit + 1;
893    var endPage = startPage + pageLimit - 1;
894
895    if (totalPages < endPage) {
896        endPage = totalPages;
897    }
898
899    // 처음, 이전
900    strPage += "<a href='#' class='fir' title='처음' onclick='"+ fnSrc +"(1); return false;'>처음</a>";
901    strPage += "<a href='#' class='prev mobile_none' title='이전' onclick='"+ fnSrc +"("+ (curPage-1 === 0 ? 1 : curPage-1) +"); return false;'>이전</a>";
902    if (curPage === 1){
903        strPage += "<a href='#' class='prev mobile_view' title='이전' onclick='"+ fnSrc +"(1); return false;'>" + "이전</a>";
904    } else {
905        strPage += "<a href='#' class='prev mobile_view' title='이전' onclick='"+ fnSrc +"("+ (curPage-1) +"); return false;'>" + "이전</a>";
906    }
907
908    // pageLimit 맞게 페이지 노출
909    for(var i=startPage; i<=endPage; i++) {
910        if (i === curPage) {
911            strPage += "<span class='on' title='현재 페이지'>"+ i +"</span>";
912        } else {
913            strPage += "<a href='#' class='num' title='"+i+"번째 페이지' onclick='"+ fnSrc +"("+ i +"); return false;'>"+ i +"</a>";
914        }
915    }
916
917    // 다음, 마지막
918    if (curPage === totalPages){
919        strPage += "<a href='#' class='next mobile_view' title='다음' onclick='"+ fnSrc +"("+ totalPages +"); return false;'>" + "다음</a>";
920    } else {
921        strPage += "<a href='#' class='next mobile_view' title='다음' onclick='"+ fnSrc +"("+ (curPage+1) +"); return false;'>" + "다음</a>";
922    }
923    strPage += "<a href='#' class='next mobile_none' title='다음' onclick='"+ fnSrc +"("+ (curPage+1 < totalPages ? curPage+1 : totalPages) +"); return false;'>다음</a>";
924    strPage += "<a href='#' class='last' title='마지막' onclick='"+ fnSrc +"("+ totalPages +"); return false;'>마지막</a>";
925
926    $(obj).append(strPage);
927}
928
929/*
930* @method gfn_logout
931* @description 로그아웃(세션out)
932*/
933function gfn_logout() {
934    var obj = {
935        url : '/gh/caSrvc/sessionOut.do',
936        param : {menuId : $('#menuId').val()},
937        callback : function () {
938            sessionStorage.clear();
939        }
940    }
941    if (typeof obj !== 'undefined') {
942        callAjax(obj.url, obj.param, obj.callback);
943    }
944}
945
946/*
947* @method gfn_connFileInfo
948* @description 연계를 통한 파일 수신
949*/
950function gfn_connFileInfo(docId, flSn) {
951    var obj = {
952        url : '/gh/caSrvc/selectConnFileInfo.do',
953        param : {docId : docId ,flSn : flSn},
954        callback : function (json) {
955            if (json.result.docId !== '' && json.result.rtnMsg === '') {
956                gfn_connFileDown(json.result.docId); // 문서 다운
957            } else {
958                if (json.result.rtnMsg !== '') {
959                    alert(json.result.rtnMsg);
960                }
961            }
962        }
963    }
964    if (typeof obj !== 'undefined') {
965        callAjax(obj.url, obj.param, obj.callback);
966    }
967}
968
969function gfn_openPdfFile(pdfObj, fNm){
970
971	if(gfn_isIosChrome()){
972		const pdfDataUri = pdfObj.output('datauristring');
973		const link = document.createElement('a');
974		
975		link.href = pdfDataUri;
976		link.download = fNm;
977		
978		document.body.appendChild(link);
979		link.click();
980		document.body.removeChild(link);
981		
982	}else {
983		const blobData = pdfObj.output('blob');
984		const pdfUrl = URL.createObjectURL(blobData);
985		
986		if(gfn_isIos()){
987			window.location.href = pdfUrl;
988		}else{
989			const link = document.createElement('a');
990			link.href = pdfUrl;
991			link.download = fNm;
992			
993			document.body.appendChild(link);
994			link.click();
995			document.body.removeChild(link);
996		}
997	}
998}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.