PageSourceSearch

https://nl.go.kr/resource/templete/nl/js/layout.js?v=2026092405

js nl.go.kr collected 2026-09-24 08:50:53 UTC 88,072 bytes, 2,647 lines download raw bytes

1"use strict";
2$(function(){
3    $(window).scroll(function(){  //스크롤하면 아래 코드 실행
4      if ($(window).width() > 767){
5          var num = $(this).scrollTop();  // 스크롤값
6          if( num > $("#popupWin").outerHeight() + $("#header__inner-top").outerHeight() + $("#main_search").outerHeight()){  // 스크롤을 36이상 했을 때
7            $(".header__inner-bottom").addClass("fixed_gnb");
8          }else{
9            $(".header__inner-bottom").removeClass("fixed_gnb");
10          }
11      }
12    });
13  });
14/** 디바이스 타입 데스크탑 */
15var DEVICE_TYPE_DESKTOP = "DEVICE_TYPE_DESKTOP";
16/** 디바이스 타입 테블릿 */
17var DEVICE_TYPE_TABLET = "DEVICE_TYPE_TABLET";
18/** 디바이스 타입 모바일 */
19var DEVICE_TYPE_MOBILE = "DEVICE_TYPE_MOBILE";
20
21/** 데스크탑 최소값 null */
22var DEVICE_MIN_POINT_DESKTOP = null;
23/** 테블릿 최대값 1230 */
24var DEVICE_MAX_POINT_TABLET = 1230;
25/** 모바일 최대값 767 */
26var DEVICE_MAX_POINT_MOBILE = 767;
27
28/** 메인 페이지 전용 클래스네임 */
29var PAGE_CLASS_MAIN = ".main";
30/** 서브 페이지 전용 클래스네임 */
31var PAGE_CLASS_SUB = ".sub";
32
33/** 스크롤 막을 때 사용하는 클래스네임 */
34var NO_SCROLL_CLASS_NAME = "no_scroll";
35/** 숨김요소가 있을때 사용하는 클래스네임 */
36var NO_VIEW_CLASS_NAME = "no_view";
37
38/** 접근성을 위한 속성명 */
39var A11Y = {
40  EXPANDED: "aria-expanded"
41};
42
43/** 커스텀이벤트 네임스페이스 */
44var EVENT = {
45  ON_CHANGE_DOM_SIZE: "EVENT_ON_CHANGE_DOM_SIZE",
46  EXPANDED_ALLMENU: "EVENT_EXPANDED_ALLMENU",
47  COLLAPSED_ALLMENU: "EVENT_COLLAPSED_ALLMENU"
48};
49
50/** jQuery.Object window */
51var $win = $(window);
52/** jQuery.Object document */
53var $doc = $(document);
54/** jQuery.Object html */
55var $html = $("html");
56
57/** 글로벌 속성 */
58
59var globalAttr = {
60  /** 전체 스크롤이 막혀있는가? */
61  isDisablScroll: false,
62  /** 디바이스 타입? 데스크탑 || 테블릿 || 모바일 */
63  deviceType: "",
64  /** 페이지 타입? 메인 || 서브*/
65  pageType: ""
66};
67
68/*************************************************************************************
69 공통 기능 및 공통 설정을 위한 객체
70**************************************************************************************/
71var commons = {
72  /**
73   * 공통 설정
74   */
75  init: function() {
76    this.reset();
77    $win.on("resize.commons", $.proxy(this.reset, this));
78  },
79  /**
80   * 사이즈가 변경될때 마다 기본설정값을 다시 세팅
81   */
82  reset: function() {
83    this.setDeviceType();
84    this.setPageType();
85  },
86  /**
87   * 커스텀 이벤트 등록과 trigger 메소드 제공
88   */
89  event: (function() {
90    var events = {};
91
92    function forEachEmitFunction(functions, eventName, eventData) {
93      for (var i = 0; i < functions.length; i++) {
94        functions[i](eventData, eventName);
95      }
96    }
97
98    return {
99      /**
100       * 이벤트 등록
101       * @param {Strign} eventName 이벤트 이름
102       * @param {Function} action 등록할 이벤트 핸들러
103       */
104      listener: function(eventName, action) {
105        if (typeof action === "function") {
106          if (events[eventName] === undefined) {
107            events[eventName] = [];
108          }
109
110          events[eventName].push(action);
111        }
112      },
113      /**
114       * 이벤트 실행
115       * @param {Strign} eventName 이벤트 이름
116       * @param {Object} eventData 이벤트 데이터
117       */
118      trigger: function(eventName, eventData) {
119        events[eventName] &&
120          forEachEmitFunction(events[eventName], eventName, eventData);
121      }
122    };
123  })(),
124  /**
125   * 현재 전체 스크롤이 비활성화되어 있는지 true/false를 반환한다.
126   */
127  getDisablScrollStat: function() {
128    return globalAttr.isDisablScroll;
129  },
130  /**
131   * 전체 스크롤을 활성화한다.
132   */
133  enabledScroll: function() {
134    $html.removeClass(NO_SCROLL_CLASS_NAME);
135    globalAttr.isDisablScroll = false;
136  },
137  /**
138   * 전체 스크롤을 비활성화한다.
139   */
140  disabledScroll: function() {
141    $html.addClass(NO_SCROLL_CLASS_NAME);
142    globalAttr.isDisablScroll = true;
143  },
144
145  /**
146   * 전체 숨김 활성화한다
147   */
148  enabledView: function() {
149    $html.removeClass(NO_VIEW_CLASS_NAME);
150  },
151  /**
152   * 전체 숨김 비활성화한다
153   */
154  disabledView: function() {
155    $html.addClass(NO_VIEW_CLASS_NAME);
156  },
157  /**
158   * 현재 디바이스 타입을 반환한다.
159   * @return {String} DEVICE_TYPE_DESKTOP || DEVICE_TYPE_TABLET || DEVICE_TYPE_MOBILE
160   */
161  getDeviceType: function() {
162    return globalAttr.deviceType;
163  },
164  /**
165   * 디바이스 타입을 체크하여 모바일/테블릿/데스크탑 3가지로 구분하여 해당값을
166   * globalAttr.deviceType에 저장한다.
167   */
168  setDeviceType: function() {
169    var windowWidth = $win.outerWidth();
170
171    if (windowWidth <= DEVICE_MAX_POINT_MOBILE) {
172      globalAttr.deviceType = DEVICE_TYPE_MOBILE;
173    } else if (windowWidth <= DEVICE_MAX_POINT_TABLET) {
174      globalAttr.deviceType = DEVICE_TYPE_TABLET;
175    } else {
176      globalAttr.deviceType = DEVICE_TYPE_DESKTOP;
177    }
178  },
179  /**
180   * 현재 페이지 타입을 구한다.
181   * @reutn {String} PAGE_CLASS_MAIN || PAGE_CLASS_SUB
182   */
183  getPageType: function() {
184    return globalAttr.pageType;
185  },
186  /**
187   * 현재 페이지 타입 설정 한다.
188   * @return {String} PAGE_CLASS_MAIN || PAGE_CLASS_SUB
189   */
190  setPageType: function() {
191    var hasMainClassName = $html.find(PAGE_CLASS_MAIN).length;
192
193    globalAttr.pageType = hasMainClassName ? PAGE_CLASS_MAIN : PAGE_CLASS_SUB;
194  }
195};
196
197/*************************************************************************************
198 헤더 고정 스크립트
199**************************************************************************************/
200var stickyHeader = {
201  init: function() {
202    // 필요한 객체 선택
203    this.$popupWin = $(".banner__notice-wrap");
204    this.$container = $(".header-wrap");
205    this.$header = this.$container.find(".header");
206    this.$headsearch = $(".wide-search-wrap");
207    this.$headerBottom = this.$container.find(".header__inner-bottom");
208    this.$headerUtility = this.$container.find(".header__utility");
209    this.setFixedElement();
210    this.setPhysical();
211    this.controller(); // 초기 로드시 스크롤위치가 0이 아닐수 있기때문에 고정/고정해제할지 체크
212    this.deviceType = commons.getDeviceType();
213
214    //이벤트 바인드
215    $win.on("resize.stickyHeader", $.proxy(this.reset, this));
216    $win.on("scroll.stickyHeader", $.proxy(this.controller, this));
217
218    //커스텀 이벤트 등록
219    commons.event.listener(EVENT.ON_CHANGE_DOM_SIZE, $.proxy(this.reset, this));
220  },
221  isChangeDeviceType: function () {
222    if (this.deviceType !== commons.getDeviceType()) {
223      this.deviceType = commons.getDeviceType();
224
225      return true;
226    }
227    return false;
228  },
229  /** 고정되어야 하는 DOM 요소 설정 */
230  setFixedElement: function() {
231    var isMainDesktop = this.isMainDesktop();
232
233    if ($(window).width() < 767) {
234        this.$fixedElementWrapper = isMainDesktop ? this.$header : this.$container;
235        this.$fixedElement = isMainDesktop ? this.$headerBottom : this.$header;
236    } else {
237        this.$fixedElementWrapper = isMainDesktop ? this.$headsearch : this.$container;
238        this.$fixedElement = isMainDesktop ? this.$headerBottom : this.$headsearch;
239    }
240  },
241  /** 고정이 시작되는 posY 위치값과 고정되었을때 헤더에 적용되어야하는 padding 값을 구한다. */
242  setPhysical: function() {
243    this.fixedPosY = this.$container.outerHeight() - this.$fixedElement.outerHeight() + this.$popupWin.outerHeight() + $("#main_search").outerHeight();
244    this.bufferValue = this.$fixedElement.outerHeight();
245  },
246  /** 현재 페이지가  PC형태의 메인페이지 여부를 반환 */
247  isMainDesktop: function () {
248    var isMain = commons.getPageType() === PAGE_CLASS_MAIN;
249    var isMobile = commons.getDeviceType() === DEVICE_TYPE_MOBILE;
250    return isMain && !isMobile;
251  },
252  /** 화면 사이즈가 변경되었을때 */
253  reset: function() {
254    if (this.isChangeDeviceType()) {
255      this.detach();
256    }
257
258    this.setFixedElement();
259    this.setPhysical();
260    this.controller();
261  },
262  /** 현재 스크롤 위치값을 확인하여 헤더가 고정되어야 하는지 아닌지를 결정한다 */
263  controller: function() {
264    var scroll = 0;
265    var scrollTop = $win.scrollTop();
266    if ($(window).width() < 767) {
267      scroll=0;
268    } else {
269      scroll = this.fixedPosY;
270    }
271    scrollTop > scroll? this.attach() : this.detach();
272  },
273  /** 헤더를 상단에 고정한다. */
274  attach: function() {
275    this.$container.parents().find('.sub').addClass('sub_fixed');
276    this.$container.parents().find('.main').addClass('main_fixed');
277   // this.$fixedElementWrapper.css({ paddingBottom: this.bufferValue });
278    //this.$fixedElement.css({ position: "fixed", top: 0 });
279    //this.$fixedElement.css({ position: "fixed", top: 0, borderBottom: "1px solid #ddd"});
280      //this.$fixedElement.addClass('is_fixed_hd');
281    this.isAttach = false;
282  },
283  /** 고정되어 있는 헤더를 해제한다. */
284  detach: function() {
285    this.$container.parents().find('.sub').removeClass('sub_fixed');
286    this.$container.parents().find('.main').removeClass('main_fixed');
287    this.$fixedElementWrapper.removeAttr("style");
288   // this.$fixedElement.removeAttr("style");
289    //this.$container.parents().find('.header').removeClass('is_fixed_hd');
290    //this.$fixedElement.removeClass("is_fixed_hd");
291    this.isAttach = false;
292  },
293  /**
294   * 고정된 해더가 요소의 높이값을 반환한다.
295   * @public
296   */
297  getHeaderHeight: function() {
298    return this.isAttach
299      ? this.$fixedElement.outerHeight()
300      : this.$container.outerHeight() - $win.scrollTop();
301  },
302
303  /** 기본 헤더의 고정 상태 */
304  isAttach: true
305};
306
307/*************************************************************************************
308 최상단 배너 스크립트
309**************************************************************************************/
310var noticeBanner = {
311  init: function() {
312    this.speed = 300;
313
314    // 필요한 객체 선택
315    this.$container = $(".banner__notice-wrap");
316    this.$content = this.$container.find(".banner__content");
317    this.$toggler = this.$container.find(".banner__controller button");
318
319    // 버튼에 초기 값 변경
320    this.isExpanded ? this.expanded(0) : this.collapsed(0);
321
322    // 이벤트 바인드
323    this.$toggler.on("click", $.proxy(this.controller, this));
324  },
325  /** 현재 배너 상태에 따라 배너를 열고/닫을지 결정한다 */
326  controller: function(e) {
327    e.preventDefault();
328    var isExpand = this.$toggler.attr(A11Y.EXPANDED) === "true";
329    isExpand ? this.collapsed() : this.expanded();
330  },
331  /** 배너를 확장시킨다. */
332  expanded: function(speed) {
333    // 파라미터로 스피드 값이 없으면 디폴트 스피드 적용
334    var speed = speed === undefined ? this.speed : 0;
335
336    // 배너 확장
337    this.$content.stop().slideDown(
338      speed,
339      $.proxy(function() {
340        // 배너가 확장되고 실행할 코드들...
341        this.isExpanded = true; // 현재 축소여부 변경
342        this.$toggler.attr(A11Y.EXPANDED, true); // 버튼 아리아 속성값 변경
343        this.$content.attr("style", "display:block"); // 토글버튼을 연달아 눌렀을 때 이슈 해결용
344        //커스텀 이벤트 실행
345        commons.event.trigger(EVENT.ON_CHANGE_DOM_SIZE);
346      }, this)
347    );
348  },
349  /** 배너를 축소시킨다. */
350  collapsed: function(speed) {
351    // 파라미터로 스피드 값이 없으면 디폴트 스피드 적용
352    var speed = speed === undefined ? this.speed : 0;
353
354    // 배너축소
355    this.$content.stop().slideUp(
356      speed,
357      $.proxy(function() {
358        // 배너가 축소되고 실행할 코드들...
359        this.isExpanded = false; // 현재 축소여부 변경
360        this.$toggler.attr(A11Y.EXPANDED, false); // 버튼 아리아 속성값 변경
361        this.$content.attr("style", "display:none"); // 토글버튼을 연달아 눌렀을 때 이슈 해결용
362        //커스텀 이벤트 실행
363        commons.event.trigger(EVENT.ON_CHANGE_DOM_SIZE);
364      }, this)
365    );
366  },
367
368  /** 기본 상태값 */
369
370  isExpanded: true
371};
372
373/*************************************************************************************
374  GNB 메뉴 열고/닫기 및 세팅
375**************************************************************************************/
376var gnb = {
377  init: function() {
378    this.$container = $(".header");
379    this.$gnbBackground = this.$container.find(".menu_bg");
380    // 원뎁스
381    this.$gnbOneDepthList = this.$container.find(".menu-gnb-depth1");
382    this.$gnbOneDepthItems = this.$container.find(".menu-gnb-depth1__item");
383    this.$gnbOneDepthItemsEv = this.$gnbOneDepthItems.find("a");
384    // 하위 메뉴
385    this.$gnbSubDepthList = this.$container.find(".menu-gnb-depth2");
386    this.$gnbSubDepthItems = this.$container.find(".menu-gnb-depth2__item");
387
388    // gnb 속송값
389    this.activeOneDepthClass = "gnb-depth1--active";
390    this.activeSubDepthClass = "gnb-depth2--active";
391
392    // gnb메뉴 확장활성화 기능 비활성화 여부
393    this.isDisabled = false;
394    // 서브메뉴 높이값 설정
395    this.reset();
396
397    /************ 이벤트 바인드 ************/
398
399    $win.on("resize.gnbResize", $.proxy(this.reset, this));
400    /** GNB전체 닫힘 */
401    this.$gnbOneDepthList.on(
402      "mouseleave focusoutside",
403      $.proxy(this.collapsed, this)
404    );
405    /** GNB메뉴 활성화 && 원뎁스 메뉴 활성화 */
406    this.$gnbOneDepthItemsEv.on(
407      "mouseover focusin",
408      $.proxy(this.expanded, this)
409    );
410    /*this.$gnbOneDepthItems.on(
411      "mouseover focusin",
412      $.proxy(this.expandedOn, this)
413    );*/
414    /** 원뎁스 메뉴 비활성화 */
415    this.$gnbOneDepthItems.on(
416      "mouseleave focusout",
417      $.proxy(this.inactivationOneDepth, this)
418    );
419    /** 서브 메뉴 활성화 */
420    this.$gnbSubDepthItems.on(
421      "mouseover focusin",
422      $.proxy(this.activeSubDepth, this)
423    );
424    /** 서브 메뉴 비활성화 */
425    this.$gnbSubDepthItems.on(
426      "mouseleave focusout",
427      $.proxy(this.inactivationSubDepth, this)
428    );
429
430    /** 커스텀이벤트 리스너 등록 */
431    commons.event.listener(
432      EVENT.EXPANDED_ALLMENU,
433      $.proxy(function() {
434        this.isDisabled = true;
435        this.collapsed();
436      }, this)
437    );
438
439    /** 커스텀이벤트 리스너 등록 */
440    commons.event.listener(
441      EVENT.COLLAPSED_ALLMENU,
442      $.proxy(function() {
443        this.isDisabled = false;
444      }, this)
445    );
446  },
447  /** 화면이 리사이징 될때 마다 하위메뉴 및 배경 높이값을 설정한다 */
448  reset: function() {
449    var mexHeight = 0;
450
451    this.$gnbSubDepthList.removeAttr("style");
452    this.$gnbSubDepthList.each(function(index, el) {
453      mexHeight =
454        mexHeight > $(el).outerHeight() ? mexHeight : $(el).outerHeight();
455    });
456
457    this.$gnbBackground.outerHeight(mexHeight +2);
458    this.$gnbSubDepthList.outerHeight(mexHeight);
459  },
460  /** GNB 메뉴를 활성화 한다. */
461  expanded: function(e) {
462    if (this.isDisabled) return;
463
464    this.activeOneDepth(e);
465    this.$gnbBackground.show();
466    this.$gnbSubDepthList.show();
467    this.isExpanded = true;
468    $(".header__inner-gnb").addClass("active");
469  },
470  expandedOn: function(e) {
471    if (this.isDisabled) return;
472
473    this.activeOneDepth(e);
474  },
475  /** GNB 메뉴를 비활성화 한다. */
476  collapsed: function(e) {
477    this.$gnbBackground.hide();
478    this.$gnbSubDepthList.hide();
479    this.isExpanded = false;
480    $(".header__inner-gnb").removeClass("active");
481  },
482  /** 원뎁스 메뉴를 활성화 한다 */
483  activeOneDepth: function(e) {
484    $(e.currentTarget).closest(".menu-gnb-depth1__item").addClass(this.activeOneDepthClass);
485  },
486  /** 원뎁스 메뉴를 비활성화 한다 */
487  inactivationOneDepth: function(e) {
488    $(e.currentTarget).removeClass(this.activeOneDepthClass);
489  },
490  /** 서브 메뉴를 활성화 한다 */
491  activeSubDepth: function(e) {
492    $(e.currentTarget).addClass(this.activeSubDepthClass);
493  },
494  /** 서브 메뉴를 비활성화 한다 */
495  inactivationSubDepth: function(e) {
496    $(e.currentTarget).removeClass(this.activeSubDepthClass);
497  },
498  /** 기본 상태값 */
499  isExpanded: false
500};
501
502/*************************************************************************************
503  전체 메뉴 열고 닫기(with mobile)
504**************************************************************************************/
505var allMenu = {
506  init: function() {
507    // 기본값 설정
508    this.speed = 500; // 확장축소 속도
509    this.depthOneWrapperSelector = ".menu-all-depth1__item";
510    this.depthOneToggleSelector = ".depth1"; // 1뎁스 메뉴 아이템
511    this.depthOneMenuSelector = ".menu-all-depth1-category"; // 1뎁스 메뉴
512    this.subMenuSelector = "ul";
512 // 2뎁스 이하의 하위메뉴 선택자
513    this.subToggleSelector = ".menu-all-depth1-category .depth"; // 2뎁스 이하 하위 메뉴토글버튼
514    this.scrollInnerSelector = ".menu-all-inner--scroll.scrollbar-outer";
515
516    // 필요한 객체 선택
517    this.$container = $(".menu-tool-wrap");
518    this.$toggler = this.$container.find(".btn-open");
519    this.$closeer = this.$container.find(".btn-close");
520    this.$allMenu = this.$container.find(".menu-all-wrap");
521
522    // 스크롤 영역
523    this.$scrollBox = this.$container.find(".menu-all-inner--scrollbox");
524    this.$allMenuInner = this.$container.find(".menu-all-inner");
525    this.$allMenuTitle = this.$allMenuInner.find(".title");
526    this.$subMenuToggler = this.$container.find(this.subToggleSelector);
527    // 스크롤 영역 원본 DOM
528    this.originChildren = this.$scrollBox.html();
529    this.changeMobileDevice = false;
530
531    this.reset();
532    this.isExpanded ? this.expanded(0) : this.collapsed(0); // 로드시 기 상태
533
534    // 이벤트 바인드
535    $win.on("resize", $.proxy(this.reset, this));
536    this.$toggler.on("click", $.proxy(this.controller, this));
537    this.$closeer.on("click", $.proxy(this.collapsed, this));
538    this.$allMenu.on("click",this.depthOneToggleSelector,$.proxy(this.togglerMobileDepthOneMenu, this));
539    this.$allMenu.on("click",this.subToggleSelector,$.proxy(this.subController, this));
540
541    //커스텀 이벤트 등록
542    commons.event.listener(EVENT.ON_CHANGE_DOM_SIZE, $.proxy(this.reset, this));
543  },
544  /**
545   * window resize / EVENT.ON_CHANGE_DOM_SIZE 이벤트 발생 시
546   */
547  reset: function(e, eventName) {
548    var speed = eventName === EVENT.ON_CHANGE_DOM_SIZE ? this.speed : 0;
549
550    // 하위 메뉴 모두가 활성화 되어야 하는지 아닌지를 체크
551    this.isSubAllExpanded =
552      commons.getDeviceType() === DEVICE_TYPE_DESKTOP
553        ? this.defaultStateDesktop
554        : commons.getDeviceType() === DEVICE_TYPE_TABLET
555        ? this.defaultStateTablet
556        : this.defaultStateMobile;
557
558    // 모바일 디바이스에서 스크롤 및 활성화 메뉴 초기화
559    if (commons.getDeviceType() === DEVICE_TYPE_MOBILE) {
560      this.removeScroller();
561      if (!this.changeMobileDevice) {
562        this.activeMobileDepthOneMenu(0);
563        this.changeMobileDevice = true;
564      }
565    } else {
566      this.changeMobileDevice = false;
567    }
568
569    // 하위 메뉴 모두가 활성화 여부에 따라 전체메뉴 활성화 비활성화.
570    this.isSubAllExpanded
571      ? this.allExpandedSubMenu(0)
572      : this.allCollapsedSubMenu(0);
573
574    // 확장되어 있을 경우에만 확장이벤트 실행
575    this.isExpanded && this.expanded(speed);
576  },
577  /**
578   * 헤더를 제외한 나머지 높이값 === PC에서 전체메뉴의 높이값
579   */
580  withoutHeaderHeight: function() {
581    var windowHeight = $win.outerHeight();
582    // stickyHeader객체에서 직접 메소드로 보여지고 있는 헤더의 높이값을 가져옴
583    var headerHeight = stickyHeader.getHeaderHeight();
584
585    return windowHeight - headerHeight;
586  },
587  /**
588   * 전체메뉴를 확장/축소할지 결정하여 확장/축소 메소드를 호출한다.
589   */
590  controller: function(e) {
591    e.preventDefault();
592    var isExpand = this.$toggler.attr(A11Y.EXPANDED) === "true";
593
594    isExpand ? this.collapsed() : this.expanded();
595  },
596  /**
597   * 전체메뉴를 확대한다.
598   */
599  expanded: function(speed) {
600    // 스피드 설정(파라미터값이 있으면 파라미터 값으로 없으면 기본 설정값으로)
601    var speed = speed === undefined ? this.speed : speed;
602
603    // 모션값 설정
604    var options =
605      commons.getDeviceType() === DEVICE_TYPE_MOBILE
606        ? { left: 0 }
607        : { height: this.withoutHeaderHeight(), opacity: 1 };
608
609    // 전체스크롤 막기
610    commons.disabledScroll();
611
612    // 버튼 aria값 설정
613    this.isExpanded = true;
614    this.$toggler.attr(A11Y.EXPANDED, this.isExpanded);
615
616    // 커스텀이벤트 트리거 -> GNB 메뉴 기능 일시정지
617    commons.event.trigger(EVENT.EXPANDED_ALLMENU, {});
618
619    //확장시키기
620    this.$allMenu
621      .show()
622      .stop()
623      .animate(
624        options,
625        speed,
626        $.proxy(function() {
627          /** 열기 모션 끝나면... */
628
629          /**
630           * pc/테블릿인 경우 스크롤 적용.
631           * 모바일로 넘어가는 순간 삭제
632           */
633
634          if (commons.getDeviceType() === DEVICE_TYPE_MOBILE) {
635            return;
636          }
637
638          this.setScroller();
639        }, this)
640      );
641
642    /** pc에서는 보이지 않게 한다 */
643    if ($(window).width() > 767){
644  	  this.$allMenu.hide();
645    }
646  },
647  /**
648   * 전체메뉴를 축소한다.
649   */
650  collapsed: function(speed) {
651    // 스피드 설정(파라미터값이 있으면 파라미터 값
651으로 없으면 기본 설정값으로)
652    var speed = speed === undefined ? this.speed : speed;
653    // 모션값 설정
654    var options =
655      commons.getDeviceType() === DEVICE_TYPE_MOBILE
656        ? { left: "-100%" }
657        : { height: 0, opacity: 0 };
658
659    // 전세스크롤 활성화
660    commons.enabledScroll();
661
662    // 버튼 aria값 설정
663    this.isExpanded = false;
664    this.$toggler.attr(A11Y.EXPANDED, this.isExpanded);
665
666    // 커스텀이벤트 트리거 -> GNB 메뉴 기능 일시정지풀기
667    commons.event.trigger(EVENT.COLLAPSED_ALLMENU, {});
668
669    // 비활성화 모션
670    this.$allMenu.stop().animate(options, {
671      duration: speed,
672      complete: $.proxy(function() {
673        /** 닫기 모션 끝나면... */
674        // 전체메뉴 display:none 처리
675        this.$allMenu.removeAttr("style");
676        // 기본 하위 메뉴상태가 열려 있는 거라면 모든 하위메뉴 확장 아니라면 축소
677        // 2020.02.13.모바일기기 현재메뉴 표시를 위한 주석처리
678        /*this.isSubAllExpanded
679          ? this.allExpandedSubMenu(0)
680          : this.allCollapsedSubMenu(0);*/
681      }, this)
682    });
683  },
684  /**
685   * 하위메뉴를 확장/축소할지 결정하여 확장/축소 메소드를 호출한다.
686   */
687  subController: function(e) {
688    var $target = $(e.currentTarget);
689    var isExpand = $target.attr(A11Y.EXPANDED);
690
691    // aria-expanded가 없으면 하위 메뉴가 없는 것으로 함수를 종료한다.
692    if (isExpand === undefined) {
693      return;
694    }
695    // 기본 기능을 막는다.(링크이동막기)
696    e.preventDefault();
697    // 확장여부에 따라 하위메뉴를 확장/축소한다.
698    isExpand === "true"
699      ? this.collapsedSubMenu($target)
700      : this.expandedSubMenu($target);
701  },
702  /**
703   * 하위메뉴를 확장한다.
704   */
705  expandedSubMenu: function($target, speed) {
706    var speed = speed === undefined ? this.speed : speed;
707
708    // 확장축소될 하위 메뉴리스트
709    var $subMenu = $target.siblings(this.subMenuSelector);
710
711    // 기본에 확장되어 있는 아이템응 축소시킨다.
712    !this.isSubAllExpanded &&
713      this.collapsedSubMenu(
714        $target
715          .parents()
716          .siblings()
717          .find("[" + A11Y.EXPANDED + "=true]")
718      );
719
720    // 클릭한 2뎁스 메뉴아이템의 아리아값 변경
721    $target.attr(A11Y.EXPANDED, true);
722
723    // 하위메뉴 확대
724    $subMenu.stop().slideDown(
725      $.proxy(function() {
726        $subMenu.attr("style", "display:block");
727      }, this)
728    );
729  },
730  /**
731   * 하위메뉴를 축소한다.
732   */
733  collapsedSubMenu: function($target, speed) {
734    if (this.isSubAllExpanded) return;
735    var speed = speed === undefined ? this.speed : speed;
736
737    // 확장축소될 하위 메뉴리스트
738    var $subMenu = $target.siblings(this.subMenuSelector);
739
740    // 클릭한 2뎁스 메뉴아이템의 아리아값 변경
741    $target.attr(A11Y.EXPANDED, false);
742
743    // 하위메뉴 축소
744    $subMenu.stop().slideUp(
745      $.proxy(function() {
746        $subMenu.attr("style", "display:none");
747      }, this)
748    );
749  },
750  /**
751   * 모든 하위 메뉴를 확장시킨다.
752   */
753  allExpandedSubMenu: function() {
754    var $subMenus = this.$subMenuToggler.siblings(this.subMenuSelector);
755
756    // 하위 메뉴를 보이고 하위메뉴가 있는 2뎁스 아이템에만 aria 속성 적용
757    $subMenus
758      .show()
759      .siblings(this.$subMenuToggler)
760      .attr(A11Y.EXPANDED, true);
761  },
762  /**
763   * 모든 하위 메뉴를 축소시킨다.
764   */
765  allCollapsedSubMenu: function() {
766    var $subMenus = this.$subMenuToggler.siblings(this.subMenuSelector);
767
768    // 하위 메뉴를 숨기고 하위메뉴가 있는 2뎁스 아이템에만 aria 속성 적용
769    $subMenus
770      .hide()
771      .siblings(this.$subMenuToggler)
772      .attr(A11Y.EXPANDED, false);
773  },
774  /**
775   * 모바일에서 원뎁스 메뉴를 클릭 했을때 해당 메뉴를 활성화 시킬지 말지 결정한다
776   */
777  togglerMobileDepthOneMenu: function(e) {
778    var $target = $(e.target);
779    var hasNotMenu = $target.next(this.depthOneMenuSelector).length === 0;
780    var isNotMobile = commons.getDeviceType() !== DEVICE_TYPE_MOBILE;
781    var index = $target.parent().index();
782
783    if (hasNotMenu || isNotMobile) return;
784
785    e.preventDefault();
786    this.activeMobileDepthOneMenu(index);
787  },
788  /**
789   * 파라미터로 받은 인덱스의 원뎁스메뉴를 활성화한다.
790   */
791  activeMobileDepthOneMenu: function(index) {
792    this.$container
793      .find(this.depthOneWrapperSelector)
794      .eq(index)
795      .toggleClass("depth1--selected")
796      .siblings()
797      .removeClass("depth1--selected");
798  },
799  /**
800   * 스크롤을 생성 및 스크롤 사이즈를 조정한다.
801   */
802  setScroller: function() {
803    if (!this.hasScrollbar()) {
804      /**
805       * 스크롤바가 적용되는 요소를 객체로 담아서 적용하면 스크롤바가 제대로 작동하지 않는 이슈가 있어
806       * 별도의 객체로 담아 두지 않고 스크립트 적용
807       */
808
809      $(this.scrollInnerSelector)
810        .not(".scroll-content")
811        .scrollbar();
812      $(this.scrollInnerSelector)
813        .not(".scroll-content")
814        .attr("data-scrollbar", true);
815    }
816
817    var height = this.getContentHeight();
818
819    $(this.scrollInnerSelector)
820      .not(".scroll-content")
821      .outerHeight(height);
822  },
823  /**
824   * 스크롤이 필요없는 모바일에서는 스크롤을 삭제한다.
825   */
826  removeScroller: function() {
827    if (!this.hasScrollbar()) return;
828
829    this.$scrollBox.html(this.originChildren);
830    this.$subMenuToggler = this.$container.find(this.subToggleSelector);
831  },
832  /**
833   * 전체메뉴에 적용될 높이값을 생성.
834   * 스크롤 스크립트를 적용하기 위해서는 높이값이 필요하기 때문에 스크립트로 높이값을 적용.
835   */
836  getContentHeight: function() {
837    return (
838      this.$allMenuInner.outerHeight(true) -
839      this.$allMenuTitle.outerHeight(true)
840    );
841  },
842  /**
843   * 현재 스크롤 스크립트가 적용되어 있는지 체크한다.
844   */
845  hasScrollbar: function() {
846    var $scrollInner = $(this.scrollInnerSelector).not(".scroll-content");
847    var isScroll = $scrollInner.attr("data-scrollbar") === "true";
848
849    return isScroll;
850  },
851  /** 초기 및 현재 메뉴의 확장/축소 상태를 체크하기 위한 값 */
852  isExpanded: false,
853  isSubAllExpanded: false,
854  /** true이면 메뉴를 확장했을때 모든 요소가 확장되어 있음 */
855  defaultStateDesktop: true, // 데스크탑
856  defaultStateTablet: false, // 테블릿
857  defaultStateMobile: false // 모바일
858};
859
860/*************************************************************************************
861  가상키보드
862**************************************************************************************/
863var VRKeyboard = function (inputSelector, openerSelector, keyboardWrapper, options) {
864  this.setting = $.extend({
865    closerSelector:'.worldword-close',
866    languageTabsSelector: '.language a',
867    languageTabpanelsSelector: ".language-contents",
868    initialLanguage: '히라가나',
869    activeClassName: "selected",
870    position: { top: null, left: null, bottom: null, right: null, zIndex: null },
871
872    focusTargetWhenClosed: null,
873  }, options || {});
874
875
876  if(!$(inputSelector).length) {
877    return console.warn('가상키보드 초기화 실패:' + inputSelector + '없음');
878  }
879  if(!$(openerSelector).length) {
880    return console.warn('가상키보드 초기화 실패:' + opener
880Selector + '없음');
881  }
882  if(!$(keyboardWrapper).length) {
883    return console.warn('가상키보드 초기화 실패:' + keyboardWrapper + '없음');
884  }
885  this.init(inputSelector, openerSelector, keyboardWrapper);
886}
887
888VRKeyboard.prototype = {
889  constructor: this.constructor,
890
891  init: function (inputSelector, openerSelector, keyboardWrapper) {
892    this.$input           = $(inputSelector);
893    this.$opener          = $(openerSelector);
894    this.$keyboardWrapper = $(keyboardWrapper);
895    this.$keyboard        = this.getCloneVrKeyboard();
896    this.$closer          = this.$keyboard.find(this.setting.closerSelector);
897    this.$languageTabs    = this.$keyboard.find(this.setting.languageTabsSelector);
898    this.$languageTabpanels = this.$keyboard.find(this.setting.languageTabpanelsSelector);
899
900    if (this.getPosition(this.$keyboardWrapper) === 'static') {
901      this.setPosition(this.$keyboardWrapper, 'relative');
902    }
903
904
905    this.$keyboardWrapper.append(this.$keyboard);
906    this.$keyboard.css(this.setting.position);
907    this.currentLanguage = this.setting.initialLanguage;
908
909    this.showLanguage(this.setting.initialLanguage);
910
911    this.$opener.on('click', $.proxy(function () {
912		if(this.$opener.attr("title") == "다국어입력기 열기"){
913	  	  this.$opener.attr("title","다국어입력기 닫기");
914	  	this.$opener.find(".sr-only").text("다국어입력기 닫기");
915	    }else if(this.$opener.attr("title") == "다국어입력기 닫기"){
916	    	this.$opener.attr("title","다국어입력기 열기");
917	    	this.$opener.find(".sr-only").text("다국어입력기 열기");
918	    }else if(this.$opener.attr("title") == "열기"){
919		  this.$opener.attr("title","닫기");
920      }else{
921    	  this.$opener.attr("title","열기");
922      }
923      this.$keyboard.toggle();
924      this.$keyboard.find("input, select, button, a").first().focus();
925    }, this));
926
927    this.$closer.on('click', $.proxy(function () {
928      ( this.setting.focusTargetWhenClosed && $(this.setting.focusTargetWhenClosed).focus() ) || this.$opener.focus();
929      this.$opener.attr("title","열기");
930      this.$keyboard.hide();
931    }, this));
932
933    this.$languageTabs.on('click', $.proxy(function (e) {
934		e.target.title = '선택됨';
935      this.languageController(e)
936    }, this));
937
938    this.$languageTabpanels.on('click', 'a', $.proxy(function (e) {
939      e.preventDefault();
940
941      var inputVal = this.$input.val();
942      var val = e.target.innerText
943
944      this.$input.trigger('change');
945      this.$input.val(inputVal + val)
946    }, this));
947  },
948
949  getCloneVrKeyboard: function () {
950    window.$originVRKeyboard = (window.$originVRKeyboard && window.$originVRKeyboard.length) ? window.$originVRKeyboard : $('.worldword-wrap');
951
952    if (!window.$originVRKeyboard.length) {
953      return console.warn('가상키보드가 없습니다.');
954    }
955
956    return window.$originVRKeyboard.clone();
957  },
958
959  getPosition: function ($el) {
960    return $el.css('position');
961  },
962
963  setPosition: function ($el, position) {
964    $el.css('position', position);
965  },
966  languageController: function(e) {
967    var type = $(e.target).attr("data-type");
968
969    this.hideLanguage(this.currentLanguage);
970    this.showLanguage(type);
971  },
972  showLanguage: function(type) {
973    var $languageTab = this.$keyboard.find(
974      this.setting.languageTabsSelector + "[data-type=" + type + "]"
975    );
976    var $languageTabpanel = this.$keyboard.find(
977      this.setting.languageTabpanelsSelector + "[data-type=" + type + "]"
978    );
979
980    $languageTab.addClass(this.setting.activeClassName);
981    $languageTabpanel.show();
982    this.currentLanguage = type;
983  },
984  hideLanguage: function(type) {
985    var $languageTab = this.$keyboard.find(
986      this.setting.languageTabsSelector + "[data-type=" + type + "]"
987    );
988    var $languageTabpanel = this.$keyboard.find(
989      this.setting.languageTabpanelsSelector + "[data-type=" + type + "]"
990    );
991	$languageTab[0].title = '';
992    $languageTab.removeClass(this.setting.activeClassName);
993    $languageTabpanel.hide();
994  },
995}
996
997/*************************************************************************************
998  검색영역(with mobile)
999**************************************************************************************/
1000var search = {
1001  init: function() {
1002    // 기본값 설정
1003    this.speed = 500; // 확장축소 속도
1004
1005    // 필요한 객체 선택
1006    this.$container = $(".header__search-wrap");
1007    this.$toggler = this.$container.find(".btn-search--open");
1008    this.$closeer = this.$container.find(".btn-search--close");
1009    this.$allMenu = this.$container.find(".search-all-wrap");
1010    this.scrollInnerSelector = ".search-all-inner--scroll.scrollbar-outer";
1011
1012    // 스크롤 영역
1013    this.$scrollBox = this.$container.find(".search-all-inner--scrollbox");
1014    this.$allMenuInner = this.$container.find(".search-all-inner");
1015    this.$subMenuToggler = this.$container.find(this.subToggleSelector);
1016    // 스크롤 영역 원본 DOM
1017    this.originChildren = this.$scrollBox.html();
1018    this.changeMobileDevice = false;
1019
1020    this.reset();
1021    this.isExpanded ? this.expanded(0) : this.collapsed(0); // 로드시 대기 상태
1022
1023    // 이벤트 바인드
1024    $win.on("resize", $.proxy(this.reset, this));
1025    this.$toggler.on("click", $.proxy(this.controller, this));
1026    this.$closeer.on("click", $.proxy(this.collapsed, this));
1027    this.$allMenu.on(
1028      "click",
1029      this.depthOneToggleSelector,
1030      $.proxy(this.togglerMobileDepthOneMenu, this)
1031    );
1032    this.$allMenu.on(
1033      "click",
1034      this.subToggleSelector,
1035      $.proxy(this.subController, this)
1036    );
1037
1038    //커스텀 이벤트 등록
1039    commons.event.listener(EVENT.ON_CHANGE_DOM_SIZE, $.proxy(this.reset, this));
1040  },
1041  /**
1042   * window resize / EVENT.ON_CHANGE_DOM_SIZE 이벤트 발생 시
1043   */
1044  reset: function(e, eventName) {
1045    var speed = eventName === EVENT.ON_CHANGE_DOM_SIZE ? this.speed : 0;
1046
1047    // 하위 메뉴 모두가 활성화 되어야 하는지 아닌지를 체크
1048    this.isSubAllExpanded =
1049      commons.getDeviceType() === DEVICE_TYPE_DESKTOP
1050        ? this.defaultStateDesktop
1051        : commons.getDeviceType() === DEVICE_TYPE_TABLET
1052        ? this.defaultStateTablet
1053        : this.defaultStateMobile;
1054
1055    // 하위 메뉴 모두가 활성화 여부에 따라 전체메뉴 활성화 비활성화.
1056    this.isSubAllExpanded
1057      ? this.allExpandedSubMenu(0)
1058      : this.allCollapsedSubMenu(0);
1059
1060    // 확장되어 있을 경우에만 확장이벤트 실행
1061    this.isExpanded && this.expanded(speed);
1062  },
1063  /**
1064   * 헤더를 제외한 나머지 높이값 === PC에서 전체메뉴의 높이값
1065   */
1066  withoutHeaderHeight: function() {
1067    var windowHeight = $win.outerHeight();
1068    // stickyHeader객체에서 직접 메소드로 보여지고 있는 헤더의 높이값을 가져옴
1069    var headerHeight = stickyHeader.getHeaderHeight();
1070
1071    return windowHeight - headerHeight;
1072  },
1073  /**
1074   * 전체메뉴를 확장/축소할지 결정하여 확장/축소 메소드를 호출한다.
1075   */
1076  controller: function(e) {
1077    e.preventDefault();
1078    var isExpand = this.$toggler.attr(A11Y.EXPANDED) === "true";
1079
1080    isExpand ? this.collapsed() : this.expanded();
1081  },
1082  /**
1083   * 전체메뉴를 확대한다.
1084   */
1085  expanded: function(speed) {
1086    // 스피드 설정(파라미터값이 있으면 파라미터 값으로 없으면 기본 설정값으로)
1087    var speed = speed === undefined ? this.speed : speed;
1088
1089    // 모션값 설정
1090    var options =
1091      commons.getDeviceType() === DEVICE_TYPE_MOBILE
1092        ? { right: 0 }
1093        : { height: this.withoutHeaderHeight(), opacity: 1 };
1094
1095    // 전체스크롤 막기
1096    commons.disabledScroll();
1097    commons.disabledView();
1098    // 통합검색영역 클래스 추가
1099    //commons.addClass('search-opened');
1100
1101    // 버튼 aria값 설정
1102    this.isExpanded = true;
1103    this.$toggler.attr(A11Y.EXPANDED, this.isExpanded);
1104
1105    // 커스텀이벤트 트리거 -> GNB 메뉴 기능 일시정지
1106    commons.event.trigger(EVENT.EXPANDED_ALLMENU, {});
1107
1108    //확장시키기
1109    this.$allMenu
1110      .show()
1111      .stop()
1112      .animate(
1113        options,
1114        speed,
1115        $.proxy(function() {
1116          /** 열기 모션 끝나면... */
1117
1118          /**
1119           * pc/테블릿인 경우 스크롤 적용.
1120           * 모바일로 넘어가는 순간 삭제
1121           */
1122
1123          if (commons.getDeviceType() === DEVICE_TYPE_MOBILE) {
1124            return;
1125          }
1126
1127          this.setScroller();
1128        }, this)
1129      );
1130  },
1131  /**
1132   * 전체메뉴를 축소한다.
1133   */
1134  collapsed: function(speed) {
1135    // 스피드 설정(파라미터값이 있으면 파라미터 값
1135으로 없으면 기본 설정값으로)
1136    var speed = speed === undefined ? this.speed : speed;
1137    // 모션값 설정
1138    var options =
1139      commons.getDeviceType() === DEVICE_TYPE_MOBILE
1140        ? { right: "-100%" }
1141        : { height: 0, opacity: 0 };
1142
1143    // 전체스크롤 활성화
1144    commons.enabledScroll();
1145    commons.enabledView();
1146
1147    // 버튼 aria값 설정
1148    this.isExpanded = false;
1149    this.$toggler.attr(A11Y.EXPANDED, this.isExpanded);
1150
1151    // 커스텀이벤트 트리거 -> GNB 메뉴 기능 일시정지풀기
1152    commons.event.trigger(EVENT.COLLAPSED_ALLMENU, {});
1153
1154    // 비활성화 모션
1155    this.$allMenu.stop().animate(options, {
1156      duration: speed,
1157      complete: $.proxy(function() {
1158        /** 닫기 모션 끝나면... */
1159        // 전체메뉴 display:none 처리
1160        this.$allMenu.removeAttr("style");
1161        // 기본 하위 메뉴상태가 열려 있는 거라면 모든 하위메뉴 확장 아니라면 축소
1162        this.isSubAllExpanded
1163          ? this.allExpandedSubMenu(0)
1164          : this.allCollapsedSubMenu(0);
1165      }, this)
1166    });
1167  },
1168  /**
1169   * 하위메뉴를 확장/축소할지 결정하여 확장/축소 메소드를 호출한다.
1170   */
1171  subController: function(e) {
1172    var $target = $(e.currentTarget);
1173    var isExpand = $target.attr(A11Y.EXPANDED);
1174
1175    // aria-expanded가 없으면 하위 메뉴가 없는 것으로 함수를 종료한다.
1176    if (isExpand === undefined) {
1177      return;
1178    }
1179    // 기본 기능을 막는다.(링크이동막기)
1180    e.preventDefault();
1181    // 확장여부에 따라 하위메뉴를 확장/축소한다.
1182    isExpand === "true"
1183      ? this.collapsedSubMenu($target)
1184      : this.expandedSubMenu($target);
1185  },
1186  /**
1187   * 하위메뉴를 확장한다.
1188   */
1189  expandedSubMenu: function($target, speed) {
1190    var speed = speed === undefined ? this.speed : speed;
1191
1192    // 확장축소될 하위 메뉴리스트
1193    var $subMenu = $target.siblings(this.subMenuSelector);
1194
1195    // 기본에 확장되어 있는 아이템응 축소시킨다.
1196    !this.isSubAllExpanded &&
1197      this.collapsedSubMenu(
1198        $target
1199          .parents()
1200          .siblings()
1201          .find("[" + A11Y.EXPANDED + "=true]")
1202      );
1203
1204    // 클릭한 2뎁스 메뉴아이템의 아리아값 변경
1205    $target.attr(A11Y.EXPANDED, true);
1206
1207    // 하위메뉴 확대
1208    $subMenu.stop().slideDown(
1209      $.proxy(function() {
1210        $subMenu.attr("style", "display:block");
1211      }, this)
1212    );
1213  },
1214  /**
1215   * 하위메뉴를 축소한다.
1216   */
1217  collapsedSubMenu: function($target, speed) {
1218    if (this.isSubAllExpanded) return;
1219    var speed = speed === undefined ? this.speed : speed;
1220
1221    // 확장축소될 하위 메뉴리스트
1222    var $subMenu = $target.siblings(this.subMenuSelector);
1223
1224    // 클릭한 2뎁스 메뉴아이템의 아리아값 변경
1225    $target.attr(A11Y.EXPANDED, false);
1226
1227    // 하위메뉴 축소
1228    $subMenu.stop().slideUp(
1229      $.proxy(function() {
1230        $subMenu.attr("style", "display:none");
1231      }, this)
1232    );
1233  },
1234  /**
1235   * 모든 하위 메뉴를 확장시킨다.
1236   */
1237  allExpandedSubMenu: function() {
1238    var $subMenus = this.$subMenuToggler.siblings(this.subMenuSelector);
1239
1240    // 하위 메뉴를 보이고 하위메뉴가 있는 2뎁스 아이템에만 aria 속성 적용
1241    $subMenus
1242      .show()
1243      .siblings(this.$subMenuToggler)
1244      .attr(A11Y.EXPANDED, true);
1245  },
1246  /**
1247   * 모든 하위 메뉴를 축소시킨다.
1248   */
1249  allCollapsedSubMenu: function() {
1250    var $subMenus = this.$subMenuToggler.siblings(this.subMenuSelector);
1251
1252    // 하위 메뉴를 숨기고 하위메뉴가 있는 2뎁스 아이템에만 aria 속성 적용
1253    $subMenus
1254      .hide()
1255      .siblings(this.$subMenuToggler)
1256      .attr(A11Y.EXPANDED, false);
1257  },
1258
1259  /**
1260   * 스크롤을 생성 및 스크롤 사이즈를 조정한다.
1261   */
1262  setScroller: function() {
1263    if (!this.hasScrollbar()) {
1264      /**
1265       * 스크롤바가 적용되는 요소를 객체로 담아서 적용하면 스크롤바가 제대로 작동하지 않는 이슈가 있어
1266       * 별도의 객체로 담아 두지 않고 스크립트 적용
1267       */
1268
1269      $(this.scrollInnerSelector)
1270        .not(".scroll-content")
1271        .scrollbar();
1272      $(this.scrollInnerSelector)
1273        .not(".scroll-content")
1274        .attr("data-scrollbar", true);
1275    }
1276
1277    var height = this.getContentHeight();
1278
1279    $(this.scrollInnerSelector)
1280      .not(".scroll-content")
1281      .outerHeight(height);
1282  },
1283  /**
1284   * 스크롤이 필요없는 모바일에서는 스크롤을 삭제한다.
1285   */
1286  removeScroller: function() {
1287    if (!this.hasScrollbar()) return;
1288
1289    this.$scrollBox.html(this.originChildren);
1290    this.$subMenuToggler = this.$container.find(this.subToggleSelector);
1291  },
1292  /**
1293   * 전체메뉴에 적용될 높이값을 생성.
1294   * 스크롤 스크립트를 적용하기 위해서는 높이값이 필요하기 때문에 스크립트로 높이값을 적용.
1295   */
1296  getContentHeight: function() {
1297    return (
1298      this.$allMenuInner.outerHeight(true) -
1299      this.$allMenuTitle.outerHeight(true)
1300    );
1301  },
1302  /**
1303   * 현재 스크롤 스크립트가 적용되어 있는지 체크한다.
1304   */
1305  hasScrollbar: function() {
1306    var $scrollInner = $(this.scrollInnerSelector).not(".scroll-content");
1307    var isScroll = $scrollInner.attr("data-scrollbar") === "true";
1308
1309    return isScroll;
1310  },
1311  /** 초기 및 현재 메뉴의 확장/축소 상태를 체크하기 위한 값 */
1312  isExpanded: false,
1313  isSubAllExpanded: false,
1314  /** true이면 메뉴를 확장했을때 모든 요소가 확장되어 있음 */
1315  defaultStateDesktop: true, // 데스크탑
1316  defaultStateTablet: false, // 테블릿
1317  defaultStateMobile: false // 모바일
1318};
1319/*************************************************************************************
1320  lnb
1321**************************************************************************************/
1322$('.lnb li.menu-lnb__item > a').click(function(e){
1323	var menu = $(this).closest('.menu-lnb__item');
1324	var sub = $(this).siblings('.menu-lnb__sub');
1325	var subSi = $(this).closest('.menu-lnb__item').siblings().not('.is_lnb1--opened').find('.menu-lnb__sub');
1326
1327	//class
1328	var currentActive = 'is_lnb1--opened';
1329	var currentSlide = 'is_lnb2--slideUp';
1330	var active = 'is_lnb--opened';
1331
1332
1333	if(!sub.length) {
1334		return;
1335	}
1336	e.preventDefault();
1337
1338	if(menu.hasClass(currentActive)) {//현재 페이지 일 때,
1339		if(menu.hasClass(currentSlide)) {
1340			menu.removeClass(currentSlide);
1341			menu.addClass(active);
1342			menu[0].children[0].title = '접기';
1343			sub.slideDown();
1344		} else {
1345			menu.addClass(currentSlide);
1346			menu.removeClass(active);
1347			sub.slideUp();
1348			menu[0].children[0].title = '펼치기';
1349		}
1350	} else {//현재 페이지 외
1351		if(menu.hasClass(active)) {
1352			menu.removeClass(active);
1353			menu[0].children[0].title = '펼치기';
1354			sub.slideUp();
1355		} else {
1356			menu.siblings('li').removeClass(active);
1357			subSi.slideUp();
1358			menu.addClass(active);
1359			menu[0].children[0].title = '접기';
1360			sub.slideDown();
1361		}
1362	}
1363
1364});
1365/*************************************************************************************
1366  categoryTabsMenu
1367**************************************************************************************/
1368var categoryTabs = function(container, options) {
1369  /** 기본 옵션 */
1370  this.defaultOption = {
1371
1372    tabListClassName: ".category_list",
1373    tabItemClassName: ".category_item",
1374    tabPanelWrapClassName: ".category_tabpanel_wrap",
1375    tabPanelClassName: ".category_tabpanel",
1376
1377    // 탭리스트 토글러(모바일)
1378    tabTogglerClassName: ".label_wrap button",
1379
1380    /** 탭의 활성화 여부를 판단할 속성명 - 탭아이템에 적용된 값 */
1381    tabActiveStateAttrName: "data-selected",
1382    /** 탭 패널에 적용할 ID 값을 확인할 속성명 - 탭아이템에 적용된 값 */
1383    tabTargetSelectAttrName: "data-controls",
1384    /** 탭리스트의 확장/축소 여부를 판달할 속성명 - 토글버튼에 적용된 값 */
1385    tabTogglerStateAttrName: "data-expanded",
1386    initialIndex: undefined,
1387    beforeTabActive: function () {},
1388    afterTabActive: function () {},
1389  };
1390
1391  this.$container = $(container);
1392  this.options = options
1393    ? $.extend(this.defaultOption, options)
1394    : this.defaultOption;
1395
1396  this.init();
1397};
1398categoryTabs.prototype = {
1399  constructor: this.constructor,
1400  init: function() {
1401
1402    this.$tabWrapper = this.$container.find(this.options.tabListClassName);
1403    this.$tabs = this.$container.find(this.options.tabItemClassName);
1404    this.$tabpanelWrap = this.$container.find(this.options.tabPanelWrapClassName);
1405    this.$tabpanel = this.$container.find(this.options.tabPanelClassName);
1406    this.$toggler = this.$container.find(this.options.tabTogglerClassName);
1407    this.deviceType = commons.getDeviceType();
1408
1409    // 초기 활성화
1410    this.initActive();
1411
1412    /** 이벤트 바인드 */
1413    this.$tabs.on("click", $.proxy(this.clickTabEventHandler, this));
1414    this.$toggler.on("click",$.proxy(this.clickToggleButtonEventHandler, this));
1415    this.$tabs.on('keyup', $.proxy(function (e) {
1416      var keyCode = e.keyCode || e.which;
1417      var $target = $(e.currentTarget);
1418      var $nextTarget;
1419
1420      var index = $target.index();
1421      var isFirst = $target.attr('data-index') === 'first';
1422      var isLast = $target.attr('data-index') === 'last';
1423
1424      if (37 === keyCode || 39 === keyCode || 13 === keyCode) {
1425        e.preventDefault();
1426      } else {
1427        return;
1428      }
1429
1430      switch (keyCode) {
1431        case 13:
1432          this.activeTab($target);
1433          break;
1434        case 37:
1435          if (isFirst) {
1436            $nextTarget = this.$tabs.last()
1437          } else {
1438            $nextTarget = this.$tabs.eq(index - 1)
1439          }
1440          $nextTarget.focus();
1441          break;
1442        case 39:
1443          if (isLast) {
1444            $nextTarget = this.$tabs.first()
1445          } else {
1446            $nextTarget = this.$tabs.eq(index + 1)
1447          }
1448          $nextTarget.focus();
1449          break;
1450      }
1451    }, this));
1452    $win.on("resize", $.proxy(this.resizingWindowEventHandler, this));
1453  },
1454  /** 초기에 탭을 활성화 하기위한 함수 */
1455  initActive: function() {
1456    var $activeTab = this.$tabWrapper.find(
1457      "[" + this.options.tabActiveStateAttrName + ' ="true"]'
1458    );
1459
1460    this.$tabs.first().attr('data-index', 'first');
1461    this.$tabs.first().find('a').attr('title', '선택됨');
1462    this.$tabs.last().attr('data-index', 'last');
1463
1464//    this.$tabs.find('a').removeAttr('href');
1465//    this.$tabs.find('a, button').attr({ 'disabled':true, 'role':'non presentation' });
1466    //this.$tabs.find('a, button').attr({'role':'tab'});
1467
1468    if ($activeTab.length) {
1469      this.activeTab($activeTab);
1470    } else {
1471      this.activeTab(this.$tabs.eq(this.options.initialIndex));
1472    }
1473  },
1474  isMobile: function() {
1475    return commons.getDeviceType() === DEVICE_TYPE_MOBILE;
1476  },
1477  resizingWindowEventHandler: function() {
1478    if (this.deviceType === commons.getDeviceType()) {
1479      return;
1480    }
1481    this.deviceType = commons.getDeviceType();
1482    this.collapsed(0);
1483  },
1484  /**
1485   * 탭 아이템을 클릭했을때 실행할 핸들러
1486   * 조건에 따라 탭을 활성화 시킨다.
1487   */
1488  clickTabEventHandler: function(e) {
1489
1490    e.preventDefault();
1491
1492    var $target = $(e.currentTarget);
1493    // 현재 탭 선택 여부체크
1494    var isSelected = $target.attr(this.options.tabActiveStateAttrName) === "true";
1495    var isMobile = this.isMobile();
1496
1497    // 모바일 확장된 탭리스트를 축소
1498    isMobile && this.collapsed(0);
1499
1500    if (isSelected) return;
1501    // 선택된 탭 활성화
1502    $target.parent().find('li').find('a').removeAttr('title');
1503    $target.find('a').attr('title','선택됨');
1504    this.activeTab($target);
1505
1506  },
1507  /**
1508   * 파라미터로 받은 탭을 활성화 시키고 형제요소 탭 비활성화
1509   * @param {jQuery.DOM} $target 선택된 탭요소의 jQuery 객체
1510   */
1511  activeTab: function($target) {
1512    //var id = $target.attr(this.options.tabTargetSelectAttrName);
1513    var text = $target.text();
1514    var isMobile = this.isMobile();
1515    var index = $target.index();
1516    this.$tab
1517	  $target
1518	  .attr(this.options.tabActiveStateAttrName, true)
1519	  .siblings()
1520	  .removeAttr(this.options.tabActiveStateAttrName);
1521	  this.options.beforeTabActive(index)
1522	  this.$toggler.text(text);
1523
1524	  $target.find('a').attr('aria-selected', 'true');
1525	  $target.siblings().find('a').attr('aria-selected', 'false');
1526
1527    //개발에서 div 하나로 제어하게 될 경우
1528    // 탭패널의 아이디 값을 변경한다. this.$tabpanel.attr('id', id);
1529
1530    //활성화된 탭아이템의 속성값
1531    var $activeItemTab = this.$tabWrapper.find(
1532      "[" + this.options.tabActiveStateAttrName + ' ="true"]'
1533    );
1534    var isActiveTab = $activeItemTab.attr(this.options.tabActiveStateAttrName);
1535    isActiveTab && this.activeTabPanel($activeItemTab);
1536    this.options.afterTabActive(index)
1537  },
1538  /**
1539   * 파라미터로 받은 활성화 탭의 동일한 패널탭 활성화 시키고 형제요소 탭 비활성화
1540   * @param {jQuery.DOM} $target 선택된 탭요소의 jQuery 객체
1541   */
1542  activeTabPanel: function($target) {
1543    var id = $target.attr(this.options.tabTargetSelectAttrName);
1544    var $activeTabPanel = this.$tabpanelWrap.find('#' + id);
1545    $activeTabPanel.show().siblings().hide();
1546  },
1547  /**
1548   * 탭 레이블을 클릭했을때 실행할 핸들러
1549   * 탭 리스트를 확장시키거나 축소시킨다.
1550   */
1551  clickToggleButtonEventHandler: function(e) {
1552    e.preventDefault();
1553    var isExpanded =
1554      $(e.currentTarget).attr(this.options.tabTogglerStateAttrName) === "true";
1555
1556    if (isExpanded) {
1557      this.collapsed();
1558    } else {
1559      this.expanded();
1560    }
1561  },
1562  /**
1563   * 모바일에서 탭리스트를 확장
1564   * @param {Number} speed 확장되는 속도
1565   */
1566  expanded: function(speed) {
1567    this.$toggler.attr(this.options.tabTogglerStateAttrName, true);
1568
1569    // 탭리스트를 확장
1570    this.$tabWrapper.stop().slideDown(
1571      speed,
1572      $.proxy(function() {
1573        this.$tabWrapper.attr("style", "display:block");
1574      }, this)
1575    );
1576  },
1577  /**
1578   * 모바일에서 탭리스트를 축소
1579   * @param {Number} speed 축소되는 속도
1580   */
1581  collapsed: function(speed) {
1582    this.$toggler.attr(this.options.tabTogglerStateAttrName, false);
1583
1584    // 탭리스트를 축소
1585    this.$tabWrapper.stop().slideUp(
1586      speed,
1587      $.proxy(function() {
1588        // 모션이 종료되면 인라인 style을 초기화
1589        this.$tabWrapper.removeAttr("style");
1590      }, this)
1591    );
1592  }
1593};
1594/*************************************************************************************
1595  tab
1596**************************************************************************************/
1597var Tabs = function(container, options) {
1598  this.defaultOption = {
1599    tabListClassName: ".tab_list",
1600    tabItemClassName: ".tab_item",
1601    tabPanelWrapClassName: ".tabpanel_wrap",
1602    tabPanelClassName: ".tabpanel",
1603
1604    // 탭리스트 토글러(모바일)
1605    //tabTogglerClassName: '.label_wrap button',
1606
1607    /** 탭의 활성화 여부를 판단할 속성명 - 탭아이템에 적용된 값 */
1608    tabActiveStateAttrName: "data-selected",
1609    /** 탭 패널에 적용할 ID 값을 확인할 속성명 - 탭아이템에 적용된 값 */
1610    tabTargetSelectAttrName: "data-controls",
1611    /** 탭리스트의 확장/축소 여부를 판달할 속성명 - 토글버튼에 적용된 값 */
1612    tabTogglerStateAttrName: "data-expanded",
1613    initialIndex: undefined,
1614    beforeTabActive: function () {},
1615    afterTabActive: function () {},
1616  };
1617
1618  this.$container = $(container);
1619  this.options = options
1620    ? $.extend(this.defaultOption, options)
1621    : this.defaultOption;
1622
1623  this.init();
1624};
1625
1626Tabs.prototype = {
1627  constructor: this.constructor,
1628  init: function() {
1629    this.$tabWrapper = this.$container.find(this.options.tabListClassName);
1630    this.$tabs = this.$container.find(this.options.tabItemClassName);
1631    this.$tabpanelWrap = this.$container.find(
1632      this.options.tabPanelWrapClassName
1633    );
1634    this.$tabpanel = this.$container.find(this.options.tabPanelClassName);
1635
1636    // 초기 활성화
1637    this.initActive();
1638
1639    /** 이벤트 바인드 */
1640    this.$tabs.on('click', $.proxy(this.clickTabEventHandler, this));
1641    this.$tabs.on('keyup', $.proxy(function (e) {
1642      var keyCode = e.keyCode || e.which;
1643      var $target = $(e.currentTarget);
1644      var $nextTarget;
1645
1646      var index = $target.index();
1647      var isFirst = $target.attr('data-index') === 'first';
1648      var isLast = $target.attr('data-index') === 'last';
1649
1650      if (37 === keyCode || 39 === keyCode || 13 === keyCode) {
1651        e.preventDefault();
1652      } else {
1653        return;
1654      }
1655
1656      switch (keyCode) {
1657        case 13:
1658          this.activeTab($target);
1659          break;
1660        case 37:
1661          if (isFirst) {
1662            $nextTarget = this.$tabs.last()
1663          } else {
1664            $nextTarget = this.$tabs.eq(index - 1)
1665          }
1666          $nextTarget.addClass('is_focus').focus().siblings().removeClass('is_focus');
1667          break;
1668        case 39:
1669          if (isLast) {
1670            $nextTarget = this.$tabs.first()
1671          } else {
1672            $nextTarget = this.$tabs.eq(index + 1)
1673          }
1674          $nextTarget.addClass('is_focus').focus().siblings().removeClass('is_focus');
1675          break;
1676      }
1677    }, this));
1678  },
1679  /** 초기에 탭을 활성화 하기위한 함수 */
1680  initActive: function() {
1681    var $activeTab = this.$tabWrapper.find(
1682      "[" + this.options.tabActiveStateAttrName + ' ="true"]'
1683    );
1684
1685    this.$tabs.first().attr('data-index', 'first');
1686    this.$tabs.last().attr('data-index', 'last');
1687
1688    //this.$tabs.find('a').removeAttr('href');
1689    //this.$tabs.find('a, button').attr({ 'disabled':true, 'role':'non presentation' });
1690
1691    if ($activeTab.length) {
1692      this.activeTab($activeTab);
1693    } else {
1694      this.activeTab(this.$tabs.eq(this.options.initialIndex));
1695    }
1696  },
1697
1698  /**
1699   * 탭 아이템을 클릭했을때 실행할 핸들러
1700   * 조건에 따라 탭을 활성화 시킨다.
1701   */
1702  clickTabEventHandler: function(e) {
1703    e.preventDefault();
1704
1705    var $target = $(e.currentTarget);
1706    // 현재 탭 선택 여부체크
1707    var isSelected = $target.attr(this.options.tabActiveStateAttr
1707Name) === "true";
1708
1709    if (isSelected) return;
1710
1711    // 선택된 탭 활성화
1712    this.activeTab($target);
1713  },
1714  /**
1715   * 파라미터로 받은 탭을 활성화 시키고 형제요소 탭 비활성화
1716   * @param {jQuery.DOM} $target 선택된 탭요소의 jQuery 객체
1717   */
1718  activeTab: function($target) {
1719    // var id = $target.attr(this.options.tabTargetSelectAttrName);
1720    var index = $target.index();
1721    this.$tab
1722
1723    $target
1724      //.attr('tabindex', 0)
1725      .attr(this.options.tabActiveStateAttrName, true)
1726      .siblings()
1727      //.attr('tabindex', -1)
1728      .removeAttr(this.options.tabActiveStateAttrName);
1729
1730    this.options.beforeTabActive(index)
1731
1732    //활성화된 탭아이템의 속성값
1733    var $activeItemTab = this.$tabWrapper.find(
1734      "[" + this.options.tabActiveStateAttrName + ' ="true"]'
1735    );
1736    var isActiveTab = $activeItemTab.attr(this.options.tabActiveStateAttrName);
1737    isActiveTab && this.activeTabPanel($activeItemTab);
1738
1739    this.options.afterTabActive(index)
1740  },
1741  /**
1742   * 파라미터로 받은 활성화 탭의 동일한 패널탭 활성화 시키고 형제요소 탭 비활성화
1743   * @param {jQuery.DOM} $target 선택된 탭요소의 jQuery 객체
1744   */
1745  activeTabPanel: function($target) {
1746    var id = $target.attr(this.options.tabTargetSelectAttrName);
1747    var $activeTabPanel = this.$tabpanelWrap.find('#' + id);
1748    $activeTabPanel.show().siblings().hide();
1749  }
1750};
1751/*************************************************************************************
1752  autocomplete
1753**************************************************************************************/
1754var autoComplete = function(container,options){
1755	/** 기본옵션 */
1756	this.defaultOption = {
1757		searchKeyword : ".input-text", //
1758		autocompleteLayer : ".autocomplete_layer",
1759		autocompleteClose : ".autocomplete_close",
1760		searchBtnArrow : ".btn_arrow",
1761	};
1762	this.$container = $(container);
1763	this.options = options ? $.extend(this.defaultOption, options) : this.defaultOption;
1764
1765	this.init();
1766};
1767autoComplete.prototype = {
1768	init: function(){
1769		this.$searchKeyword = this.$container.find(this.options.searchKeyword);
1770		this.$autocompleteLayer = this.$container.find(this.options.autocompleteLayer);
1771		this.$autocompleteClose = this.$container.find(this.options.autocompleteClose);
1772		this.$searchBtnArrow = this.$container.find(this.options.searchBtnArrow);
1773
1774		/** 이벤트 바인드 */
1775		this.$searchKeyword.on("keyup", $.proxy(this.autoKeyup, this));
1776		this.$searchKeyword.on("keydown", $.proxy(this.autoKeydown, this));
1777		this.$autocompleteClose.on("click", $.proxy(this.collapsed, this));
1778		this.$searchBtnArrow.on("click", $.proxy(this.toogleBtnFold, this));
1779	},
1780	// 글자 입력시
1781	autoKeyup: function(e) {
1782		var is_collapsed = this.$autocompleteLayer.hasClass('is_collapsed');
1783		if(!is_collapsed){
1784			var $searchKeywordValue = this.$searchKeyword.val();
1785
1786			if($.trim($searchKeywordValue).length) this.$autocompleteLayer.addClass('is_expanded');
1787			else this.$autocompleteLayer.removeClass('is_expanded');
1788
1789			var isexpanded = this.$autocompleteLayer.hasClass('is_expanded');
1790			if(isexpanded){
1791				this.$searchBtnArrow.addClass('is_fold');
1792			}else{
1793				this.$searchBtnArrow.removeClass('is_fold');
1794			}
1795		}
1796	},
1797	// 글자 입력 직전
1798	autoKeydown: function(e){
1799		if(event.which == 13) event.preventDefault();
1800	},
1801	// 자동완성 레이어 자동완성끄기 클릭했을 경우
1802	collapsed: function(e){
1803		this.$autocompleteLayer.removeClass('is_expanded');
1804		this.$autocompleteLayer.addClass('is_collapsed');
1805		this.$searchBtnArrow.removeClass('is_fold');
1806	},
1807	// 자동완성 화살표 버튼 토글
1808	toogleBtnFold: function(e){
1809		var $isFold = this.$autocompleteLayer.hasClass('is_expanded');
1810		var $arrowFlod = this.$searchBtnArrow.find('.arrow_fold');
1811
1812		if(!$isFold){
1813			$arrowFlod.text('자동 완성 접기');
1814			this.$autocompleteLayer.addClass('is_expanded');
1815			this.$autocompleteLayer.removeClass('is_collapsed');
1816			this.$searchBtnArrow.addClass('is_fold');
1817			this.$searchBtnArrow[0].title =  '자동 완성 접기';
1818		}else{
1819			$arrowFlod.text('자동 완성 열기');
1820			this.$autocompleteLayer.removeClass('is_expanded');
1821			this.$searchBtnArrow.removeClass('is_fold');
1822			this.$searchBtnArrow[0].title = '자동 완성 열기';
1823		}
1824	}
1825};
1826/*************************************************************************************
1827  let go!!!
1828**************************************************************************************/
1829$(document).ready(function() {
1830
1831	commons.init();
1832	stickyHeader.init();
1833	noticeBanner.init();
1834	gnb.init();
1835	allMenu.init();
1836	search.init();
1837	//menuLnb.init();
1838	var currentmenu = $('.is_lnb1--opened');
1839	currentmenu.addClass('is_current_page');
1840	currentmenu.find('.is_lnb2--opened').attr("aria-label","현재 페이지");
1841	if ($('.is_current_page .is-sub__items').length > 0 ){
1842		$('.is_current_page .is-sub__items')[0].title = '접기';
1843	}
1844
1845
1846	// 메인
1847	var autoComplete1 = new autoComplete(".main_section .search-form-wrap");
1848	// 헤더 공통
1849	var autoComplete2 = new autoComplete(".header .search-form-wrap");
1850	//검색 결과
1851	//var autoComplete3 = new autoComplete(".integSearch_wrap .search-form-wrap");
1852	var autoComplete3 = new autoComplete(".new_total_search_wrap .total_srch_box");
1853
1854	var autoComplete4 = new autoComplete(".total_search_pop .inner");
1855	var autoComplete5 = new autoComplete(".home_main_wrap .inner");
1856
1857
1858	var categoryTabs1 = new categoryTabs(".category_wrap", { initialIndex: 0 });
1859
1860	var categoryTabsLayer1 = new categoryTabs(".datalayer1_wrap", { initialIndex: 0 });
1861	var categoryTabsLayer3 = new categoryTabs(".datalayer3_wrap", { initialIndex: 0 });
1862	var categoryTabsLayer4 = new categoryTabs(".datalayer4_wrap", { initialIndex: 0 });
1863	var categoryTabsLayer5 = new categoryTabs(".datalayer5_wrap", { initialIndex: 0 });
1864	var categoryTabsLayer7 = new categoryTabs(".datalayer7_wrap", { initialIndex: 0 });
1865
1866	var boardTabWrap = new Tabs(".board_tab_wrap", { initialIndex: 0 });
1867	var shortcutWrap = new Tabs(".shortcut_wrap", { initialIndex: 0 });
1868	var applyTabWrap = new Tabs(".apply_tab_wrap", { initialIndex: 0 });
1869	var categoryInfoWrap = new Tabs(".category_info_wrap", { initialIndex: 0 });
1870	var typeServiceWrap = new Tabs(".type_service_wrap", {
1871    initialIndex: 0,
1872    tabListClassName: ".type_list",
1873    tabItemClassName: ".type_item",
1874    tabPanelWrapClassName: ".type_tabpanel_wrap",
1875    tabPanelClassName: ".type_tabpanel",
1876	});
1877
1878	//PC 모바일
1879	/*var vrKeyboard1 = new VRKeyboard(
1880		'.header__inner-top .input-text-wrap input',
1881		'.header__inner-top .btn-worldword',
1882		'.header__inner-top .keyboard-wrapper',
1883		{ position: { top: '100%', right: 0, marginTop: '10px' } }
1884	);*/
1885	var vrKeyboard1 = new VRKeyboard(
1886		'.total_search_pop .total_srch_pop_input input',
1887		'.total_search_pop .btn-worldword',
1888		'.total_search_pop .keyboard-wrapper',
1889		{ position: { top: '100%', right: 0, marginTop: '10px' } }
1890	);
1891
1892	var vrKeyboard10 = new VRKeyboard(
1893		'.nl_header_top .input-text-wrap input',
1894		'.nl_header_top .btn-worldword',
1895		'.nl_header_top .keyboard-wrapper',
1896		{ position: { top: '100%', right: 0, marginTop: '10px' } }
1897	);
1898
1899	var vrKeyboard11 = new VRKeyboard(
1900			'.home_main_wrap .total_srch_pop_input input',
1901			'.home_main_wrap .btn-worldword',
1902			'.home_main_wrap .keyboard-wrapper',
1903			{ position: { top: '100%', marginTop: '-25px' } }
1904		);
1905
1906	var vrKeyboard12 = new VRKeyboard(
1907			'.total_search_pop .total_srch_pop_input_sub input',
1908			'.total_search_pop .btn-worldword',
1909			'.total_search_pop .keyboard-wrapper',
1910			{ position: { top: '100%', right: 0, marginTop: '10px' } }
1911		);
1912
1913	//PC 콘텐츠 영역
1914	var vrKeyboard2 = new VRKeyboard(
1915		'.main_wide .input-text-wrap input',
1916		'.main_wide .btn-worldword',
1917		'.main_wide .btn-worldword-wrap',
1918		{
1919      position: { top: '100%', right: 0 },
1920      // 키보드가 닫힐 때 특정요소에 포커스를 이동시켜야할때
1921      // focusTargetWhenClosed: '.main_search .btn-search',
1922    }
1923	);
1924
1925	//PC 서브 헤더 영역
1926	var vrKeyboard3 = new VRKeyboard(
1927		'.wide-search-wrap .input-text-wrap input',
1928		'.wide-search-wrap .btn-worldword',
1929		'.wide-search-wrap .keyboard-wrapper',
1930		{ position: { top: '100%', right: 0 } }
1931	);
1932	//MO 서브 헤더 영역
1933	var vrKeyboard4 = new VRKeyboard(
1934		'.search__utils-wrap .input-text-wrap input',
1935		'.search__utils-wrap .btn-worldword',
1936		'.search__utils-wrap .btn-worldword-wrap',
1937		{ position: { top: 'auto', right: '-110%' } }
1938	);
1939
1940	//소장자료
1941	var vrKeyboard5 = new VRKeyboard(
1942		'.collect_search_wrap .input_text_wrap input',
1943		'.collect_search_wrap .btn-worldword',
1944		'.collect_search_wrap .btn-worldword-wrap',
1945		{ position: { top: '50px', right: -60 } }
1946	);
1947
1948	//구한국관보
1949	var vrKeyboard6 = new VRKeyboard(
1950		'.old_search_wrap .input_text_wrap input',
1951		'.old_search_wrap .btn-worldword',
1952		'.old_search_wrap .btn-worldword-wrap',
1953		{ position: { top: 'auto', right: -30 } }
1954  );
1955
1956  //신문 키워드 검색
1957	var keywordSearchWrap = new VRKeyboard(
1958		'.keyword_search_wrap .input_text_wrap input',
1959		'.keyword_search_wrap .btn-worldword',
1960		'.keyword_search_wrap .btn-worldword-wrap',
1961		{ position: { top: 'auto', right: -30 } }
1962	);
1963
1964
1965  //통합검색
1966
1967	/*var vrKeyboardNlSearch = new VRKeyboard(
1968		'.search-form_group .input-text-wrap input',
1969		'.search-form_group .btn-worldword',
1970		'.search-form_group .btn-worldword-wrap',
1971		{ position: { top: 'auto', right: -30 } }
1972	);*/
1973
1974
1975});
1976
1977$(function(){
1978
1979  $(window).scroll(function(){  //스크롤하면 아래 코드 실행
1980    if ($(window).width() > 767){
1981        var num = $(this).scrollTop();  // 스크롤값
1982        if( num > $("#header").outerHeight()+$(".header__inner-bottom").outerHeight()){  // 스크롤을 36이상 했을 때
1983          $(".sub .wide-search-wrap").addClass("fixed_list");
1984          $(".sub").addClass("sub_fixed2");
1985          $(".sub .menu-tool-wrap").css({"display":"block"});
1986          $(".btn-open-pc").click(function(){
1987			  if($(".menu-tool-gray .btn-open-pc").hasClass('on')) $(".gray-gnb-wrap").addClass('on');
1988			  else $(".gray-gnb-wrap").removeClass('on');
1989          });
1990
1991        }else{
1992          $(".sub .wide-search-wrap").removeClass("fixed_list");
1993          $(".sub").removeClass("sub_fixed2");
1994       	  $(".gray-gnb-wrap").removeClass('on');
1995		  $(".menu-tool-gray .btn-open-pc").removeClass('on');
1996          $(".sub .menu-tool-wrap").css({"display":"none"});
1997          $(".sub .gray-gnb-wrap").css({"display":"none"});
1998        }
1999    };
2000
2001   // if($(window).width() > 767) {
2002   // 	$(window).on('resize', function(){location.reload();});
2003   // }
2004  });
2005});
2006
2007$(function(){
2008  $(window).scroll(function(){  //스크롤하면 아래 코드 실행
2009    if ($(window).width() > 767){
2010        var num = $(this).scrollTop();  // 스크롤값
2011        if( num > 319 ){  // 스크롤을 36이상 했을 때
2012          $(".main .wide-search-wrap").addClass("fixed_list");
2013          //$(".main .menu-tool-wrap").css({"display":"block"});
2014          //$(".main .menu-tool-wrap").css({"display":"none"});
2015        }else{
2016          $(".main .wide-search-wrap").removeClass("fixed_list");
2017          //$(".main .menu-tool-wrap").css({"display":"none"});
2018        }
2019    }
2020    /*if($(document).scrollTop()>0) {
2021      $(".banner__content").attr("style", "display:none");
2022    } else {
2023      $(".banner__content").attr("style", "display:block");
2024    }*/
2025  });
2026});
2027
2028$(function(){
2029	$('.btn-open-pc').click(function(){
2030	});
2031/*	$(".menu-tool-gray .btn-open-pc").click(function(){
2032		$(this).toggleClass("on");
2033	});*/
2034	$('.btn-open-pc').click(function(){
2035		$(".gray-gnb-wrap").toggle();
2036	});
2037	$(".menu-tool-gray .btn-open-pc").click(function(){
2038		$(this).toggleClass("on");
2039	});
2040	$(".gray-gnb-depth1__item").hover(function(){
2041		$(this).toggleClass("on");
2042	});
2043	$(".gray-gnb-depth2__item").hover(function(){
2044		$(this).toggleClass("on");
2045  });
2046
2047	$(".btn-search--open2").click(function(){
2048		$(".search-all-wrap").addClass("on");
2049	});
2050
2051	$(".total_search").click(function(){
2052		$(".search-all-wrap").addClass("on");
2053	});
2054
2055	$(".btn-search--close").click(function(){
2056		$(".search-all-wrap").removeClass("on");
2057	});
2058});
2059
2060/* GNB 수정 24년 3월 */
2061let $lastScrollTop = 0;
2062$(window).on('load resize orientationchange scroll', function(){
2063  const $scrTop = $(this).scrollTop();
2064  const $contTop = $('#container > div').offset().top;
2065
2066  /*if ($scrTop > $lastScrollTop){
2067    $('.top_line_bnr').addClass('bnr_hide');
2068  } else if ($scrTop <= 0) {
2069    $('.top_line_bnr').removeClass('bnr_hide');
2070  }*/
2071
2072  if ($scrTop >= ($contTop + 50) && $scrTop >= $lastScrollTop){
2073    $('.header-wrap').addClass('header_hide');
2074  } else if ($scrTop < ($contTop + 50)) {
2075    $('.header-wrap').removeClass('header_hide');
2076  } else {
2077    $('.header-wrap').removeClass('header_hide');
2078  }
2079  $lastScrollTop = $scrTop;
2080});
2081var top1 = parseInt($('.search_section.integ_search').css('top'));
2082var top2 = parseInt($('.integSearch_wrap .search_header_wrap').css('top'));
2083$(window).resize(function (){
2084	top1 = parseInt($('.search_section.integ_search').css('top'));
2085	top2 = parseInt($('.integSearch_wrap .search_header_wrap').css('top'));
2086});
2087$('.top_flag_info').on('click', function(){
2088  var top_height = $('.chk_nuri_addr_bnr').innerHeight();
2089  var header_height = $('.header-wrap').innerHeight();
2090  if ($(this).hasClass('on')) {
2091    $(this).removeClass('on');
2092    $('.chk_nuri_addr_bnr').stop().slideUp();
2093    $('.search_section.integ_search').css('top', top1);
2094    $('.integSearch_wrap .search_header_wrap').css('top', top2);
2095    $(this).children('span').text('열기');
2096  } else {
2097    $(this).addClass('on');
2098    $('.chk_nuri_addr_bnr').stop().slideDown();
2099    $('.search_section.integ_search').css('top', top_height + top1);
2100    $('.integSearch_wrap .search_header_wrap').css('top', top_height + top2);
2101    $(this).children('span').text('닫기');
2102  }
2103});
2104$('.nl_new_nav > ul > li > a').prop("title","하위메뉴 열기");
2105
2106$('.nl_new_nav > ul > li').on('click', function(){
2107  if ($(this).children().hasClass('on')) {
2108    $(this).find('a').removeClass('on');
2109    $(this).find('a').prop("title","하위메뉴 열기");
2110    subMenuFold();
2111  } else {
2112    $('.nav_dimm').stop().fadeIn();
2113    $('body').css({
2114      'overflow':'hidden'
2115    });
2116    $('.nl_new_nav > ul > li > a').removeClass('on');
2117    $('.nl_new_nav > ul > li > a').prop("title","하위메뉴 열기");
2118    $(this).find('a').addClass('on');
2119    $(this).find('a').prop("title","하위메뉴 닫기");
2120    $('.sub_menu').stop().slideUp();
2121    const subMenuH = $(this).find('a').siblings('.sub_menu').height();
2122    $(this).find('a').siblings('.sub_menu').stop().slideDown();
2123    $('.nl_new_nav_bg').stop().animate({
2124      'height':subMenuH * 0.7 + 'px'
2125    });
2126  }
2127});
2128$('.nav_dimm').on('click', function(){
2129  subMenuFold();
2130});
2131
2132function subMenuFold() {
2133  $('.nav_dimm').stop().fadeOut();
2134  $('body').css({
2135    'overflow':'inherit',
2136    'overflow-x':'hidden'
2137  });
2138  $('.nl_new_nav > ul > li > a').removeClass('on');
2139  $('.sub_menu').stop().slideUp();
2140  $('.nl_new_nav_bg').stop().animate({
2141    'height':'0'
2142  });
2143}
2144var menu_lyr_flag = true;
2145$('.nl_header_utils > ul > li').on('click', function(){
2146	if(menu_lyr_flag){
2147		$(this).children().addClass('on');
2148		$(this).children().siblings('.func_menus_lyr').show();
2149		menu_lyr_flag = false;
2150	}else{
2151		$(this).children().removeClass('on');
2152		$(this).children().siblings('.func_menus_lyr').hide();
2153		menu_lyr_flag = true;
2154	}
2155
2156});
2157/*$(document).on('mouseup', function(e){
2158  $('.nl_header_utils > ul > li').children().removeClass('on');
2159  if ($('.func_menus_lyr').has(e.target).length === 0) {
2160    $('.func_menus_lyr').hide();
2161  }else{
2162  }
2163});*/
2164
2165$('.size_sel_list > li, .lang_sel_list > li').on('click', function(){
2166  $('.size_sel_list > li, .lang_sel_list > li').find('a').removeClass('on');
2167  $(this).children('a').addClass('on');
2168});
2169
2170$('.pers_menus').on('click', function(){
2171  $(this).children().addClass('on');
2172  $(this).children().siblings('.pers_menus_lyr').show();
2173});
2174$(document).on('mouseup', function(e){
2175  $('.pers_menus').children().removeClass('on');
2176  if ($('.pers_menus_lyr').has(e.target).length === 0) {
2177    $('.pers_menus_lyr').hide();
2178  }
2179});
2180
2181/*$('.mob_sub_cate_slick').slick({
2182  accessibility: false,
2183  arrows: false,
2184  dots: false,
2185  autoSlidesToShow: true,
2186  variableWidth: true,
2187  draggable: true,
2188  infinite: false,
2189  autoplay: false,
2190  centerMode: false
2191});*/
2192
2193$(window).on('load resize', function(){
2194  const myWinW = $(window).width();
2195  if (myWinW <= 960) {
2196    $('h3.sub_cont_ttl').addClass('active');
2197  } else {
2198    $('h3.sub_cont_ttl').removeClass('active');
2199  }
2200});
2201$('h3.sub_cont_ttl').on('click', function(){
2202  if ($(this).hasClass('active')) {
2203    if ($(this).hasClass('open')) {
2204      $(this).removeClass('open');
2205    } else {
2206      $(this).addClass('open');
2207    }
2208    $('h3.sub_cont_ttl .sub_cont_ttl_menus').stop().slideToggle();
2209  }
2210});
2211$('.mob_btn_berger > a').on('click', function(){
2212  $('body').css({
2213    'overflow':'hidden'
2214  });
2215  $('.header-wrap').addClass('fix');
2216  setTimeout(function(){
2217    $('.mob_gnb_wrap').addClass('open');
2218  }, 300);
2219});
2220$('.mob_gnb_bg > button').on('click', function(){
2221  $('body').css({
2222    'overflow-y':'auto'
2223  });
2224  $('.header-wrap').removeClass('fix');
2225  $('.mob_gnb_wrap').removeClass('open');
2226});
2227
2228$('.mob_gnb_1depth a').on('click', function(){
2229  $('.mob_gnb_1depth a').removeClass('on');
2230  $(this).addClass('on');
2231});
2232
2233$('.has_4depth').on('click', function(){
2234  $(this).siblings('.gnb_4depth_wrap').addClass('open');
2235});
2236$('.gnb_4depth_wrap > button').on('click', function(){
2237  $('.gnb_4depth_wrap').removeClass('open');
2238});
2239
2240$('.mob_gnb_menus').scroll(function(e){
2241  const thisST = $(this).scrollTop();
2242  const thisInnerH = $(this).innerHeight();
2243  const thisSH = this.scrollHeight;
2244  const mobGNBTH = $('.mob_gnb_t').innerHeight();
2245  // console.log('thisST: ' + thisST);
2246  // console.log('thisSH: ' + thisSH);
2247  // console.log('thisInnerH: ' + thisInnerH);
2248
2249  $('.gnb_2depth_each').each(function(i){
2250    const thisT = $(this).offset().top;
2251    if (thisT - 10 <= mobGNBTH) {
2252      const nowBtn = $('.mob_gnb_1depth a').eq(i).attr('href');
2253      $('.mob_gnb_1depth a').removeClass('on');
2254      $('.mob_gnb_1depth a[href="' + nowBtn + '"]').addClass('on');
2255    } else if (thisST + thisInnerH >= thisSH) {
2256      $('.mob_gnb_1depth a').removeClass('on');
2257      $('.mob_gnb_1depth ul li:last-child a').addClass('on');
2258    }
2259  });
2260});
2261/* GNB 수정 24년 3월 end */
2262
2263/* 통합 검색 레이어 24년 2월 */
2264$('.prv_menus > ul > li.total_search > a').on('click', function(){
2265	$("#kwd").val("");
2266	$('.total_search_pop').stop().fadeIn();
2267	$('.total_search_tabs .sjtab').focus();
2268
2269	$('body').css({
2270		'overflow':'hidden'
2271	});
2272
2273	$('.nl_header_utils .none_sub:first-child').on('focus', function(){
2274		$('.total_search_pop > button.close').focus();
2275	});
2276
2277	var tsp = document.getElementById("tsp");
2278	if(tsp.scrollHeight > tsp.clientHeight){
2279		if($(".btn-detail-search").hasClass("is-open")){
2280			$(".quick_menu_wrap .quick_btn.on_btn").css("right","100px");
2281			$(".quick_menu.detail-seachbox").css("right","15px");
2282		}else{
2283			$(".quick_menu_wrap .quick_btn.on_btn").css("right","-27px");
2284		}
2285	}
2286	window.addEventListener("resize", function(){
2287		if(tsp.scrollHeight > tsp.clientHeight){
2288			if($(".btn-detail-search").hasClass("is-open")){
2289				$(".quick_menu_wrap .quick_btn.on_btn").css("right","100px");
2290				$(".quick_menu.detail-seachbox").css("right","15px");
2291			}else{
2292				$(".quick_menu_wrap .quick_btn.on_btn").css("right","-27px");
2293			}
2294		}else{
2295			if($(".btn-detail-search").hasClass("is-open")){
2296				$(".quick_menu_wrap .quick_btn.on_btn").css("right","85px");
2297				$(".quick_menu.detail-seachbox").css("right","0px");
2298			}else{
2299				$(".quick_menu_wrap .quick_btn.on_btn").css("right","-42px");
2300			}
2301
2302		}
2303	});
2304});
2305
2306$('.total_search_pop > button.close').on('click', function(){
2307	  $('.total_search_pop').stop().fadeOut();
2308	  $(".total_search").find("a").focus();
2309	  $('body').css({
2310	    'overflow':'inherit',
2311	    'overflow-x':'hidden'
2312	  });
2313});
2314// 통합검색 레이어 켜져있는경우 스크롤 비교해서 quick menu 위치 옮기기
2315$(function(){
2316
2317});
2318
2319if(!$("#tsp").is(":hidden")){
2320	console.log("not hidden ");
2321	var tsp = document.getElementById("tsp");
2322	window.addEventListener("resize", function(){
2323		console.log("tsp.scrollHeight : " + tsp.scrollHeight);
2324		console.log("tsp.clientHeight : " + tsp.clientHeight);
2325	});
2326}else{
2327	console.log("hidden ");
2328}
2329
2330const totalSrchVal = $('.total_srch_pop_input > input').val();
2331$('.total_srch_pop_input > input').on('change keyup paste', function(){
2332  if (totalSrchVal === null) {
2333    $('.total_srch_pop_field').removeClass('on');
2334  } else {
2335    $('.total_srch_pop_field').addClass('on');
2336  }
2337});
2338/* 통합 검색 레이어 24년 2월 end */
2339
2340/* 시작하기전에 24년 2월 */
2341$('.wanted_books_guide > div > strong').on('click', function(){
2342  if ($(this).hasClass('open')) {
2343    $(this).removeClass('open');
2344    $(this).siblings('ul').stop().slideUp();
2345  } else {
2346    $(this).addClass('open');
2347    $(this).siblings('ul').stop().slideDown();
2348  }
2349});
2350/* 시작하기전에 24년 2월 end */
2351
2352/* 로그인방식 설명 24년 2월 */
2353$('.login_method_tabs button').on('click', function(){
2354  $('.login_method_tabs button').removeClass('on');
2355  $('.login_method_tabs button').removeAttr('title');
2356  $(this).addClass('on');
2357  $(this).prop('title','선택됨');
2358
2359  if ($(this).hasClass('ordi')) {
2360    $('#login_ordi_mem_guide').show();
2361    $('#login_orga_mem_guide').hide();
2362
2363    $('#login_links_ordi').show();
2364    $('#login_links_orga').hide();
2365
2366    $('.diff_method_guide').show();
2367    $('.orga_mem_exp').hide();
2368
2369    $('.ordi_tel').show();
2370    $('.orga_tel').hide();
2371  } else if ($(this).hasClass('orga')) {
2372	$('#login_ordi_mem_guide').hide();
2373    $('#login_orga_mem_guide').show();
2374
2375    $('#login_links_ordi').hide();
2376    $('#login_links_orga').show();
2377
2378    $('.diff_method_guide').hide();
2379    $('.orga_mem_exp').show();
2380
2381    $('.ordi_tel').hide();
2382    $('.orga_tel').show();
2383  }
2384});
2385
2386$('.method_each > button').on('click', function(){
2387  if ($(this).hasClass('open')) {
2388    $(this).removeClass('open');
2389    $(this).next('.diff_method_cont').stop().slideUp();
2390  } else {
2391    $(this).addClass('open');
2392    $(this).next('.diff_method_cont').stop().slideDown();
2393  }
2394});
2395/* 로그인방식 설명 24년 2월 end */
2396
2397/* footer 수정 24년 2월 */
2398$('.relative_org a').on('click', function(){
2399  $('.relative_org_pop').fadeIn();
2400  $('.relative_org_pop').attr('tabindex', '0').focus();
2401  $('body').css({
2402    'overflow':'hidden'
2403  });
2404});
2405$('.relative_org_pop button').on('click', function(){
2406  $('.relative_org_pop').fadeOut();
2407  $('body').css({
2408    'overflow':'inherit',
2409    'overflow-x':'hidden'
2410  });
2411});
2412/* footer 수정 24년 2월 end */
2413
2414/* LNB 수정 24년 3월 */
2415$('.sub_lnb_wrap nav > ul > li > a.has_sub').prop("title","하위메뉴 열기");
2416
2417$('.sub_lnb_wrap nav > ul > li > a.has_sub').on('click', function(){
2418	$(this).prop("title","하위메뉴 닫기");
2419	$('.sub_lnb_wrap nav > ul > li > a.has_sub').not(this).prop("title","하위메뉴 열기");
2420	$('.sub_lnb_wrap nav > ul > li > a.has_sub').not(this).removeClass('open');
2421	$('.sub_lnb_wrap nav > ul > li > a').not(this).removeClass('opened');
2422    $('.sub_lnb_wrap nav > ul > li > a.has_sub').not(this).siblings('ul').stop().slideUp();
2423  if ($(this).hasClass('open')) {
2424    $(this).removeClass('open');
2425    $(this).prop("title","하위메뉴 열기");
2426    $(this).siblings('ul').stop().slideUp();
2427  } else {
2428    $(this).addClass('open');
2429    $(this).siblings('ul').stop().slideDown();
2430  }
2431});
2432/* LNB 수정 24년 3월 end */
2433
2434/* LNB 수정 24년 6월 신규 함수 추가 */
2435function nowPageByIdNew(fullCode,type){
2436	var classStr = "active";
2437	var menuArr = fullCode.toUpperCase().split(">");
2438
2439	if(type == "SNB2"){
2440		for(var i in menuArr) {
2441			$("#"+type+"_"+menuArr[i] +" > a").addClass("opened");
2442			$("#"+type+"_"+menuArr[i] +" > a").trigger("click");
2443		}
2444	}else if(type == "TAB2" || type == "MTAB2"){
2445		classStr = "on";
2446		for(var i in menuArr) {
2447			$("#"+type+"_"+menuArr[i]).addClass("on");
2448		}
2449
2450	}
2451}
2452/* LNB 수정 24년 6월 신규 함수 추가 end*/
2453
2454/* 4뎁스 추가 24년 3월 */
2455$('.with_depth4').on('click', function(){
2456  $('.depth_menu_wrap').addClass('open');
2457});
2458$('.depth_menu_ttl button').on('click', function(){
2459  $('.depth_menu_wrap').removeClass('open');
2460});
2461/* 4뎁스 추가 24년 3월 end */
2462
2463$.fn.gnb1 = function(options) {
2464    var settings = $.extend({
2465            'actionType': 'click', // 메뉴가 동작하는 액션 (mouseenter focusin, click)
2466            'target': '#header', // 활성화 시 클래스가 추가되는 요소 (공란일 경우 오버되는 a 링크 부모 li에만 클래스 추가됨)
2467            'className': 'active', // 추가할 클래스명 (target에 추가됨)
2468            'depth2': '.sub_menu', // 서브메뉴
2469            'closeBtn': '.close' // 닫기 버튼이 별도로 존재하는 경우 (닫기 버튼은 클릭시에만)
2470        },
2471        options);
2472
2473    return this.each(function() {
2474        var $selecter = $(this);
2475
2476        $selecter.find('a').on(settings.actionType, function() {
2477            if ($(this).parent('li').hasClass('active') == false) {
2478                $(this).parents('li').addClass('active');
2479                $("#menu-gnb > ul > li > a").find(".sr_only").text("열기");
2480                $(this).find(".sr_only").text("닫기");
2481                $(this).parents('li').siblings('li').removeClass('active');
2482                $(this).parents('li').siblings('li').find('li').removeClass('active');
2483
2484                if (settings.target != '') {
2485                    $(settings.target).addClass(settings.className);
2486                }
2487            } else {
2488                if ($(this).next(".sub_menu").length) {
2489                    $(this).closest('li').removeClass('active');
2490                    $(this).find(".sr_only").text("열기");
2491                    $(settings.target).removeClass(settings.className);
2492                }
2493            }
2494
2495            if (settings.actionType == 'click') {
2496                if ($(this).next('*').length > 0) {
2497                    return false;
2498                }
2499            }
2500            menuH();
2501        });
2502
2503        $("#menu-gnb > ul > li > a").on("click", function() {
2504            if (!$(this).closest("li").find(".sub_menu > ul > li").is(".on, .active")) {
2505                $(this).closest("li").find(".sub_menu > ul > li").eq(0).addClass(settings.className);
2506            } else if ($(this).closest("li").find(".sub_menu > ul > li.on").length) {
2507                $(this).closest("li").find(".sub_menu > ul > li").removeClass(settings.className);
2508                $(this).closest("li").find(".sub_menu > ul > li.on").addClass(settings.className);
2509            }
2510
2511            $(this).closest("li").find(".sub_menu > ul > li").each(function() {
2512                if ($(this).hasClass("on")) {
2513                    $(this).addClass(settings.className);
2514                }
2515            });
2516            menuH();
2517            if ($(this).closest("li").find(".sub_menu").length) {
2518                return false;
2519            }
2520        });
2521
2522        function menuH() {
2523            let d2H = 0;
2524            let d3H = 0;
2525            d2H = $(".topmenu").find("> li.active .sub_menu").innerHeight() + 50;
2526            d3H = $(".topmenu").find("> li.active .sub_menu .active .dep3").innerHeight();
2527            //alert("d2H : " + d2H + " d3H : " + d3H);
2528            if (d2H < d3H) {
2529                $(".topmenu").find("> li.active .sub_menu").removeAttr("style");
2530                $(".topmenu").find("> li.active .sub_menu").height(d3H);
2531            }
2532            //$(".topmenu").find("> li.active .sub_menu").height(d2H * 0.7);
2533        }
2534
2535        if ($selecter.find(settings.closeBtn).length == 1) {
2536            $selecter.find(settings.closeBtn).on('click', function() {
2537                $selecter.find('li').removeClass(settings.className);
2538                $("#menu-gnb > ul > li > a").find(".sr_only").text("열기");
2539                $(settings.target).removeClass(settings.className);
2540
2541                return false;
2542            });
2543        } else {
2544            // 마우스 아웃
2545        	/*let cursorY;
2546            $(document).on('click', function (e) {
2547            	console.log("className = " + $(e.target).parent().getAttribute("class"));
2548            	console.log("className = " + e.target.className);
2549                cursorY = e.pageY;
2550                if ($selecter.find('li.active').length > 0) {
2551                    if (cursorY > parseInt($selecter.find(settings.depth2).offset().top + $selecter.find('.active').find(settings.depth2).innerHeight())) {
2552	                	if (cursorY > parseInt($(".top_line_bnr").height() + $(".header-wrap").height() + $
2552selecter.find('.active').find(settings.depth2).innerHeight())) {
2553	                        setTimeout(function () {
2554	                            //closeMenu();
2555	                        }, 200);
2556	                    }
2557	                }
2558                }
2559            });*/
2560
2561            $("#menu-gnb .sub_menu").on("mouseleave",function(){
2562                //closeMenu();
2563            });
2564
2565            $(document).on("click", function(e) {
2566                if (!$(e.target).parents().is(".topmenu") || $(e.target).is(".sub_menu")) {
2567                	closeMenu();
2568                }
2569            });
2570        }
2571
2572        function closeMenu() {
2573        	/*alert($selecter.attr("className"));*/
2574            $selecter.find('li').removeClass(settings.className);
2575            $("#menu-gnb > ul > li > a").find(".sr_only").text("열기");
2576            $(settings.target).removeClass(settings.className);
2577        }
2578
2579        // 탭 아웃
2580        window.addEventListener("keyup", (e) => {
2581            if (!e.target.closest("#menu-gnb")) {
2582                //closeMenu();
2583            }
2584        });
2585
2586        /* $selecter.find('a:last').keydown(function (e) {
2587            if (e.keyCode === 9) {
2588                $selecter.find('li').removeClass(settings.className);
2589                $(settings.target).removeClass(settings.className);
2590            }
2591        }); */
2592
2593        // 역탭 아웃
2594        $selecter.find('a:first').keydown(function(e) {
2595            if (e.keyCode === 9 && e.shiftKey) {
2596                //closeMenu();
2597            }
2598        });
2599    });
2600};
2601
2602// GNB 메뉴 하위메뉴 있는지 확인
2603$("#menu-gnb li a").each(function() {
2604    const t = $(this);
2605
2606    if (t.next().length) {
2607        t.closest("li").addClass("plus");
2608    }
2609});
2610
2611$("#menu-gnb .sub_menu > ul > li").eq(0).each(function() {
2612    $(this).addClass("active");
2613});
2614
2615$("#menu-gnb").gnb1();
2616// 통합검색 레이어팝업 탭 추가 20250320 JSH
2617/*$('.total_search_tabs button').on('click', function(){
2618	  $('.total_search_tabs button').removeClass('on');
2619	  $(this).addClass('on');
2620	  var pr_plus = parseInt($(".total_srch_pop_input > .btn_sch").css("width")) + parseInt($(".total_srch_pop_input").css("padding-left"));
2621	  if ($(this).hasClass('sjtab')) { // 소장자료
2622		  $("#worldWordPC").show();
2623		  var pr = 0;
2624		  if ($(window).width() > 960){
2625			  pr = 242;
2626		  }else if($(window).width() < 961 && $(window).width() > 640){
2627			  pr = 180;
2628		  }else{
2629			  pr = 145;
2630		  }
2631		  $(".total_srch_pop_input").css("padding-right", pr);
2632	  } else if ($(this).hasClass('hmtab')) { // 홈페이지
2633		  $("#worldWordPC").hide();
2634		  $(".total_srch_pop_input").css("padding-right", pr_plus + 10);
2635	  }
2636});*/
2637
2638function srOnlyTab(e){
2639	if($(e.target).is("class") && $(e.target).attr("class").indexOf("tab") > -1){ //tab에 추가
2640		/*alert($(e.target).attr("class"));*/
2641		$('.sr-only.tab').each(function(){
2642			$(this).remove();
2643		});
2644		console.log($(e.target).attr("class"));
2645		$(e.target).append('<span class="sr-only tab">선택됨</span>')
2646	}
2647}

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.