PageSourceSearch

https://m.whodadoc.com/assets/consumer/mobile/js/feCommon.js?id=d69242c1-75cf-4af3-879c-bbfb3f759904

js whodadoc.com collected 2026-10-02 13:32:03 UTC 89,861 bytes, 2,718 lines download raw bytes

1/* feCommon.js | IDOP CONSUMER MOBILE */
2/*
3	Required(Vendor)
4	- jQuery v3.4.0
5	- jQuery UI v1.12.1: widget.js, data.js, focusable.js, keycode.js, scroll-parent.js, widgets/draggable.js, widgets/sortable.js, widgets/datepicker.js, widgets/mouse.js
6	- jQuery Browser mobile
7	- jQuery CSS Customizable Scorllbar v0.2.10
8	- jQuery Modal v0.9.2
9	- jQuery Mask 1.14.15
10	- jQuery selectize v0.12.6
11	- jQuery Slick slider 1.8.0
12	- jQuery Highlight
13	- jQuery TouchSwipe 1.6.18
14	- jQuery ellipsis
15*/
16// @formatter:off
17var feUI = feUI || {};
18(function(feUI, $, window, document, undefined) {
19	'use strict';
20	// Common variable
21	var ClassName = {
22			ACTIVE: 'active',
23			CURRENT: 'current',
24			CHECKED: 'checked',
25			DISABLED: 'disabled',
26			JS_ACTIVE: 'js-active',
27			MODAL_ACTIVE: 'modal-active',
28			NAVBAR_FIXED: 'navbar-fixed',
29			OUTLINE_DISABLE: 'outline-disable',
30			LOCKSCROLL: 'lock-scroll'
31		};
32	var EVENT_KEY = '.feUI',
33		Event = {
34			KEYDOWN: 'keydown' + EVENT_KEY,
35			KEYUP: 'keyup' + EVENT_KEY,
36			CLICK: 'click' + EVENT_KEY,
37			RESIZE: 'resize' + EVENT_KEY,
38			SCROLL: 'scroll' + EVENT_KEY
39		};
40	var $WINDOW = $(window),
41		$DOCUMENT = $(document),
42		WINDOW_WIDTH = $WINDOW.width(),
43		WINDOW_HEIGHT = $WINDOW.height(),
44		SCROLLTOP_POS = $WINDOW.scrollTop(),
45		SCROLL_UP, SCROLL_DOWN;
46	var $HTML = $('html').addClass(ClassName.OUTLINE_DISABLE),
47		$BODY = $HTML.find('body').off(EVENT_KEY).on(Event.KEYDOWN, function(e) {
48			if ( e.keyCode === 9 ) $HTML.removeClass(ClassName.OUTLINE_DISABLE);
49		}).on(Event.KEYUP, function(e) {
50			if ( e.keyCode === 13 ) $HTML.removeClass(ClassName.OUTLINE_DISABLE);
51		}).on(Event.CLICK, function() {
52			$HTML.addClass(ClassName.OUTLINE_DISABLE);
53		}),
54		$WRAP = $BODY.find('.wrap'),
55		$CONTENT = $BODY.find('.content'),
56		$NAVBAR = $BODY.find('.navbar'),
57		$DIMMED_LAYER = ( $NAVBAR.find('.dimmedLayer').length )
58			? $NAVBAR.find('.dimmedLayer')
59			: $NAVBAR.append('<div class="dimmedLayer"></div>').find('.dimmedLayer');
60	var ANI_SPEED = 100;
61	var IS_PREVIEW_IFRAME = ( window.location.search.indexOf('iframe') > -1 ) ? true : false,
62		IS_MAIN_IFRAME = ( !IS_PREVIEW_IFRAME && $(window.frameElement).hasClass('slide-iframe') ) ? true : false,
63		NAVBAR_LINK_ARR = [];
64
65	feUI.mainNavClicked = false;
66
67	// LayoutClass
68	feUI.LayoutClass = function() {
69		var hasAsideClass = 'has-aside',
70			hasBottomBtnClass = 'has-bottomBtn',
71			previewOverlayClass = 'preview-overlay',
72			mainIframeClass = 'iframe-slide';
73		// Preview
74		if ( IS_PREVIEW_IFRAME ) {
75			$HTML.addClass(ClassName.JS_ACTIVE);
76			$BODY.addClass(previewOverlayClass);
77		}
78		// Main Iframe page
79		( IS_MAIN_IFRAME ) ? $BODY.addClass(mainIframeClass) : $BODY.removeClass(mainIframeClass);
80		// Aside
81		if ( $BODY.find('aside:visible').length )
82			$CONTENT.filter('#content').addClass(hasAsideClass);
83		// Bottom button
84		$CONTENT.each(function() {
85			var $this = $(this);
86			( $this.find('[class^=btn-group].bottom:not([class*=modal] [class^=btn-group].bottom), .btn.btn-bottom, .btn_more').length )
87				? $this.closest($CONTENT).addClass(hasBottomBtnClass)
88				: $this.closest($CONTENT).removeClass(hasBottomBtnClass);
89
90			//($this.find('div#modalClass [class^=btn-group]').length) ? $this.closet($CONTENT).removeClass(hasBottomBtnClass);
91		});
92		// Map
93		( $BODY.find('.map:visible:not(.modal .map)').length )
94			? $CONTENT.filter('#content').addClass('has-map')
95			: $CONTENT.filter('#content').removeClass('has-map');
96	};
97	feUI.LayoutClass();
98	// Disable invalid alert
99	feUI.DisableInvalidAlert = function() {
100		var EVENT_KEY = '.DisableInvalidAlert',
101			Event = {
102				INVALID: 'invalid' + EVENT_KEY
103			};
104		var required = '[required]';
105		$BODY.off(EVENT_KEY).on(Event.INVALID, required, function(e) {
106			e.preventDefault();
107		});
108	};
109	feUI.DisableInvalidAlert();
110	// Skip To Content
111	feUI.SkipToContent = function() {
112		var EVENT_KEY = '.SkipToContent',
113			Event = {
114				CLICK: 'click' + EVENT_KEY,
115				KEYDOWN: 'keydown' + EVENT_KEY
116			};
117		var $skipNaviBtn = $BODY.find('a.skip-navigation'),
118			targetId = $skipNaviBtn.attr('href');
119		if ( !$skipNaviBtn.length ) return false;
120		if ( !$CONTENT.length ) $skipNaviBtn.hide();
121		$skipNaviBtn.off(EVENT_KEY).on(Event.CLICK, function(e) {
122			e.preventDefault();
123			$(targetId).attr('tabindex', 0).focus()
124				.off(EVENT_KEY).on(Event.KEYDOWN, function(e) {
125					if ( e.keyCode === 9 ) $(this).removeAttr('tabindex');
126				});
127		});
128	};
129	feUI.SkipToContent();
130	// Focus rotation(Required: jQuery UI)
131	feUI.FocusRotation = function($target) {
132		var EVENT_KEY = '.FocusRotation',
133			Event = {
134				KEYDOWN: 'keydown' + EVENT_KEY
135			};
136		var $selectize = $target.find(':focusable:first').closest('.selectize-control');
137		if ( !$target ) return false;
138		( $selectize.length )
139			? $target.find(':focusable:last').focus()
140			: $target.find(':focusable:first').focus();
141		$target.off(EVENT_KEY).on(Event.KEYDOWN, ':focusable:first', function(e) {
142			if ( e.keyCode === 9 && e.shiftKey ) {
143				e.preventDefault();
144				$target.find(':focusable:last').focus();
145			}
146		}).on(Event.KEYDOWN, ':focusable:last', function(e) {
147			if ( e.keyCode === 9 && !e.shiftKey ) {
148				e.preventDefault();
149				$target.find(':focusable:first').focus();
150			}
151		});
152	};
153	// Document title
154	feUI.DocumentTitle = function() {
155		var documentTitle = $DOCUMENT.attr('title'),
156			pageTitleTxt = $BODY.find('h2, .h2').filter(':first').text(),
157			activeTabTxt = $BODY.find('.tab li a.' + ClassName.ACTIVE).filter(':first').text(),
158			newTitle = ( !pageTitleTxt.length )
159				? documentTitle : ( !activeTabTxt.length )
160					? pageTitleTxt + ' | ' + documentTitle
161					: activeTabTxt + ' | ' + pageTitleTxt + ' | ' + documentTitle;
162		// 회원가입
163		var activeStepTxt = $BODY.find('.step-info li.' + ClassName.ACTIVE).filter(':first').text();
164		if ( activeStepTxt.length ) newTitle = activeStepTxt + ' | ' + newTitle;
165		// Reset title
166//		newTitle = '후다닥건강'; // 임시
167
168//		console.log(documentTitle+"//"+pageTitleTxt+"//"+activeTabTxt);
169
170//		$DOCUMENT.attr('title', newTitle);
171
172		$("#metaOgTitle").attr("content", documentTitle);
173	};
174	feUI.DocumentTitle();
175	// All check checkbox
176	feUI.SaveHTMLTemplate = function(temp) {
177		var EVENT_KEY = '.SaveHTMLTemplate',
178			Event = {
179				CLICK: 'click' + EVENT_KEY
180			};
181		var Data = {
182				TEMPLATE: 'data-template',
183				GROUP: 'data-template-group',
184				SIZE: 'data-template-size',
185				IDX: 'data-template-idx'
186			},
187			dataTemplate = '[' + Data.TEMPLATE + ']';
188		var template = '.template' + dataTemplate,
189			addBtn = '.template-add' + dataTemplate,
190			delBtn = '.template-del' + dataTemplate,
191			templateBtn = addBtn + ',' + delBtn,
192			htmlTemplate = {};
193		// Save template
194		$(template).each(function() {
195			var $this = $(this),
196				templateName = $this.attr(Data.TEMPLATE),
197				cloneCode = $this.clone().removeClass('template');
198			if ( htmlTemplate[templateName] ) return;
199			htmlTemplate[templateName] = $('<div />').append(cloneCode).html();
200		});
201		// Template index
202		setTemplateIdx();
203		// Group template size
204		$BODY.find('[' + Data.GROUP + ']').not(templateBtn).each(function() {
205			var $this = $(this),
206				templateSize = $this.find(dataTemplate).not(template + ',' + templateBtn).filter(':first')
207					.parent().find('> ' + dataTemplate).not(template + ',' + templateBtn).length;
208			$this.attr(Data.SIZE, templateSize);
209		});
210		// Button
211		$BODY.off(EVENT_KEY).on(Event.CLICK, templateBtn, function(e) {
212			var $this = $(this),
213				templateName = $this.attr(Data.TEMPLATE),
214				templateGroup = $this.attr(Data.GROUP),
215				$addTarget = $('[' + Data.TEMPLATE + '="' + templateName + '"]').not(templateBtn),
216				$addGroup = $this.closest('[' + Data.GROUP + '="' + templateGroup + '"]:not(' + templateBtn + ')'),
217				$addedItem, templateSize;
218			e.preventDefault();
219			// Add
220			if ( $this.is(addBtn) ) {
221				if ( templateGroup ) $addTarget = $addGroup.find($addTarget);
222				$addTarget.filter(':last').after(htmlTemplate[templateName]);
223				$addedItem = $addTarget.filter(':last').next($addTarget);
224				// Size
225				templateSize = $addTarget.length;
226				// Select
227				if ( $addedItem.find('.select').length ) feUI.Select.init();
228				// Sortable
229				if ( $addedItem.find('.sortable, .table-sortable').length ) feUI.Sortable();
230				// Template
231				if ( $addedItem.find('.template' + dataTemplate).length ) feUI.SaveHTMLTemplate();
232			}
233			// Delete
234			if ( $this.is(delBtn) ) {
235				// Size
236				templateSize = $this.closest($addTarget).siblings($addTarget).length - 1;
237				// Delete
238				$this.closest($addTarget).remove();
239			}
240			// Group template size
241			if ( templateGroup ) $addGroup.attr('data-template-size', templateSize);
242			// Template index
243			setTemplateIdx();
244		});
245		// Set template index
246		function setTemplateIdx() {
247			$.each(htmlTemplate, function(htmlTemplate) {
248				var $tgTemplate = $('[' + Data.TEMPLATE + '="' + htmlTemplate + '"]').not(template + ',' + templateBtn);
249				$tgTemplate.each(function(idx, el) {
250					var $this = $(el),
251						templateIdx = idx + 1,
252						$hasIdAttr = $this.find('[id]').not('[data-template-changed-id]'),
253						$hasNameAttr = $this.find('[name]').not('[data-template-changed-name]');
254					$this.attr(Data.IDX, templateIdx);
255					// Name
256					if ( $hasNameAttr.length ) changeAttrIdx($hasNameAttr, 'name', templateIdx);
257				});
258			});
259		}
260		// Change attribute
261		function changeAttrIdx($target, attr, templateIdx) {
262			$target.each(function() {
263				var $this = $(this),
264					originVal = $this.prop(attr);
265				$this.prop(attr, originVal + templateIdx).attr('data-template-changed-' + attr, originVal);
266			});
267		}
268		// Return
269		if ( arguments.length !== 0 && htmlTemplate[temp] ) return htmlTemplate[temp];
270	};
271	feUI.SaveHTMLTemplate();
272	// Form label toggle class
273	feUI.FormLabelClass = function() {
274		var EVENT_KEY = '.FormLabelClass',
275			Event = {
276				CHANGE: 'change' + EVENT_KEY
277			};
278		var targetFormEl = '.checkbox :checkbox, .radio :radio';
279		$BODY.off(EVENT_KEY).on(Event.CHANGE, targetFormEl, function() {
280			var $this = $(this),
281				$label = $this.closest('label');
282			( $this.is(':checked') )
283				? $label.addClass(ClassName.CHECKED)
284				: $label.removeClass(ClassName.CHECKED);
285			( $this.is(':disabled') )
286				? $label.addClass(ClassName.DISABLED)
287				: $label.removeClass(ClassName.DISABLED);
288			// Radio button
289			if ( $this.is(':radio') ) {
290				$(targetFormEl).filter(':radio[name="' + $this.prop('name') + '"]:not(:checked)')
291					.closest('label').removeClass(ClassName.CHECKED);
292			}
293		}).find(targetFormEl).trigger(Event.CHANGE);
294	};
295	feUI.FormLabelClass();
296	// All check checkbox
297	feUI.CheckAllCheckbox = function() {
298		var EVENT_KEY = '.CheckAllCheckbox',
299			Event = {
300				CHANGE: 'change' + EVENT_KEY
301			};
302		var contentCheckbox = ':checkbox[data-group]:not(:disabled)',
303			tableCheckbox = 'tr > :first-child > .checkbox :checkbox:not(:disabled)';
304		$BODY.off(EVENT_KEY).on(Event.CHANGE, contentCheckbox + ',' + tableCheckbox , function(e) {
305			var $this = $(this),
306				contentType = $this.is(contentCheckbox),
307				groupData = $this.data('group'),
308				$targetGroup = ( contentType )
309					? $(contentCheckbox).filter('[data-group="' + groupData + '"]')
310					: $this.closest('table'),
311				$checkAllBtn = ( contentType )
312					? $targetGroup.filter('.checkbox-all')
313					: $targetGroup.find('thead :checkbox:not(:disabled)'),
314				$targetCheckbox = ( contentType )
315					? $targetGroup.not($checkAllBtn)
316					: $targetGroup.find(':checkbox').not($checkAllBtn),
317				targetCheckboxSize = $targetCheckbox.length,
318				isChecked = $this.is(':checked');
319			if ( isChecked ) {
320				if ( $this.is($checkAllBtn) ) $targetCheckbox.not(':disabled').prop('checked', true);
321				if ( $targetCheckbox.filter(':checked').length === targetCheckboxSize )
322					$checkAllBtn.prop('checked', true);
323			} else {
324				( $this.is($checkAllBtn) )
325					? $targetCheckbox.not(':disabled').prop('checked', false)
326					: $checkAllBtn.prop('checked', false);
327			}
328			feUI.FormLabelClass();
329		}).find(contentCheckbox + ',' + tableCheckbox).filter(':checked').trigger(Event.CHANGE);
330	};
331	feUI.CheckAllCheckbox();
332	// Input type file
333	feUI.FileInput = function() {
334		var EVENT_KEY = '.FileInput',
335			Event = {
336				CHANGE: 'change' + EVENT_KEY
337			};
338		var targetFileInp = '.file :file';
339		$BODY.find(targetFileInp).each(function() {
340			var $this = $(this),
341				$targetWrap = $this.closest('.file-group'),
342				$targetInp = $targetWrap.find('.textfield');
343			if ( $this.is(':disabled') ) {
344				$targetInp.prop('disabled', true);
345				$targetWrap.addClass(ClassName.DISABLED);
346			} else {
347				$targetInp.prop('disabled', false);
348				$targetWrap.removeClass(ClassName.DISABLED);
349			}
350		}).end().off(EVENT_KEY).on(Event.CHANGE, targetFileInp, function() {
351			var $this = $(this),
352				$resultInp = $this.closest('.file').prev('.textfield');
353			$resultInp.val($this.val());
354		});
355	};
356	feUI.FileInput();
357	// Highlight Input
358	feUI.HighlightInput = function() {
359		var EVENT_KEY = '.HighlightInput',
360			Event = {
361				KEYUP: 'keyup' + EVENT_KEY
362			};
363		var highlightData = 'data-highlight',
364			tgHighlightInp = ':text[' + highlightData + ']';
365		$BODY.off(EVENT_KEY).on(Event.KEYUP, tgHighlightInp, function() {
366			var $this = $(this),
367				tgVal = $this.val(),
368				tgData = $this.data('highlight'),
369				$tgLayer = $BODY.find('[data-highlight="' + tgData + '"]').not($this);
370			$tgLayer.removeHighlights().highlights(tgVal);
371		});
372	};
373	feUI.HighlightInput();
374	// Toggle form(Reset)
375	feUI.ToggleFormReset = function($target) {
376		if ( !$target ) return;
377		$target.each(function() {
378			var $this = $(this),
379				$tgRadio = $this.find(':radio:checked'),
380				$tgCheckbox = $this.find(':checkbox:checked'),
381				$tgSelect = $this.find('select'),
382				$tgTextfield = $this.find('.textfield:not([readonly], [disabled])');
383			if ( $this.hasClass('no-reset') ) return;
384			// Radio, Checkbox
385			$tgRadio.add($tgCheckbox).prop('checked', false).trigger('change', true);
386			// Select
387			$tgSelect.each(function() {
388				var $this = $(this);
389				// Check Selectiz
390				( $this.hasClass('selectized') )
391					? $this[0].selectize.setValue('', true)
392					: $this.find('option:first').prop('selected', true);
393				$this.trigger('change', true);
394			});
395			// Textfield
396			$tgTextfield.val('');
397		});
398	};
399	// Toggle form(Radio)
400	feUI.ToggleFormRadio = function() {
401		var EVENT_KEY = '.ToggleFormRadio',
402			Event = {
403				CHANGE: 'change' + EVENT_KEY
404			};
405		var dataToggle = 'data-toggle',
406			dataToggleGroup = 'data-toggle-group',
407			triggerBtn = ':radio[' + dataToggle + ']';
408		$BODY.off(EVENT_KEY).on(Event.CHANGE, triggerBtn, function() {
409			var $this = $(this),
410				$dataGroup = $BODY.find('[' + dataToggleGroup + '="' + $this.prop('name') + '"]'),
411				$target = $dataGroup.filter('[' + dataToggle + '*="' + $this.attr(dataToggle) + '"]'),
412				checked = $this.is(':checked');
413			// Toggle
414			$target.show();
415			$dataGroup.not($target).hide();
416			if ( !checked ) $target.hide();
417			// Reset
418			feUI.ToggleFormReset($dataGroup.not($target));
419		}).find(triggerBtn).filter(':checked').trigger(Event.CHANGE);
420	};
421	feUI.ToggleFormRadio();
422	// Toggle form(Checkbox)
423	feUI.ToggleFormCheckbox = function() {
424		var EVENT_KEY = '.ToggleFormCheckbox',
425			Event = {
426				CHANGE: 'change' + EVENT_KEY
427			};
428		var dataToggle = 'data-toggle',
429			dataToggleAttr = 'data-toggle-attr',
430			dataToggleGroup = 'data-toggle-group',
431			triggerBtn = ':checkbox[' + dataToggle + '], :checkbox[' + dataToggleAttr + ']';
432		$BODY.off(EVENT_KEY).on(Event.CHANGE, triggerBtn, function() {
433			var $this = $(this),
434				dataVal = $this.attr(dataToggle),
435				dataAttrVal = $this.attr(dataToggleAttr),
436				dataGroupVal = $this.attr(dataToggleGroup),
437				checked = $this.is(':checked'),
438				disabled = dataAttrVal.indexOf('disabled') !== -1,
439				readonly = dataAttrVal.indexOf('readonly') !== -1,
440				$target = $('[' + dataToggle + '*="' + dataVal + '"]').not(triggerBtn),
441				$targetGroup = $('[' + dataToggleGroup + '*="' + dataGroupVal + '"]').not(triggerBtn);
442			// Toggle
443			if ( checked ) {
444				$target.show();
445				// Attr
446				if ( disabled ) $targetGroup.prop('disabled', false);
447				if ( readonly ) $targetGroup.prop('readonly', false);
448			} else {
449				$target.hide();
450				// Attr
451				if ( disabled ) $targetGroup.prop('disabled', true);
452				if ( readonly ) $targetGroup.prop('readonly', true);
453			}
454			// Reset
455			if ( !checked ) feUI.ToggleFormReset($target);
456		}).find(triggerBtn).filter(':checked').trigger(Event.CHANGE);
457	};
458	feUI.ToggleFormCheckbox();
459	// Toggle form(Select)
460	feUI.ToggleFormSelect = function() {
461		var EVENT_KEY = '.ToggleFormSelect',
462			Event = {
463				CHANGE: 'change' + EVENT_KEY
464			};
465		var dataToggle = 'data-toggle',
466			dataToggleGroup = 'data-toggle-group',
467			triggerSelect = '.select[' + dataToggle + ']';
468		$BODY.off(EVENT_KEY).on(Event.CHANGE, triggerSelect, function() {
469			var $this = $(this),
470				$selected = $this.find('option:selected'),
471				$dataGroup = $('[' + dataToggleGroup + '="' + $this.attr(dataToggle) + '"]'),
472				$target = $dataGroup.filter('[' + dataToggle + '*="' + $selected.val() + '"]');
473			// Toggle
474			$target.prop('disabled',false);
475			$dataGroup.not($target).prop('disabled',true);
476			// Reset
477			feUI.ToggleFormReset($dataGroup.not($target));
478		}).find(triggerSelect).trigger(Event.CHANGE);
479	};
480	feUI.ToggleFormSelect();
481	// Checkbox Switch
482	feUI.FormCheckSwitch = function() {
483		var EVENT_KEY = '.FormCheckSwitch',
484			Event = {
485				CHANGE: 'change' + EVENT_KEY
486			};
487		var $tgForm = $BODY.find('.check-swich :checkbox');
488		$tgForm.off(EVENT_KEY).each(function(){
489			var $this = $(this),
490				$label = $this.siblings('.label');
491			function labelText() {
492				( $this.is(':checked') ) ? $label.text('ON') : $label.text('OFF');
493			}
494			labelText();
495			$this.on(Event.CHANGE, function(){
496				labelText();
497			});
498		});
499	};
500	feUI.FormCheckSwitch();
501	// Add role and aria label attribute
502	feUI.AddRoleAttribute = function() {
503		var anchorButton = '.btn[href=""], .btn[href="#"], .btn[href="/"]';
504		$BODY.find(anchorButton).attr('role', 'button');
505	};
506	feUI.AddRoleAttribute();
507	// GNB Menu Toggle
508	feUI.menuToggle = function() {
509		var EVENT_KEY = '.menuToggle',
510			Event = {
511				CLICK: 'click' + EVENT_KEY
512			};
513		var gnbNav = '.gnb-menu',
514			depth = '[class*=depth]';
515		$BODY.off(EVENT_KEY).on(Event.CLICK, gnbNav + ' a', function(e) {
516			var $this = $(this);
517			if ( !$this.siblings(depth).length ) return;
518			e.preventDefault();
519			$this.parent('li').toggleClass(ClassName.CURRENT)
520				.siblings('li').removeClass(ClassName.CURRENT);
521		});
522	};
523	feUI.menuToggle();
524	// Menu Change
525	feUI.menuChange = function() {
526		var EVENT_KEY = '.menuChange',
527			Event = {
528				CLICK: 'click' + EVENT_KEY
529			};
530		var gnbChangWrap = '.gnb-change',
531			gnbChangArea = '.change-area',
532			changeBtn = gnbChangWrap + ' .btnChange';
533		$BODY.off(EVENT_KEY).on(Event.CLICK, changeBtn, function(e) {
534			e.preventDefault();
535			$(gnbChangWrap).append($(gnbChangArea).eq(0))
536				.prepend($(gnbChangArea).eq(0));
537		});
538	};
539	feUI.menuChange();
540	// Main slide iframe height
541	feUI.MainSlideHeight = function(event) {
542		var slideIframe = '.slide-iframe',
543			//height = WINDOW_HEIGHT - 44 - 38 - 51;
544			height = WINDOW_HEIGHT - $(".navbar-logo").height() + 3;
545			//height = $(window).innerHeight - $(".navbar-logo").height() - $(".nav ul").height() - $(".sideBar").height();
546			//alert("height : " + window.height); //664
547			//alert("inner height : " + window.innerHeight); //664
548			//alert("screen height : " + window.screen.height); //844
549			//alert("screen avail height : " + window.screen.availHeight); //844
550			//alert("document scroll height : " + document.documentElement.scrollHeight); //664
551			//alert("screen client height : " + document.documentElement.clientHeight)
552
553		// if ( !$(slideIframe).length ) return false;
554		// if ( event === 'resize' ) $('.modi-main-wrap > .slick-list').height(height);
555		// $('.modi-main-wrap > .slick-list').css('min-height', height);
556		// $(top.document).scrollTop(0);
557		// $(slideIframe).contents().scrollTop(0);
558		$('.slide-iframe').css('height', height);
559		// $('.modi-main-wrap').css('min-height', height);
560		$('.modi-main-wrap > .slick-list').css('min-height', height);
561	};
562	// iOS Keyboard
563	feUI.KeyboardCheck = function() {
564		var EVENT_KEY = '.navBar',
565			Event = {
566				FOCUSOUT: 'focusout' + EVENT_KEY
567			};
568		if ( !IS_MAIN_IFRAME ) return false;
569		$BODY.off(EVENT_KEY).on(Event.FOCUSOUT, ':text, :password, :file, textarea, select, .textfield', function() {
570			$(top.document).scrollTop(0);
571		});
572	};
573	feUI.KeyboardCheck();
574
575	// LoadMainSlide
576	feUI.LoadMainSlide = function() {
577		var navAnchor = '.nav a',
578			modiMainSlideWrap = '.modi-main-wrap',
579			loadedClass = 'loaded';
580		if ( !$(modiMainSlideWrap).length ) return false;
581		for ( var i = 0; i < $(navAnchor).length; i++ ) {
582			$(modiMainSlideWrap).append('<div class="modi-main-slide"><iframe class="slide-iframe"></iframe></div>');
583		}
584		// 화면아이디 생성
585		var pvId = getUUID();
586
587		// 슬라이드
588		$HTML.addClass('has-slide');
589		// $BODY.css('overflow', 'hidden');
590		$(modiMainSlideWrap).slick({
591			adaptiveHeight: true,
592			speed: 50,
593			arrows: false
594			// useCSS: false
595			// infinite: false
596		}).on('beforeChange', function(event, slick, currentSlide, nextSlide) {
597			var slideCount =  slick.slideCount - 1,
598				before = ( nextSlide - 1 === -1 ) ? slideCount : nextSlide - 1,
599				after = ( nextSlide + 1 > slideCount ) ? 0 : nextSlide + 1;
600			$(navAnchor).eq(nextSlide).trigger('click.navBar', 0);
601			// setTimeout(function() {
602			// 	// $(top.document).scrollTop(0);
603			// 	// $('iframe').contents().scrollTop(0);
604			// }, 500);
605			// Load
606			//loadIframe(after);
607			//loadIframe(before);
608			loadIframe(nextSlide);
609
610			if ( $('.nav').find('.' + ClassName.CURRENT).length === 0 )
611				$('.nav li').eq(currentSlide).addClass(ClassName.CURRENT);
612
613			var tabTitle = $('.nav li').eq(nextSlide).find("span").text();
614			traceMainSlide(pvId, currentSlide, nextSlide, feUI.mainNavClicked, tabTitle);
615			feUI.mainNavClicked = false;
616		}).on('afterChange', function() {
617			$(top.document).scrollTop(0);
618			$('iframe').contents().scrollTop(0);
619		}).slick('slickGoTo', 0);
620		// Load
621		function loadIframe(slideNum) {
622			var tgSlide = $(modiMainSlideWrap).slick('getSlick').$slides[slideNum];
623			if ( $(navAnchor).eq(slideNum).hasClass(loadedClass) ) return false;
624			$(navAnchor).eq(slideNum).addClass(loadedClass);
625			$(tgSlide).find('iframe').attr('src', $(navAnchor).eq(slideNum).attr('href'));
626			$(tgSlide).find('iframe').on('load', function(e) {
627				$WINDOW.trigger('resize');
628				$(".sidebar_new").removeClass("on");
629				// $(top.document).scrollTop(0);
630				// console.log(e);
631			});
632			feUI.MainSlideHeight();
633			// 건강 Q&A 말풍선
634			if($(tgSlide).find("iframe").attr("src") == "/ourtown/doctorqna/list" || $(tgSlide).find("iframe").attr("src") == "/main/hospital/theme/main/mainHospital" || $(tgSlide).find("iframe").attr("src") == "/consumer/main/home"){
635				$(".doctorqna_tip").show();
636			}else{
637				$(".doctorqna_tip").hide();
638			}
639		}
640
641		function traceMainSlide(pvId, before, after, clicked, title) {
642
643			if (clicked && before === after) {
644
645			} else {
646
647				if (window.location.hostname == "m.whodadoc.com") {
648					var category = "메인SLIDE";
649					var event = "load";
650					var label = title;
651
652					if (clicked) {
653						event = "click";
654					} else {
655						event = "slide";
656					}
657
658					if (before == 0 && after == 0) {
659						event = "load";
660					}
661					gtag('event', event, {
662						'event_category' : category,
663						'event_label' : label
664					});
665				}
666			}
667		}
668	};
669	feUI.LoadMainSlide();
670	// navBar
671	feUI.navBar = function() {
672		var EVENT_KEY = '.navBar',
673			Event = {
674				CLICK: 'click' + EVENT_KEY
675			};
676		var nav = '.nav',
677			navBar = nav + '> ul',
678			navBarList = navBar + '> li',
679			navBarAnchor = navBarList + '> a',
680			mainSlide = '.modi-main-wrap',
681			loadedClass = 'loaded',
682			width = 0,
683			leftPos = [];
684		if ( !$(navBar).length || IS_MAIN_IFRAME ) return false;
685		// Width
686		// $(navBarList).each(function() {
687		// 	var $this = $(this);
688		// 	width += Math.ceil( $this.outerWidth(true) + 2 );
689		// 	$(navBar).css('width', width);
690		// 	leftPos.push($this.offset().left);
691		// });
692		// Event
693		$BODY.off(EVENT_KEY).on(Event.CLICK, navBarAnchor, function(e, type) {
694			var $this = $(this),
695				$currentList = $this.closest(navBarList),
696				tgWidth = $this.outerWidth(true),
697				idx = $(navBarAnchor).index($this);
698			e.preventDefault();
699			// Class
700			$(navBarList).removeClass(ClassName.CURRENT);
701			$currentList.addClass(ClassName.CURRENT);
702			// if ( type !== 0 ) $this.removeClass(loadedClass);
703			// Scroll
704			$(nav).stop().animate({
705				scrollLeft: leftPos[idx] - ((WINDOW_WIDTH - tgWidth)/2)
706			},100);
707			if ( $(mainSlide).hasClass('slick-initialized') && type !== 0 ) {
708				feUI.mainNavClicked = true;
709				$(mainSlide).slick('slickSetOption', 'speed', 0).slick('slickGoTo', idx).slick('slickSetOption', 'speed', 100);
710			}
711			// 건강 Q&A 말풍선
712			if($currentList.find("a").attr("href") == "/ourtown/doctorqna/list" || $currentList.find("a").attr("href") == "/main/hospital/theme/main/mainHospital" || $currentList.find("a").attr("href") == "/consumer/main/home"){
713				$(".doctorqna_tip").show();
714			}else{
715				$(".doctorqna_tip").hide();
716			}
717		});
718	};
719	feUI.navBar();
720	// Check loaded page
721	feUI.checkLoadedPage = function() {
722		if ( !IS_MAIN_IFRAME ) return false;
723		var $navBarList = $(top.document).find('.nav > ul > li'),
724			pagePathName = window.location.href;
725		if ( !NAVBAR_LINK_ARR.length ) {
726			$navBarList.find('> a').each(function() {
727				var $this = $(this),
728					href = $this.prop('href');
729				NAVBAR_LINK_ARR.push(href);
730			});
731		}
732		if ( $.inArray(pagePathName, NAVBAR_LINK_ARR) === -1 )
733			$navBarList.filter('.' + ClassName.CURRENT).find('> a').removeClass('loaded');
734	};
735	feUI.checkLoadedPage();
736	// Main slide page
737	feUI.MainSlidePage = function() {
738		if ( !IS_MAIN_IFRAME ) return false;
739		var contentHeight = $CONTENT.height(),
740			$mainSlide = $(top.document).find('.modi-main-wrap');
741		$BODY.scrollTop(0);
742		// $mainSlide.find('.slick-list').css('min-height', contentHeight);
743		// $mainSlide.find('.slick-active iframe').css('min-height', contentHeight);
744		//
745		$WRAP.swipe({
746			swipeStatus: function(event, phase, direction, distance, duration, fingers) {
747				// var currentPos = parseInt($mainSlide.find('.slick-track').css('transform').split(', ')[4]);
748				// if ( direction === 'left' ) {
749				// 	$(top.document).find('.modi-main-wrap .slick-track').css({
750				// 		'transform': 'translateX(' + ( currentPos - distance  ) + 'px)'
751				// 	});
752				// 	if ( phase === 'end' || phase === 'cancel' ) {
753				// 		$mainSlide.slick('slickGoTo', $mainSlide.slick('slickCurrentSlide') + 1);
754				// 	}
755				// }
756				// if ( direction === 'right' ) {
757				// 	$(top.document).find('.modi-main-wrap .slick-track').css({
758				// 		'transform': 'translateX(' + ( currentPos + distance ) + 'px)'
759				// 	});
760				// 	if ( phase === 'end' || phase === 'cancel' ) {
761				// 		$mainSlide.slick('slickGoTo', $mainSlide.slick('slickCurrentSlide') - 1);
762				// 	}
763				// }
764				if ( direction === 'up' || direction === 'down' ) {
765					return false;
766				}
767				if ( phase === 'end' || phase === 'cancel' ) {
768					if ( distance < 100 ) return false;
769					if ( direction === 'left') {
770						$mainSlide.slick('slickGoTo', $mainSlide.slick('slickCurrentSlide') + 1);
771					} else if ( direction === 'right') {
772						$mainSlide.slick('slickGoTo', $mainSlide.slick('slickCurrentSlide') - 1);
773					}
774				}
775			},
776			excludedElements: '.nav, .slick-slider, .slide-scroll, .schedule-group .schedule ul, .scrollX, .card-slide, .pharmport, .section.heading-depth02 .card, .alarm-cal, .healUnit-boardView-tp02 .tbl_scroll, .tab_disease_detail, .healUnit-check-wrap, .main_hospital_list, .subject_area, .near_list, .list_hospital, .content.search_list, .tv_search, .tv_other ul, .list_adv ul, .body_search_list, .subject_area, .doctorqna_ranking, .qna-banner, .main_home .img_disease, .banner_main_home, .inner_tv_list',
777			allowPageScroll: 'auto',
778			threshold: 200
779		});
780	};
781	feUI.MainSlidePage();
782	// Main Card
783	feUI.mainCard = function() {
784		var $cardList =$BODY.find('.card > ul');
785		if ( !$cardList.length ) return false;
786		$cardList.each(function(){
787			var $this = $(this),
788				$cardItem = $this.find('.card-item'),
789				listWidth = $cardItem.outerWidth(true),
790				cardLenght = $cardItem.length,
791				totalWidth = listWidth * cardLenght + 4; // 4: 마지막 아이템 여백
792			$this.css('width',totalWidth);
793		});
794	};
795	feUI.mainCard();
796	// Main Card
797	feUI.slideCard = function() {
798		var $cardList =$BODY.find('.card-slide > ul');
799		if ( !$cardList.length ) return false;
800		$cardList.each(function(){
801			var $this = $(this),
802				$cardItem = $this.find('.card-slide-item'),
803				listWidth = $cardItem.outerWidth(true),
804				cardLenght = $cardItem.length,
805				totalWidth = listWidth * cardLenght + 4; // 4: 마지막 아이템 여백
806			$this.css('width',totalWidth);
807		});
808	};
809	feUI.slideCard();
810	// slideSet (slick)
811	feUI.slideSet = function() {
812		var $sideBanner = $BODY.find('.side-banner'),
813			$mapInfoItem = $BODY.find('.map-info-item .item-group:not(.slick-initialized)'),
814			$mapDetailSlide = $BODY.find('.map-detail-slide'),
815			$mapTreatSlide = $BODY.find('.map-detail-section .treat-slide'),
816			$mapSearchSlideNav = $BODY.find('.map-search .slider-nav'),
817			$mapSearchSlideFor = $BODY.find('.map-search .slider-for'),
818			$mapComparisonSlide = $BODY.find('.map-comparison-resert .item-group'),
819			$albumSlide = $BODY.find('.health-album-group .item-group'),
820			$qnaSlide = $BODY.find('.qna-slide'),
821			$quizeSlide = $BODY.find('.quize-slide'),
822			// Advance
823			$popupRolling = $HTML.find('.popup-adv .banner-rolling:has(>)'),
824			$restaurantSlide = $HTML.find('.restaurant-slide:has(>)'),
825			$answerRankSlide = $HTML.find('.adv-answerRank-slide'),
826			$mainMilage = $BODY.find('.milage-slide:has(>)');
827		// Destroy
828		$('.slick-initialized:not(.modi-main-wrap, .map-info-item .item-group, .product-slide)').slick('unslick');
829		// ë§µ
830		$mapInfoItem.slick({
831			arrows: false,
832			infinite: false,
833			slidesToShow: 1,
834			centerMode: true,
835			centerPadding: '10px',
836			swipe: true
837		});
838		// 지도 상세 정보
839		$mapDetailSlide.slick({
840			dots: true,
841			infinite: false,
842			centerMode: false,
843			variableWidth: false,
844			speed: 500,
845			arrows: false,
846			slidesToShow: 1,
847			slidesToScroll: 1,
848			swipe: true
849		});
850		// 검사 및 시술 정보
851		$mapTreatSlide.slick({
852			arrows: false,
853			infinite: false,
854			dots: false,
855			variableWidth: true,
856			swipeToSlide: true,
857			currentSlide: true
858		});
859		/* 검색조건 선택 */
860		$mapSearchSlideNav.slick({
861			slidesToShow: 4,
862			slidesToScroll: 1,
863			asNavFor: '.slider-for',
864			dots: false,
865			focusOnSelect: true
866		});
867		/* 검색조건 영역 */
868		$mapSearchSlideFor.slick({
869			slidesToShow: 1,
870			slidesToScroll: 1,
871			arrows: false,
872			asNavFor: '.slider-nav',
873			adaptiveHeight: true
874		});
875		/* 병원비교결과 */
876		$mapComparisonSlide.slick({
877			dots: false,
878			infinite: false,
879			speed: 300,
880			slidesToShow: 1,
881			centerMode: true,
882			centerPadding: '8px',
883			adaptiveHeight: true
884		});
885		/* 건강사진첩 */
886		$albumSlide.slick({
887			dots: false,
888			infinite: false,
889			speed: 300,
890			slidesToShow: 1,
891			centerMode: true,
892			centerPadding: '0'
893		});
894		/* Q&A 슬라이드*/
895		$qnaSlide.slick({
896			dots: false,
897			arrows: false,
898			infinite: false,
899			speed: 300,
900			slidesToShow: 1,
901			centerMode: true,
902			centerPadding: '9px',
903			adaptiveHeight: true
904		});
905		// Quize
906		$quizeSlide.slick({
907			infinite: true,
908			slidesToShow: 1,
909			slidesToScroll: 1,
910			autoplay: true,
911			arrows: false,
912			dots: true,
913			autoplaySpeed: 5000
914		});
915		// Advance
916		$popupRolling.slick({
917						slidesToShow: 1,
918			slidesToScroll: 1,
919			arrows: false,
920			dots: true,
921			autoplay: true,
922			autoplaySpeed: 3000
923				});
924				$restaurantSlide.slick({
925						slidesToShow: 1,
926			slidesToScroll: 1,
927			arrows: false,
928			dots: true
929				});
930		$mainMilage.slick({
931			infinite: true,
932			slidesToShow: 1,
933			slidesToScroll: 1,
934			autoplay: true,
935			arrows: false,
936			autoplaySpeed: 5000,
937			dots: true
938		}).on('beforeChange', function(event, slick, currentSlide, nextSlide) {
939			var $label = $('.milage-info .type'),
940				labelTxt = $(slick.$slides[nextSlide]).find('.item').data('label-text');
941			$label.text(labelTxt);
942		});
943		$answerRankSlide.slick({
944			dots: false,
945			arrows: false,
946			autoplay: true,
947			speed: 300,
948			slidesToShow: 1,
949			//centerMode: true,
950			//centerPadding: '9px',
951			adaptiveHeight: true
952		});
953	};
954	feUI.slideSet();
955	// Map detail toggle
956	feUI.mapDetailSummary = function() {
957		var EVENT_KEY = '.mapDetailSummary',
958			Event = {
959				CLICK: 'click' + EVENT_KEY
960			};
961		var mapDetailSummary = '[class*="map-detail-"]',
962			btnMore = '.btn-text-more';
963		$BODY.off(EVENT_KEY).on(Event.CLICK, btnMore, function(e) {
964			var $this = $(this),
965				$mapDetailSummary = $this.closest(mapDetailSummary);
966			e.preventDefault();
967			$mapDetailSummary.toggleClass(ClassName.ACTIVE);
968			( $mapDetailSummary.hasClass(ClassName.ACTIVE) )
969				? $this.text('접기')
970				: $this.text('더보기');
971		});
972	};
973	feUI.mapDetailSummary();
974	// Accordion table
975	feUI.accordionMore = function(item) {
976		var EVENT_KEY = '.accordionMore',
977			Event = {
978				CLICK: 'click' + EVENT_KEY
979			};
980		var accMore = '.accordion-more',
981			btnMore = '.btn-text-more';
982		if ( !$(accMore).length ) return false;
983		$BODY.off(EVENT_KEY).on(Event.CLICK, btnMore, function(e) {
984			var $this = $(this),
985				$accMore = $this.closest(accMore);
986			e.preventDefault();
987			$accMore.toggleClass(ClassName.ACTIVE);
988			if ( $this.is(btnMore) ) {
989				( $accMore.hasClass(ClassName.ACTIVE) )
990					? $this.text('접기')
991					: $this.text('자세히 보기');
992			} else {
993				( $accMore.hasClass(ClassName.ACTIVE) )
994					? $this.find('span').text('접기')
995					: $this.find('span').text('자세히 보기');
996			}
997		});
998	};
999	feUI.accordionMore();
1000	feUI.scheduleGroupAccordion = function() {
1001		var $scheduleGroup = $BODY.find('.schedule-group'),
1002			$monthlyType = $scheduleGroup.filter('.monthly'),
1003			$item = $monthlyType.find('.schedule > div'),
1004			$btn = $('.accordianBtn'),
1005			_EVENT_KEY = EVENT_KEY + '_scheduleGroupAccordion';
1006		if ( !$scheduleGroup.length ) return false;
1007		$item.off(EVENT_KEY).each(function(){
1008			var $this = $(this),
1009				$listWrap = $this.find('ul'),
1010				$list = $listWrap.find('li');
1011			if( $listWrap.length ) {
1012				var listWrapWidth = $listWrap.outerWidth(),
1013					listWidth = $list.outerWidth(),
1014					listSize = $list.length;
1015				if ( listWrapWidth < (listWidth * listSize) ) {
1016					$this.addClass('accordion');
1017				} else {
1018					$this.removeClass('accordion');
1019					$this.removeClass(ClassName.ACTIVE);
1020					$this.find($btn).find('span').text('자세히 보기');
1021				}
1022			}
1023		});
1024		$btn.off(EVENT_KEY).on('click' + EVENT_KEY, function(){
1025			var $this = $(this);
1026			$this.closest($item).toggleClass(ClassName.ACTIVE);
1027			( $this.closest($item).hasClass(ClassName.ACTIVE))
1028				? $this.find('span').text('접기')
1029				: $this.find('span').text('자세히 보기');
1030		});
1031	};
1032	feUI.scheduleGroupAccordion();
1033	// donut graph
1034	feUI.donutGraph = function(){
1035		var $donutGraph = $BODY.find('.donut-graph');
1036		if ( !$donutGraph.length ) return false;
1037		$donutGraph.each(function(){
1038			var $this = $(this),
1039				$pie = $this.find('.pie'),
1040				$leftSide = $pie.find('.left-side'),
1041				$rightSide = $pie.find('.right-side'),
1042				donutGraphLabel = $this.find('.label:first .num').text(),
1043				percent = Math.round(donutGraphLabel),
1044				deg = Math.round(360 * (percent / 100));
1045			if (percent > 100) {
1046				percent = 100;
1047			} else if (percent < 0) {
1048				percent = 0;
1049			}
1050			if (percent > 50) {
1051				$pie.css('clip', 'rect(auto, auto, auto, auto)');
1052				$rightSide.css('transform', 'rotate(180deg)');
1053			} else {
1054				$pie.css('clip', 'rect(0, 52px, 52px, 26px)');
1055				$rightSide.css('transform', 'rotate(0deg)');
1056			}
1057			$leftSide.css('transform', 'rotate(' + deg + 'deg)');
1058		});
1059	};
1060	feUI.donutGraph();
1061	// Toggle form(Checkbox)
1062	feUI.ToggleCheckList = function() {
1063		var EVENT_KEY = '.ToggleCheckList',
1064			Event = {
1065				CLICK: 'click' + EVENT_KEY
1066			};
1067		var $ToggleCheck = $BODY.find('.toggleCheck-list'),
1068			$ToggleCheckList = $ToggleCheck.find('li'),
1069			$anchor = $ToggleCheckList.find('a');
1070		if ( !$ToggleCheck.length ) return false;
1071		$anchor.off(EVENT_KEY).on(Event.CLICK, function(e) {
1072			var $this = $(this);
1073			e.preventDefault();
1074			$ToggleCheckList.removeClass(ClassName.ACTIVE);
1075			$this.closest($ToggleCheckList).addClass(ClassName.ACTIVE);
1076		});
1077	};
1078	feUI.ToggleCheckList();
1079	// Toggle form(Checkbox)
1080	feUI.talkViewToggle = function() {
1081		var EVENT_KEY = '.talkViewToggle',
1082			Event = {
1083				CLICK: 'click' + EVENT_KEY
1084			};
1085		var $talkGroup = $BODY.find('.talk-group'),
1086			$talkView = $talkGroup.find('.talk-view'),
1087			$toggleAnchor = $talkView.find('.btn-toggle'),
1088			$talkBallon = $BODY.find('.talk-balloon'),
1089			$imgGroup = $talkBallon.find('.img-group');
1090		if ( !$talkGroup.length ) return false;
1091		$toggleAnchor.off(EVENT_KEY).on(Event.CLICK, function(e) {
1092			var $this = $(this);
1093			e.preventDefault();
1094			$talkView.toggleClass(ClassName.ACTIVE);
1095			( $talkView.hasClass(ClassName.ACTIVE) )
1096				? $this.text('내용 닫기')
1097				: $this.text('내용 보기');
1098		});
1099		$imgGroup.each(function(){
1100			var $this = $(this),
1101				$imgMoreAnchor = $this.find('.btn-imgMore');
1102			$imgMoreAnchor.off(EVENT_KEY).on(Event.CLICK, function(e) {
1103				e.preventDefault();
1104				$this.addClass(ClassName.ACTIVE);
1105			});
1106		});
1107	};
1108	feUI.talkViewToggle();
1109	//searchFilter
1110	feUI.searchFilter = function() {
1111		var EVENT_KEY = '.searchFilter',
1112			Event = {
1113				CLICK: 'click' + EVENT_KEY,
1114			};
1115		var tgBtn = '.select-btn button';
1116		var $filterGroup = $BODY.find('.search-filter'),
1117			$btnGroup = $filterGroup.find('.select-btn'),
1118			$tgItem = $filterGroup.find('.item-group .item');
1119		$BODY.off(EVENT_KEY).on(Event.CLICK, tgBtn, function() {
1120			var $this = $(this),
1121				$tglength = $this.data('detail');
1122			$this.toggleClass(ClassName.ACTIVE);
1123			if ( $btnGroup.find('button').hasClass(ClassName.ACTIVE) ) {
1124				$btnGroup.find('button').not($this).removeClass(ClassName.ACTIVE);
1125				$tgItem.removeClass(ClassName.ACTIVE);
1126				$tgItem.eq($tglength - 1).addClass(ClassName.ACTIVE);
1127				$filterGroup.addClass(ClassName.ACTIVE);
1128			} else {
1129				$tgItem.removeClass(ClassName.ACTIVE);
1130				$filterGroup.removeClass(ClassName.ACTIVE);
1131			}
1132		});
1133	};
1134	feUI.searchFilter();
1135	// Toggle Btn
1136	feUI.ToggleBtn = function() {
1137		var EVENT_KEY = '.ToggleBtn',
1138			Event = {
1139				CLICK: 'click' + EVENT_KEY
1140			};
1141		var tgBtn = '[class*=btn-toggle]';
1142		$BODY.off(EVENT_KEY).on(Event.CLICK, tgBtn, function () {
1143			var $this = $(this),
1144				$tgCont = $this.siblings(".toggle-cont");
1145			$this.toggleClass(ClassName.ACTIVE);
1146			if ( $tgCont.length > 1 ) {
1147				$this.siblings($tgCont).toggleClass(ClassName.ACTIVE);
1148			} else {
1149				$tgCont.toggleClass(ClassName.ACTIVE);
1150			}
1151			return false;
1152		});
1153	};
1154	feUI.ToggleBtn();
1155	// CardToggle
1156	feUI.CardToggle = function() {
1157		var EVENT_KEY = '.CardToggle',
1158			Event = {
1159				CLICK: 'click' + EVENT_KEY,
1160			};
1161		var boardCardItem = '.healUnit-layout .healUnit-board-product .product-content',
1162			moreBtn = '.btn-text-more',
1163			showText = '자세히보기',
1164			hideText = '접기';
1165		if ( !$BODY.find(boardCardItem).has(moreBtn).length ) return false;
1166		$BODY.find(boardCardItem).has(moreBtn).each(function() {
1167			var $this = $(this),
1168				originHeight = $this.addClass(ClassName.ACTIVE).end().height(),
1169				ellipsisHeight = $this.removeClass(ClassName.ACTIVE).end().height();
1170			if ( originHeight <= ellipsisHeight ) $this.find(moreBtn).hide();
1171		});
1172		$BODY.off(Event.CLICK).on(Event.CLICK, boardCardItem + ' ' + moreBtn, function(e) {
1173			var $this = $(this),
1174				$thisItem = $this.closest(boardCardItem);
1175			e.preventDefault();
1176			if ( $thisItem.hasClass(ClassName.ACTIVE) ) {
1177				$this.text(showText);
1178				$thisItem.removeClass(ClassName.ACTIVE);
1179			} else {
1180				$this.text(hideText);
1181				$thisItem.addClass(ClassName.ACTIVE);
1182			}
1183		});
1184	};
1185	feUI.CardToggle();
1186	// HealUnitTabSize
1187	feUI.HealUnitTabSize = function() {
1188		var healUnitTab = '.healUnit-tab-slide',
1189			healUnitBodySlide = '.healUnit-body-slide';
1190		if ( !$BODY.find(healUnitTab + ', ' + healUnitBodySlide).length) return false;
1191		$(healUnitTab).each(function() {
1192			var $this = $(this),
1193				$item = $this.find('> li'),
1194				$current = $item.filter('.current'),
1195				itemSize = $item.length,
1196				tabWidth = Math.ceil(itemSize/2/3*100) + '%',
1197				itemWidth = Math.floor(100/(itemSize/2)) + '%';
1198			$this.css('width', tabWidth);
1199			$item.css('width', itemWidth);
1200			// Current
1201			if ( !$current.length ) return false;
1202			$this.closest('.slide-scroll')[0].scrollTo($current.position().left - 20, 0);
1203		});
1204		$(healUnitBodySlide).each(function() {
1205			var $this = $(this),
1206				$item = $this.find('> li'),
1207				itemWidth = 0;
1208			$item.each(function() {
1209				itemWidth += Math.ceil($(this).width());
1210			});
1211			$this.css('width', itemWidth + 20);
1212		});
1213	};
1214	feUI.HealUnitTabSize();
1215	// City List
1216	feUI.CityList = function() {
1217		var EVENT_KEY = '.CityList',
1218			Event = {
1219				CLICK: 'click' + EVENT_KEY,
1220			};
1221		var searchFilter =  '.search-filter',
1222			cityList = '.city-list',
1223			cityBtn = '.city-btn';
1224		$BODY.off(EVENT_KEY).on(Event.CLICK, cityList + ' a, ' + cityBtn, function(e) {
1225			var $this = $(this),
1226				cityText;
1227			e.preventDefault();
1228			if ( !$this.is(cityBtn) ) {
1229				cityText = $this.text();
1230				$(cityBtn).find('span').text(cityText);
1231			}
1232			( $this.is(cityBtn) )
1233				? $this.closest(searchFilter).find(cityList).removeClass(ClassName.ACTIVE)
1234				: $this.closest(cityList).addClass(ClassName.ACTIVE);
1235		});
1236	};
1237	feUI.CityList();
1238	// Top button
1239	feUI.GoTopBtn = function() {
1240		var EVENT_KEY = '.GoTopBtn',
1241			Event = {
1242				CLICK: 'click' + EVENT_KEY
1243			};
1244		var topBtn = '.btn-top',
1245			writeBtn = '.writeBtn',
1246			cameraBtn = '.btn-camera',
1247			activeScrollClass = 'active-scroll';
1248		// writeBtn length
1249		if ( $CONTENT.find(writeBtn).length ) $CONTENT.addClass('has-writeBtn');
1250		// Scroll position
1251		( SCROLLTOP_POS >= 100 )
1252			? $BODY.addClass(activeScrollClass)
1253			: $BODY.removeClass(activeScrollClass);
1254		// Click
1255		$BODY.off(EVENT_KEY).on(Event.CLICK, topBtn, function(e) {
1256			e.preventDefault();
1257			$DOCUMENT.scrollTop(0);
1258		});
1259	};
1260	feUI.GoTopBtn();
1261	// Toggle class data
1262	feUI.ToggleClassData = function() {
1263		var EVENT_KEY = '.ToggleClassData',
1264			Event = {
1265				CLICK: 'click' + EVENT_KEY,
1266				FOCUSOUT: 'focusout' + EVENT_KEY
1267			};
1268		var classData = 'toggle-class',
1269			groupData = 'toggle-class-group',
1270			targetTrigger = '[data-' + classData + ']',
1271			targetLayer = '.layer-focusout[data-' + groupData + ']';
1272		$BODY.off(Event.CLICK).on(Event.CLICK, targetTrigger, function(e, type) {
1273			var $this = $(this),
1274				classDataVal = ( $this.data(classData) === '' )
1275					? ClassName.ACTIVE : $this.data(classData),
1276				groupDataVal = ( !$this.data(groupData) || $this.data(groupData) === '' )
1277					? false : $this.data(groupData),
1278				$target = ( groupDataVal )
1279					? $this.parents('[data-' + groupData + '*="' + groupDataVal + '"]').add($this) : $this;
1280			e.preventDefault();
1281			$BODY.off(Event.FOCUSOUT);
1282			( $this.hasClass(classDataVal) || type === 0 )
1283				? $target.removeClass(classDataVal)
1284				: $target.addClass(classDataVal);
1285		}).off(Event.FOCUSOUT).on(Event.FOCUSOUT, targetLayer, function() {
1286			var $this = $(this),
1287				groupDataVal = $this.data(groupData);
1288			setTimeout(function() {
1289				if (!$this.find(':focus').length)
1290					$(targetTrigger + '[data-' + groupData + '=' + groupDataVal + ']').trigger(Event.CLICK);
1291			});
1292		});
1293	};
1294	feUI.ToggleClassData();
1295	// Ellipsis Text
1296	feUI.EllipsisText = function() {
1297		var ellipsisLine01 = '.ellipsis-line01, .healUnit-elil-line01',
1298			ellipsisLine02 = '.ellipsis-line02, .healUnit-elil-line02, .healUnit-content-list-tp01 .healUnit-item-foot .txt, .healUnit-content-list-tp01 .item-body .text .txt, .list-group-type01 .text p, .qna-card-group .card-qna .question p, .event-list .text-group .title, .healUnit-content-list-tp02 .item-body .title, .healUnit-content-list-tp02 .healUnit-item-foot .txt',
1299			ellipsisLine03 = '.ellipsis-line03, .qna-list .item-body .answer, .list-type-check li div',
1300			ellipsisData = '[data-ellipsis-line]';
1301		$(ellipsisLine01).ellipsis({
1302			lines: 1
1303		});
1304		$(ellipsisLine02).ellipsis({
1305			lines: 2
1306		});
1307		$(ellipsisLine03).ellipsis({
1308			lines: 3
1309		});
1310		$(ellipsisData).each(function() {
1311			var $this = $(this),
1312				lineVal = $this.data('ellipsis-line');
1313			$this.ellipsis({
1314				lines: lineVal
1315			});
1316		});
1317	};
1318	//feUI.EllipsisText();
1319	// Tab Size
1320	feUI.TabSizeClass = function() {
1321		var tab = '.tab',
1322			tabSizeClass = 'tab-size';
1323		$(tab).each(function() {
1324			var $this = $(this),
1325				$itme = $this.find('> li:not(:empty)'),
1326				size = ( $itme.length < 10 ) ? '0' + $itme.length : $itme.length;
1327			$this.removeClass(function(index, className) {
1328				return (className.match(/tab-size../g)).join(' ');
1329			}).addClass(tabSizeClass + size);
1330		});
1331	};
1332	feUI.TabSizeClass();
1333	// Tip Box
1334	feUI.tipbox = function () {
1335		var EVENT_KEY = '.tipbox',
1336			Event = {
1337				CLICK: 'click' + EVENT_KEY,
1338				FOCUSOUT: 'focusout' + EVENT_KEY,
1339				SCROLL: 'scroll' + EVENT_KEY
1340			};
1341		var tipGroup = '.tip-group',
1342			tipBtn = '.tip-group > button';
1343		if (!$(tipGroup).length) return false;
1344		$BODY.off(EVENT_KEY).on(Event.CLICK, tipBtn, function() {
1345			var $this = $(this),
1346				$tgGroup = $this.closest(tipGroup);
1347			$tgGroup.toggleClass(ClassName.ACTIVE);
1348			$(tipGroup).not($tgGroup).removeClass(ClassName.ACTIVE);
1349		}).on(Event.FOCUSOUT, tipBtn, function() {
1350			var $this = $(this),
1351				$tgGroup = $this.closest(tipGroup);
1352			$tgGroup.removeClass(ClassName.ACTIVE);
1353		});
1354		$WINDOW.off(EVENT_KEY).on(Event.SCROLL, function() {
1355			if ( !$(tipGroup).filter('.' + ClassName.ACTIVE).length ) return;
1356			$(tipGroup).filter('.' + ClassName.ACTIVE).find('> button').trigger(Event.CLICK);
1357		});
1358	};
1359	feUI.tipbox();
1360	// Sec3Guide
1361	feUI.Sec3Guide = function() {
1362		var sec3Wrap = '.sec3-guide',
1363			imgWidth = 1080,
1364			imgHeight = 1920,
1365			imgRatio = parseFloat((imgHeight/imgWidth).toFixed(2)),
1366			windowRatio = parseFloat((WINDOW_HEIGHT/WINDOW_WIDTH).toFixed(2)),
1367			ratioClass = 'ratio-size';
1368		if ( !$BODY.find(sec3Wrap).length ) return false;
1369		( windowRatio < imgRatio )
1370			? $(sec3Wrap).addClass(ratioClass)
1371			: $(sec3Wrap).removeClass(ratioClass);
1372	};
1373	feUI.Sec3Guide();
1374	// Modal image
1375	feUI.ModalImage = function() {
1376		var modalImg = '.modal-img',
1377			closeBtn = '.btn-close',
1378			aniSpeed = 50;
1379		$BODY.on('click', modalImg + ' ' + closeBtn, function(e) {
1380			var $this = $(this);
1381			e.preventDefault();
1382			if(!$this.hasClass('quick-close')){
1383				$(modalImg).fadeOut(aniSpeed);
1384			};
1385		});
1386	};
1387	feUI.ModalImage();
1388	// Check empty element
1389	feUI.IsEmpty = function() {
1390		var target = '.view-file, .btn-group, .file-group, .content-list, .mypage-list .item-body .image, .keyword',
1391			emptyClass = 'is-empty';
1392		$(target).each(function() {
1393			var $this = $(this);
1394			( $.trim($this.html()).length === 0 )
1395				? $this.addClass(emptyClass) : $this.removeClass(emptyClass);
1396		});
1397	};
1398	feUI.IsEmpty();
1399	// Family slide
1400	feUI.FamilySlide = function() {
1401		var $familySlide = $HTML.find('.slide-family:has(>)');
1402		$('.slide-family.slick-initialized').slick('unslick');
1403		$familySlide.slick({
1404			infinite: false,
1405					slidesToShow: 4,
1406			slidesToScroll: 1,
1407			arrows: true,
1408			dots: false
1409			});
1410	};
1411	feUI.FamilySlide();
1412	// Advance - Milage mall product info
1413	feUI.MilageInfo = function() {
1414		var EVENT_KEY = '.MilageInfo',
1415			Event = {
1416				CLICK: 'click' + EVENT_KEY,
1417				FOCUS: 'focus' + EVENT_KEY,
1418				KEYUP: 'keyup' + EVENT_KEY
1419			};
1420		var milageInfo = '.mm-info',
1421			priceItem = milageInfo + ' .mm-price-item',
1422			priceTotal = milageInfo + ' .mm-price-total',
1423			priceNow = milageInfo + ' .mm-price-now',
1424			priceLeft = milageInfo + ' .mm-price-left',
1425			itemCount = milageInfo + ' .mm-count',
1426			plusBtn = milageInfo + ' .btn-plus',
1427			minusBtn = milageInfo + ' .btn-minus',
1428			rdioBtn = milageInfo + ' .rdio-delivery',
1429			currentItemCountVal = getNumber($(itemCount).val()),
1430			delivery = 0;
1431		// Button
1432		$BODY.off(Event.CLICK).on(Event.CLICK, plusBtn + ', ' + minusBtn + ', ' + rdioBtn, function(e) {
1433			var $this = $(this),
1434				itemCountVal = getNumber($(itemCount).val()),
1435				newItemCountVal = ( $this.is(plusBtn) )
1436					? ( itemCountVal > 998 ) ? 999 : ++itemCountVal
1437					: ( itemCountVal < 2 ) ? 1 : --itemCountVal;
1438
1439			delivery = ($this.is(rdioBtn)) ? getNumber($("."+$this.val()+"-price-item").text()) : delivery;
1440
1441			if($this.is(rdioBtn)){
1442				if($this.val() == 'cnee'){
1443					$(".mallProductAgree").show();
1444				}else{
1445					$(".mallProductAgree").hide();
1446				}
1447			}
1448
1449			//e.preventDefault();
1450			$(itemCount).val(newItemCountVal);
1451			totalPrice(newItemCountVal);
1452		}).off(Event.FOCUS).on(Event.FOCUS, itemCount, function(e) {
1453			currentItemCountVal = getNumber($(itemCount).val());
1454		}).off(Event.KEYUP).on(Event.KEYUP, itemCount, function(e) {
1455			var itemCountVal = Number($(itemCount).val());
1456			if ( !$.isNumeric(Number($(itemCount).val())) ) {
1457				$(itemCount).val(currentItemCountVal);
1458				return;
1459			} else {
1460				itemCountVal = ( itemCountVal > 998 )
1461					? 999 : ( itemCountVal < 2 )
1462						? 1 : itemCountVal;
1463				$(itemCount).val(itemCountVal);
1464				totalPrice(itemCountVal);
1465			}
1466		});
1467		// Init
1468		totalPrice(currentItemCountVal);
1469		// Function
1470		function getNumber(str) {
1471			var str = String(str);
1472			return Number(str.replace(/[^\d]+/g, ''));
1473		}
1474		function setComma(str) {
1475			var str = String(str);
1476			return str.replace(/(\d)(?=(?:\d{3})+(?!\d))/g, '$1,');
1477		}
1478		function totalPrice(itemCountVal) {
1479			var priceItemVal = getNumber($(priceItem).text());
1480			currentItemCountVal = itemCountVal;
1481			$(priceTotal).text(setComma((priceItemVal * itemCountVal)+delivery));
1482			finalPrice();
1483		}
1484		function finalPrice() {
1485			var priceNowVal = getNumber($(priceNow).text()),
1486				priceTotalVal = getNumber($(priceTotal).text());
1487			$(priceLeft).text(setComma(priceNowVal - priceTotalVal));
1488		}
1489	};
1490	feUI.MilageInfo();
1491	// Advance - Alarm(dateVal = 'YYYYMMDD')
1492	feUI.CalendarSlide = {
1493		init: function(dateVal, callback) {
1494			var EVENT_KEY = '.CalendarSlide',
1495				Event = {
1496					CLICK: 'click' + EVENT_KEY
1497				};
1498			var today = new Date(),
1499					year = ( dateVal ) ? dateVal.slice(0, 4) : today.getFullYear(),
1500					month = ( dateVal )
1501						? dateVal.slice(4, 6)
1502						: ( today.getMonth() + 1 ) < 10
1503							? '0' + ( today.getMonth() + 1 )
1504							: today.getMonth() + 1,
1505					day = ( dateVal )
1506						? dateVal.slice(6, 8)
1507						: today.getDate() < 10
1508							? '0' + today.getDate()
1509							: today.getDate(),
1510				newDate = new Date(year + '-' + month + '-' + day),
1511				dayNumber = newDate.getDay(),
1512				aniSpeed = 150,
1513				timeMill = 24 * 60 * 60 * 1000,
1514				weekTime = ( timeMill * 7);
1515			feUI.CalendarSlide.variable = {
1516				calendarWrap: '.alarm-cal',
1517				calendarTable: '.cal-table',
1518				defaultDate: new Date(newDate.getTime() - (timeMill * dayNumber)),
1519				activeDate: year + '-' + month + '-' + day,
1520				dayName: ['일', '월', '화', '수', '목', '금', '토']
1521			};
1522			var _ = feUI.CalendarSlide.variable;
1523			if ( !$(_.calendarWrap).length ) return false;
1524			$(_.calendarTable).filter('.center').remove();
1525			// Event
1526			$BODY.off(EVENT_KEY).on(Event.CLICK, _.calendarWrap + ' .btn', function(e) {
1527				var $this = $(this),
1528					isPrev = $this.hasClass('prev'),
1529					$centerTable = $(_.calendarTable).filter('.center'),
1530					$tgTable,
1531					swipePos,
1532					slidePos,
1533					centerTablePosUnit;
1534				e.preventDefault();
1535				if ( !isPrev ) {
1536					swipePos = 'left';
1537					slidePos = 'right';
1538					centerTablePosUnit = '-';
1539					// Create
1540					_.defaultDate = new Date(_.defaultDate.getTime() + weekTime);
1541					feUI.CalendarSlide.create(slidePos);
1542					$tgTable = $(_.calendarTable).filter('.right');
1543				} else {
1544					swipePos = 'right';
1545					slidePos = 'left';
1546					centerTablePosUnit = '+';
1547					// Create
1548					_.defaultDate = new Date(_.defaultDate.getTime() - weekTime);
1549					feUI.CalendarSlide.create(slidePos);
1550					$tgTable = $(_.calendarTable).filter('.left');
1551				}
1552				// Center
1553				$centerTable.stop(true, true).animate({
1554					left: centerTablePosUnit + '100%'
1555				}, aniSpeed);
1556				// Target table
1557				$tgTable.stop(true, true).animate({
1558					left: 0
1559				}, aniSpeed, function() {
1560					$(_.calendarTable).filter('.center').remove();
1561					$(this).removeClass('left right').addClass('center');
1562				});
1563			}).on(Event.CLICK, _.calendarWrap + ' .date', function(e) {
1564				var $this = $(this);
1565				e.preventDefault();
1566				_.activeDate = $this.closest('li').data('date');
1567				$(_.calendarTable).find('.' + ClassName.ACTIVE).removeClass(ClassName.ACTIVE);
1568				// Input
1569				$('.alarm-cal-input .date-input').val(_.activeDate);
1570				$this.addClass(ClassName.ACTIVE);
1571			});
1572			// Swipe
1573			$(_.calendarWrap).swipe({
1574				swipeStatus: function(event, phase, direction, distance, duration, fingers) {
1575					if ( direction === 'up' || direction === 'down' ) {
1576						return false;
1577					}
1578					if ( phase === 'end' || phase === 'cancel' ) {
1579						if ( distance < 100 ) return false;
1580						if ( direction === 'right') {
1581							$(_.calendarWrap).find('.prev').trigger(Event.CLICK);
1582							if ( typeof callback === 'function' ) {
1583								callback();
1584							}
1585						} else if ( direction === 'left') {
1586							$(_.calendarWrap).find('.next').trigger(Event.CLICK);
1587							if ( typeof callback === 'function' ) {
1588								callback();
1589							}
1590						}
1591					}
1592				},
1593				allowPageScroll: 'auto',
1594				threshold: 200
1595			});
1596			// Init
1597			feUI.CalendarSlide.create('center');
1598		},
1599		create: function(slidePos) {
1600			var _ = feUI.CalendarSlide.variable;
1601			// Wrapper
1602			$(_.calendarWrap).append('<ul class="cal-table ' + slidePos + '" />');
1603			// Date
1604			for ( var i = 0; i < 7; i++ ) {
1605				var time = ( 24 * 60 * 60 * 1000 ) * i,
1606					date = new Date(_.defaultDate.getTime() + time),
1607					year = date.getFullYear(),
1608					month = ( date.getMonth() + 1 ) < 10 ? '0' + ( date.getMonth() + 1 ) : date.getMonth() + 1,
1609						day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate(),
1610						dateData = year + '-' + month + '-' + day,
1611						appendCode = '<li data-date="' + dateData + '" data-day="' + _.dayName[i] + '"><span class="day">'
1612							+ _.dayName[i] + '</span><a href="/" class="date">'
1613							+ day + '</a><p class="on"><i class="icon-fill"></i></p></li>'; // 220823 개발시 : 약이 있을때 p 나오게 / 약 섭취했을때 p에 on class 추가
1614					$(_.calendarWrap).find(_.calendarTable).filter(':last').append(appendCode);
1615			}
1616			// Active
1617			$(_.calendarTable).find('[data-date="' + _.activeDate + '"] .date').addClass(ClassName.ACTIVE);
1618		}
1619	};
1620	feUI.CalendarSlide.init();
1621	// jQuery UI Datepicker(Required: jQuery UI)
1622	$.datepicker.setDefaults({
1623		prevText: '이전 달',
1624		nextText: '다음 달',
1625		dayNames: ['일요일', '월요일', '화요일', '수요일', '목요일', '금요일', '토요일'],
1626		dayNamesMin: ['일', '월', '화', '수', '목', '금', '토'],
1627		monthNames: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'],
1628		monthNamesShort: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'],
1629		showOtherMonths: true,
1630		showMonthAfterYear: true,
1631		yearSuffix: '',
1632		buttonImageOnly: true,
1633		showOn: 'both',
1634		dateFormat: 'yy.mm.dd',
1635		changeMonth: true,
1636		changeYear: true,
1637		yearRange: 'c-100:c+30'
1638		/*,beforeShow: function(e, ui) {
1639			var offset= $(this).offset();
1640			setTimeout(function() {
1641				feUI.Datepicker.caption(e);
1642				ui.dpDiv.css({'top':offset.top + 30, 'bottom':'', 'left':'50%', 'transform':'translateX(-50%)', 'width':'300px'});
1643			});
1644		}*/
1645	});
1646	feUI.Datepicker = {
1647		init: function() {
1648			feUI.Datepicker.variable = {
1649				icoTxt: '달력 보기/숨기기',
1650				icoURL: '/assets/consumer/mobile/img/common/ico_arrow.png',
1651				datepickerWrap: '.datepicker',
1652				datepickerInp: '.datepicker-input',
1653				dashLabel: '.label:contains(~)',
1654				settingBtn: '[data-dp-setting][data-dp-group]'
1655			};
1656			var _ = feUI.Datepicker.variable,
1657				$datepickerInp = $BODY.find(_.datepickerInp);
1658			if ( !$datepickerInp.length ) return false;
1659			$datepickerInp.each(function(){
1660				var $this = $(this);
1661				if ( $this.hasClass('datepicker-month') ) {
1662					$this.datepicker({
1663						dateFormat: 'yy.mm',
1664						buttonText: _.icoTxt,
1665						buttonImage: _.icoURL,
1666						maxDate:'today'
1667					});
1668				} else {
1669					$this.datepicker('destroy').datepicker({
1670						buttonText: _.icoTxt,
1671						buttonImage: _.icoURL
1672					});
1673				}
1674			});
1675			// Default date
1676			$datepickerInp.filter('[data-dp-date]').each(function() {
1677				var $this = $(this),
1678					dateVal = $(this).data('dp-date');
1679				$this.datepicker('setDate', dateVal);
1680			});
1681			// Button
1682			feUI.Datepicker.setting();
1683			feUI.Datepicker.setMinMax();
1684			// $datepickerInp.datepicker('setDate', 'today');
1685		},
1686		caption: function(e) {
1687			var $datepicker = $BODY.find('.ui-datepicker-calendar'),
1688				caption = ( $(e).prop('title') ) ? $(e).prop('title') : '달력';
1689			$datepicker.prepend('<caption>' + caption + '</caption>');
1690		},
1691		setMinMax: function() {
1692			var EVENT_KEY = '.Datepicker.setMinMax',
1693				Event = {
1694					CHANGE: 'change' + EVENT_KEY
1695				};
1696			var _ = feUI.Datepicker.variable;
1697			$BODY.off(EVENT_KEY).on(Event.CHANGE, _.datepickerInp, function(e, trigger) {
1698				var $this = $(this),
1699					$tgWrap = $this.closest(_.datepickerWrap),
1700					idx = $tgWrap.find(_.datepickerInp).index($this),
1701					optionKey = ( idx === 0 ) ? 'minDate' : 'maxDate';
1702				if ( $tgWrap.find(_.datepickerInp).length !== 2
1703					|| $tgWrap.find(_.dashLabel).length !== 1 ) return;
1704				setTimeout(function() {
1705					$tgWrap.find(_.datepickerInp).not($this).datepicker('option', optionKey, $this.val());
1706				}, 200);
1707				// Reset setting button
1708				if ( !trigger ) $tgWrap.find(_.settingBtn).prop('checked', false);
1709			});
1710		},
1711		setting: function() {
1712			var EVENT_KEY = '.Datepicker.setting',
1713				Event = {
1714					CHANGE: 'change' + EVENT_KEY
1715				};
1716			var _ = feUI.Datepicker.variable;
1717			$BODY.off(EVENT_KEY).on(Event.CHANGE, _.settingBtn, function() {
1718				var $this = $(this),
1719					groupStr = $this.data('dp-group'),
1720					settingStr = $this.data('dp-setting'),
1721					setDateUnit = settingStr.slice(0, 1),
1722					setDateStr = settingStr.split(setDateUnit + '-')[1],
1723					$datepickerInpGroup = $BODY.find(_.datepickerInp + '[data-dp-group="' + groupStr +'"]');
1724				( setDateUnit === 'b' )
1725					? $datepickerInpGroup
1726						.first().datepicker('setDate', '-' + setDateStr).end()
1727						.last().datepicker('setDate', new Date())
1728					: $datepickerInpGroup
1729						.first().datepicker('setDate', new Date()).end()
1730						.last().datepicker('setDate', '+' + setDateStr);
1731				// setMinMax
1732				$datepickerInpGroup.trigger('change', true);
1733			});
1734		}
1735	};
1736	feUI.Datepicker.init();
1737	// GNB layer
1738	feUI.setGNBLayer = {
1739		init: function () {
1740			feUI.setGNBLayer.variable = {
1741				$navBar: $BODY.find('.navbar'),
1742				$gnbBtn: $BODY.find('.btnGnbOpen'),
1743				$closeBtn: $BODY.find('.btnGnbClose')
1744			};
1745			feUI.setGNBLayer.open();
1746			feUI.setGNBLayer.close();
1747		},
1748		open: function () {
1749			var EVENT_KEY = '.setGNBLayer.open',
1750				Event = {
1751					CLICK: 'click' + EVENT_KEY
1752				};
1753			var _ = feUI.setGNBLayer.variable;
1754			_.$gnbBtn.off(EVENT_KEY).on(Event.CLICK, function (e) {
1755				e.preventDefault();
1756				_.$navBar.toggleClass(ClassName.ACTIVE);
1757				setTimeout(function() {
1758					_.$closeBtn.fadeIn(ANI_SPEED * 2);
1759				}, 100);
1760				$DIMMED_LAYER.fadeIn(ANI_SPEED);
1761			});
1762		},
1763		close: function () {
1764			var EVENT_KEY = '.setGNBLayer.close',
1765				Event = {
1766					CLICK: 'click' + EVENT_KEY
1767				};
1768			var _ = feUI.setGNBLayer.variable;
1769			_.$closeBtn.off(EVENT_KEY).on(Event.CLICK, function (e) {
1770				_.$navBar.removeClass(ClassName.ACTIVE);
1771				_.$closeBtn.fadeOut(ANI_SPEED);
1772				$DIMMED_LAYER.fadeOut(ANI_SPEED);
1773			});
1774			$DOCUMENT.off(EVENT_KEY).on(Event.CLICK, '.dimmedLayer', function () {
1775				_.$navBar.removeClass(ClassName.ACTIVE);
1776				_.$closeBtn.fadeOut(ANI_SPEED);
1777				$DIMMED_LAYER.fadeOut(ANI_SPEED);
1778			});
1779		}
1780	};
1781	feUI.setGNBLayer.init();
1782	// Select(Required: jQuery selectize)
1783	feUI.Select = {
1784		init: function() {
1785			var $select = $BODY.find('select.select:not(.selectized, .select-keyword, .select-custom, .select-label .select)');
1786			// Email
1787			feUI.Select.email();
1788			// Selectize
1789			$select.selectize({
1790				allowEmptyOption: true
1791			});
1792		},
1793		email: function() {
1794			var EVENT_KEY = '.Select.email',
1795				Event = {
1796					CHANGE: 'change' + EVENT_KEY
1797				};
1798			var serviceDomain = [
1799					'naver.com', 'hanmail.net', 'daum.net', 'nate.com', 'gmail.com',
1800					'hotmail.com', 'yahoo.com', 'dreamwiz.com'
1801				],
1802				customOpVal = 'custom';
1803			var emailGroup = '.email-group',
1804				emailSelect = emailGroup + ' select';
1805			// Create option, event
1806			$BODY.find(emailSelect).each(function() {
1807				var $this = $(this),
1808					optionCode;
1809				for ( var i = 0; i < serviceDomain.length; i++ ) {
1810					optionCode = '<option value="' + serviceDomain[i] + '">' + serviceDomain[i] + '</option>';
1811					$this.find('option:last').before(optionCode);
1812				}
1813			}).end().off(EVENT_KEY).on(Event.CHANGE, emailSelect, function() {
1814				var $this = $(this),
1815					$emailGroup = $this.closest(emailGroup),
1816					$selectedOp = $this.find('option:selected'),
1817					$domainInp = $emailGroup.find(':text.textfield:last'),
1818					selectedTxt = $selectedOp.text();
1819				( $selectedOp.val() === customOpVal || $selectedOp.val() === '' )
1820					? $domainInp.removeAttr('readonly').removeAttr('disabled').val('').focus()
1821					: $domainInp.prop({
1822						'readonly': true,
1823						'disabled': true
1824					}).val(selectedTxt);
1825			});
1826		},
1827		keyword: function(target, value, search, category, options) {
1828			if ( arguments.length < 4 ) return;
1829			var optionTemp = [{}],
1830				optionKeyArr = [],
1831				valueKey = $.trim(value),
1832				searchKey = $.trim(search);
1833			// Create option template
1834			if ( typeof(options) !== 'string' ) {
1835				optionTemp = options;
1836			} else {
1837				$.each(arguments, function(idx, val) {
1838					if ( idx < 4 || typeof(val) !== 'string' ) return;
1839					optionTemp[0][val] = '';
1840				});
1841			}
1842			// Create render option
1843			optionKeyArr[0] = $.trim(search);
1844			if ( typeof(category) === 'string' && $.trim(category) !== '' ) {
1845				optionKeyArr[1] = $.trim(category);
1846			}
1847			// Init
1848			$(target).each(function(idx) {
1849				var $this = $(this),
1850					tgSelectize,
1851					plugins = ( $this.hasClass('select-auto') )
1852						? 'restore_on_backspace' : 'remove_button';
1853				// Selectize
1854				$this.selectize({
1855					plugins: [plugins],
1856					delimiter: '^',
1857					persist: false,
1858					valueField:  valueKey,
1859					searchField: searchKey,
1860					maxItems: 10,
1861					options: optionTemp,
1862					render: {
1863						option: function(data, escape) {
1864							var optionCode = '';
1865							for (var i = 0; i < optionKeyArr.length; i++) {
1866								optionCode += '<span class="option-item' + ( i + 1 ) + '">' + data[optionKeyArr[i]] + '</span>';
1867							}
1868							return '<div class="option">' +	optionCode + '</div>';
1869						},
1870						item: function(data, escape) {
1871							return '<div class="item">'
1872								+	'<span>' + data[searchKey] + '</span>'
1873								+ '</div>';
1874						}
1875					}
1876				});
1877				tgSelectize = $this[0].selectize;
1878				// Create keyup property
1879				tgSelectize.keyupVal = '';
1880				// select-reload
1881				if ( $this.hasClass('select-reload') ) {
1882					tgSelectize.settings.openOnFocus = false;
1883					tgSelectize.on('item_add', function(value, data) {
1884						tgSelectize.keyupVal = '';
1885					});
1886					tgSelectize.on('item_remove', function(value) {
1887						tgSelectize.clearOptions();
1888						tgSelectize.keyupVal = '';
1889					});
1890				}
1891				// select-one
1892				if ( $this.hasClass('select-one') || $this.hasClass('select-auto') ) {
1893					tgSelectize.settings.maxItems = 1;
1894					tgSelectize.on('change', function(value) {
1895						( value !== '' )
1896							? tgSelectize.$control_input.attr('maxlength', 0)
1897							: tgSelectize.$control_input.removeAttr('maxlength');
1898					});
1899				}
1900				// select-create
1901				if ( $this.hasClass('select-create') || $this.hasClass('select-auto') ) {
1902					tgSelectize.settings.create = function(input) {
1903						var createOption = {};
1904						$.each(Object.keys(optionTemp[0]), function(idx, val) {
1905							createOption[val] = input;
1906						});
1907						createOption['text'] = input;
1908						return createOption;
1909					};
1910				}
1911				// Close Dropdown
1912				tgSelectize.$control.on('click', '.item', function() {
1913					tgSelectize.close();
1914				});
1915			});
1916		}
1917	};
1918	feUI.Select.init();
1919	// applyLayer
1920	feUI.applyLayer = {
1921		init: function () {
1922			feUI.applyLayer.variable = {
1923				$applyGroup: $BODY.find('.event-apply-group'),
1924				$openBtn: $BODY.find('.open-apply-layer'),
1925				$applyLayer: $BODY.find('.event-apply-layer'),
1926				$closeBtn: $BODY.find('.close-apply-layer'),
1927				$applyBtn: $BODY.find('.btn-apply'),
1928				ani_speed: 200
1929			};
1930			feUI.applyLayer.execution();
1931		},
1932		open: function () {
1933			var _ = feUI.applyLayer.variable;
1934			_.$applyGroup.addClass(ClassName.ACTIVE);
1935			_.$applyLayer.slideDown(_.ani_speed, function () {
1936				$(this).addClass(ClassName.ACTIVE);
1937			});
1938			_.$openBtn.hide();
1939			_.$applyBtn.show();
1940			$DIMMED_LAYER.show();
1941		},
1942		close: function () {
1943			var _ = feUI.applyLayer.variable;
1944			_.$applyGroup.removeClass(ClassName.ACTIVE);
1945			_.$applyLayer.slideUp(_.ani_speed, function () {
1946				$(this).removeClass(ClassName.ACTIVE);
1947			});
1948			_.$openBtn.show();
1949			_.$applyBtn.hide();
1950			$DIMMED_LAYER.hide();
1951		},
1952		execution: function () {
1953			var EVENT_KEY = '.applyLayer.execution',
1954				Event = {
1955					CLICK: 'click' + EVENT_KEY
1956				};
1957			var _ = feUI.applyLayer.variable;
1958			_.$openBtn.off(EVENT_KEY).on(Event.CLICK, function (e) {
1959				feUI.applyLayer.open();
1960				e.preventDefault();
1961			});
1962			_.$closeBtn.off(EVENT_KEY).on(Event.CLICK, function () {
1963				feUI.applyLayer.close();
1964			});
1965			$DIMMED_LAYER.off(EVENT_KEY).on(Event.CLICK, function () {
1966				feUI.applyLayer.close();
1967			});
1968		}
1969	};
1970	feUI.applyLayer.init();
1971	// alertLayer
1972	feUI.alertLayer = {
1973		init: function () {
1974			feUI.alertLayer.variable = {
1975				$alertGroup: $BODY.find('.alert-group'),
1976				$openAlertBtn: $BODY.find('.open-alert-layer'),
1977				$alertLayer: $BODY.find('.alert-layer'),
1978				$closeAlertBtn: $BODY.find('.close-alert-layer'),
1979				$alertBtn: $BODY.find('.btn-alert'),
1980				ani_speed: 0
1981			};
1982			feUI.alertLayer.execution();
1983		},
1984		open: function () {
1985			var _ = feUI.alertLayer.variable;
1986			_.$alertGroup.addClass(ClassName.ACTIVE);
1987			_.$alertLayer.slideDown(_.ani_speed, function () {
1988				$(this).addClass(ClassName.ACTIVE);
1989			});
1990			_.$openAlertBtn.hide();
1991			_.$alertBtn.show();
1992			$DIMMED_LAYER.show();
1993		},
1994		close: function () {
1995			var _ = feUI.alertLayer.variable;
1996			_.$alertGroup.removeClass(ClassName.ACTIVE);
1997			_.$alertLayer.slideUp(_.ani_speed, function () {
1998				$(this).removeClass(ClassName.ACTIVE);
1999			});
2000			_.$openAlertBtn.show();
2001			_.$alertBtn.hide();
2002			$DIMMED_LAYER.hide();
2003		},
2004		execution: function () {
2005			var EVENT_KEY = '.alertLayer.execution',
2006				Event = {
2007					CLICK: 'click' + EVENT_KEY
2008				};
2009			var _ = feUI.alertLayer.variable;
2010			_.$openAlertBtn.off(EVENT_KEY).on(Event.CLICK, function (e) {
2011				feUI.alertLayer.open();
2012				e.preventDefault();
2013			});
2014			_.$closeAlertBtn.off(EVENT_KEY).on(Event.CLICK, function () {
2015				feUI.alertLayer.close();
2016			});
2017			$DIMMED_LAYER.off(EVENT_KEY).on(Event.CLICK, function () {
2018				feUI.alertLayer.close();
2019			});
2020		}
2021	};
2022	feUI.alertLayer.init();
2023	// Modal(Required: jQuery Modal)
2024	feUI.Modal = {
2025		init: function() {
2026			$.modal.defaults.closeText = '닫기',
2027			$.modal.defaults.clickClose = false,
2028			// $.modal.defaults.fadeDuration = 50,
2029			$.modal.defaults.showSpinner = false;
2030			$DOCUMENT.on($.modal.BEFORE_BLOCK, feUI.Modal.before)
2031				.on($.modal.OPEN, feUI.Modal.open)
2032				.on($.modal.CLOSE, feUI.Modal.close);
2033			feUI.Modal.target();
2034			feUI.Modal.disabled();
2035		},
2036		target: function() {
2037			var EVENT_KEY = '.Modal.target',
2038				Event = {
2039					CLICK: 'click' + EVENT_KEY,
2040				};
2041			var targetBtn = 'button.modal-open:not(.disabled, [disabled])';
2042			$BODY.off(EVENT_KEY).on(Event.CLICK, targetBtn, function(e) {
2043				var $this = $(this);
2044				$.ajax({
2045					url: $this.data('modal'),
2046					success: function(results, textStatus, jqXHR) {
2047						$this.addClass('modal-anchor');
2048						$(results).appendTo('body').modal();
2049					}
2050				});
2051			});
2052		},
2053		disabled: function() {
2054			var EVENT_KEY = '.Modal.disabled',
2055				Event = {
2056					CLICK: 'click' + EVENT_KEY,
2057				};
2058			var disabledBtn = 'a.modal-open.disabled';
2059			$BODY.off(EVENT_KEY).on(Event.CLICK, disabledBtn, function(e) {
2060				return false;
2061			});
2062		},
2063		before: function(event, modal) {
2064			$HTML.addClass(ClassName.MODAL_ACTIVE);
2065		},
2066		open: function(event, modal) {
2067			feUI.LayoutClass();
2068			feUI.FileInput();
2069			feUI.Select.init();
2070			feUI.slideSet();
2071			feUI.FamilySlide();
2072			//feUI.EllipsisText();
2073			feUI.AddRoleAttribute();
2074			feUI.FocusRotation(modal.$elm);
2075			// Scroll
2076			if ( modal.$elm.has('.scroll-content').length ) modal.$elm.find('.scroll-content').scrollTop(0);
2077			// modal-custom
2078			if ( modal.$blocker.find('.modal-custom').length ) modal.$blocker.find('.modal').addClass('modal-custom');
2079
2080			/*
2081			// 검색 추가
2082			var btn_search = modal.$anchor.first();
2083			if (btn_search.attr("class") == ("btn btn-search")){
2084				$(".jquery-modal").addClass("search_popup").addClass("on");
2085			}*/
2086			// 위치 레이어팝업
2087			var btn_search = modal.$anchor.first();
2088			if (btn_search.attr("class") == ("now_location")){
2089				$(".jquery-modal").addClass("layer_popup");
2090			}
2091		},
2092		close: function(event, modal) {
2093			if ( modal.$anchor[0].tagName !== 'A' ) {
2094				modal.$elm.remove();
2095				$BODY.find('.modal-anchor').focus().removeClass('modal-anchor');
2096			} else {
2097				modal.$anchor.focus();
2098			}
2099			setTimeout(function() {
2100				$HTML.removeClass(ClassName.MODAL_ACTIVE);
2101			}, $.modal.defaults.fadeDuration + 10);
2102		}
2103	};
2104	feUI.Modal.init();
2105
2106	// For Hospital, Pharm, Doctor page
2107	feUI.Custom = {
2108		init: function() {
2109			feUI.Custom.showFooterBtn();
2110		},
2111		showFooterBtn : function (){
2112			if($BODY.find('.footer_btn').length > 0) {
2113				$("footer").append("<a href=\"/ourtown/doctorqna/add\" target=\"_parent\" class=\"btn btn-doctorQnaGo\"><span>건강 Q&amp;A</span><i class=\"icon-sideBar03\"></i></a>");
2114				$(window).on("load", function(){
2115					setTimeout(function() {
2116						$(".btn-doctorQnaGo").animate({ "width": "42px", "padding":0 });
2117						$(".btn-doctorQnaGo i").animate({"opacity":1},"fast")
2118						$(".btn-doctorQnaGo span").animate({ "opacity": 0 }, "fast").hide();
2119					}, 5000);
2120				});
2121			}
2122		}
2123	};
2124	feUI.Custom.init();
2125
2126	// Window Event
2127	feUI.EndPage = $.noop;
2128	$WINDOW.on(Event.RESIZE, function() {
2129		if ( WINDOW_WIDTH !== $WINDOW.width() )
2130			WINDOW_WIDTH = $WINDOW.width();
2131		if ( WINDOW_HEIGHT !== $WINDOW.height() )
2132			WINDOW_HEIGHT = $WINDOW.height();
2133		feUI.mainCard();
2134		feUI.slideCard();
2135		feUI.scheduleGroupAccordion();
2136		feUI.Sec3Guide();
2137		feUI.MainSlideHeight();
2138	}).on(Event.SCROLL, function() {
2139		SCROLL_UP = (SCROLLTOP_POS > $WINDOW.scrollTop()) ? true : false,
2140		SCROLL_DOWN = (SCROLLTOP_POS < $WINDOW.scrollTop()) ? true : false,
2141		SCROLLTOP_POS = $WINDOW.scrollTop();
2142		feUI.GoTopBtn();
2143		// End
2144		if (SCROLLTOP_POS + WINDOW_HEIGHT + 100 >= $DOCUMENT.height()) feUI.EndPage();
2145	});
2146})(feUI, jQuery, window, document);
2147
2148
2149
2150/*
2151$(".btn-search").click(function(event){
2152	event.preventDefault();
2153	this.blur();
2154	$.get(this.href, function(html) {
2155		$(html).appendTo('#search_wrap').modal("open").addClass("on");
2156	});
2157	$("html").addClass("modal-active has-slide");
2158});*/
2159
2160/*
2161$(".btn-search").click(function(){
2162	$("html").append("<div id='search_wrap'></div>");
2163	console.log("bb");
2164	var xhr = $.ajax({
2165		url : "/assets/consumer/mobile/html/2021_new/search/search_bar.html",
2166		dataType : "html",
2167		success : function(result){
2168			//$("#search_wrap").html(result).removeClass("off").addClass("on");
2169			$("#search_wrap").html(result);
2170			$("html").addClass("modal-active");
2171			$("body").css("overflow","hidden");
2172			$(".search_bar input[type=text]").focus();
2173			//$(".jquery-modal").addClass("on");
2174		}
2175		//$("#search_wrap").modal("open");
2176	});
2177});
2178
2179$(document).on("click", ".search_navbar .btn, .search_close a", function(){
2180	console.log("Aa");
2181	$(".search_bar input[type=text]").val(" ");
2182	$("html").removeClass("modal-active");
2183	// $("#search_wrap").removeClass("on").addClass("off").delay(500).queue(function(){
2184	// 	$(this).remove();
2185	// });
2186	$("#search_wrap").remove();
2187	$("body").css("overflow","auto");
2188	//$(".jquery-modal").removeClass("on");
2189	//$("#search_wrap").modal("close");
2190});
2191*/
2192
2193// 위치선택 모달팝업
2194/*
2195var xhr;
2196$(".btn_location").click(function(){
2197	$("html").append("<div id='location_wrap'></div>");
2198	xhr = $.ajax({
2199		url : "/assets/consumer/mobile/html/2021_new/search/location.html",
2200		dataType : "html",
2201		success : function(result){
2202			$("#location_wrap").html(result).addClass("on");
2203			$("html").addClass("modal-active");
2204			$("body").css("overflow","hidden");
2205		}
2206	});
2207});
2208
2209$(document).on("click", ".location_option .btn-close", function(){
2210	$("html").removeClass("modal-active");
2211	$("#location_wrap").remove();
2212	$("body").css("overflow","auto");
2213	xhr.abort();
2214});*/
2215
2216// 리뷰쓰기 모달팝업
2217/*
2218var xhr;
2219$(".btn_write_review").click(function(){
2220	$("html").append("<div id='review_wrap'></div>");
2221	xhr = $.ajax({
2222		url : "/assets/consumer/mobile/html/2021_new/search/review.html",
2223		dataType : "html",
2224		success : function(result){
2225			$("#review_wrap").html(result).addClass("on");
2226			$("html").addClass("modal-active");
2227			$("body").css("overflow","hidden");
2228		}
2229	});
2230});
2231
2232$(document).on("click", "#review_wrap .review_option .btn-close", function(){
2233	$("html").removeClass("modal-active");
2234	$("#review_wrap").remove();
2235	$("body").css("overflow","auto");
2236	xhr.abort();
2237});*/
2238
2239// 상담요청 모달팝업
2240/*
2241var xhr2;
2242$(".btn_consulting").click(function(){
2243	$("html").append("<div id='consulting_wrap'></div>");
2244	xhr2 = $.ajax({
2245		url : "/assets/consumer/mobile/html/2021_new/search/consulting.html",
2246		dataType : "html",
2247		success : function(result){
2248			$("#consulting_wrap").html(result).addClass("on");
2249			$("html").addClass("modal-active");
2250			$("body").css("overflow","hidden");
2251		}
2252	});
2253});
2254
2255$(document).on("click", "#consulting_wrap .review_option .btn-close", function(){
2256	$("html").removeClass("modal-active");
2257	$("#consulting_wrap").remove();
2258	$("body").css("overflow","auto");
2259	xhr2.abort();
2260});*/
2261
2262var xhr2;
2263$(".now_location").on("click", nowLocationClick);
2264function nowLocationClick(){
2265	var nowMenu = $("#nowMenu").val();
2266	if(typeof(nowMenu) == "undefined" || nowMenu == "" || nowMenu == null){
2267		nowMenu = "";
2268	}
2269	var targetDocument = (self == top ? window.document : top.window.document)
2270	if($(".wrap .modi-main-wrap-new", targetDocument).length > 0) {
2271		$(".wrap .modi-main-wrap-new", targetDocument).remove();
2272	}
2273	$(".wrap", targetDocument).prepend("<div class=\"modi-main-wrap-new\"></div>");
2274	$(".modi-main-wrap-new", targetDocument).append("<div id='location_wrap'></div>");
2275	xhr2 = $.ajax({
2276		url : "/main/hospital/theme/main/location",
2277		dataType : "html",
2278		data : {"nowMenu" : nowMenu},
2279		success : function(result){
2280			$(".modi-main-wrap-new", targetDocument).find("#location_wrap").html(result);
2281			//$("html").addClass("modal-active");
2282			//$("body").css("overflow","hidden");
2283		}
2284	});
2285}
2286
2287$(document).on("click", "#location_wrap .btn-close", function(){
2288	$(".modi-main-wrap-new").remove();
2289	$(".now_location").off("click").on("click", nowLocationClick);
2290	$(".btn_report_modal").off("click").on("click", reportModalOpenClick);
2291	return false;
2292});
2293
2294
2295var xhr3;
2296$(".btn_record").click(function() {
2297	$._ajax.post('/dosage/alarm/checkAgreement','', function(data){
2298		if(!data) {
2299			top.location.href = "/dosage/alarm/agreement";
2300		} else {
2301			top.location.href = "/dosage/alarm/myRecord";
2302		}
2303	}, null, true);
2304});
2305$(".btn_pill").click(function(){
2306	$("html").append("<div id='sensitive_wrap'></div>");
2307
2308	var agmYnCnt = $("#agmYnCnt").val();
2309
2310	if(agmYnCnt > 0){
2311		location.href="/health/medicationRemind/list?agmYn=true&securityItem=4201";
2312	}else{
2313		xhr3 = $.ajax({
2314			url : "/health/medicationRemind/list", // 210903 url 수정해주세요
2315			dataType : "html",
2316			success : function(result){
2317
2318				if(typeof $search != "undefined") {
2319					var isNotConfirm = $(result).find("#agmYn").length;
2320					if(isNotConfirm > 0) {
2321						$("#sensitive_wrap").html(result);
2322					} else {
2323						location.href="/health/medicationRemind/list?agmYn=true&securityItem=4201";
2324					}
2325				} else {
2326					$("#sensitive_wrap").html(result);
2327				}
2328
2329			}
2330		});
2331	}
2332});
2333
2334
2335$(document).on("click", "#sensitive_wrap .btn-close", function(){	
2336	$("#sensitive_wrap").remove();	
2337});
2338
2339var xhr4;
2340$(".btn_report_modal").on("click", reportModalOpenClick);
2341function reportModalOpenClick(e){
2342	$.Utils.SYSTEM.loginCheck(function(){
2343		var targetDocument = (self == top ? window.document : top.window.document)
2344		if($(".wrap .modi-main-wrap-new", targetDocument).length > 0) {
2345			$(".wrap .modi-main-wrap-new", targetDocument).remove();
2346		}
2347		$(".wrap", targetDocument).prepend("<div class=\"modi-main-wrap-new\"></div>");
2348		$(".modi-main-wrap-new", targetDocument).append("<div id='location_wrap' class='report_location_wrap'></div>");
2349
2350		var modal_path = e.currentTarget.dataset.href;
2351
2352		xhr4 = $.ajax({
2353			url : modal_path,
2354			dataType : "html",
2355			success : function(result){
2356				$(".modi-main-wrap-new", targetDocument).find("#location_wrap").html(result);
2357				return;
2358				//$("html").addClass("modal-active");
2359				//$("body").css("overflow","hidden");
2360			}
2361		});
2362	});
2363}
2364
2365
2366$(document).on("click", ".comment_location_wrap .btn-close", function(){
2367	$(".modi-main-wrap-new").remove();
2368	$(".btn_comment_modal").off("click").on("click", commentModalOpenClick);
2369	return false;
2370});
2371
2372var xhr5;
2373$(".btn_comment_modal").on("click", commentModalOpenClick);
2374function commentModalOpenClick(e){
2375	$.Utils.SYSTEM.loginCheck(function(){
2376		var targetDocument = (self == top ? window.document : top.window.document)
2377		if($(".wrap .modi-main-wrap-new", targetDocument).length > 0) {
2378			$(".wrap .modi-main-wrap-new", targetDocument).remove();
2379		}
2380		$(".wrap", targetDocument).prepend("<div class=\"modi-main-wrap-new\"></div>");
2381		$(".modi-main-wrap-new", targetDocument).append("<div id='location_wrap' class='comment_location_wrap'></div>");
2382
2383		var modal_path = e.currentTarget.dataset.href;
2384
2385		xhr5 = $.ajax({
2386			url : modal_path,
2387			dataType : "html",
2388			success : function(result){
2389				$(".modi-main-wrap-new", targetDocument).find("#location_wrap").html(result);
2390				return;
2391			}
2392		});
2393	});
2394}
2395
2396$(document).on("click", "#body_wrap .btn-close", function(){
2397	$(".modi-main-wrap-new").remove();
2398	return false;
2399});
2400
2401
2402$(document).on("click", "#sensitive_wrap .btn-close", function(){
2403	//$("html").removeClass("modal-active");
2404	$("#sensitive_wrap").remove();
2405	//$("body").css("overflow","auto");
2406	//xhr3.abort();
2407});
2408
2409
2410function event_app(pcURL, mobileURL, title, w, h){
2411	location.href = mobileURL;
2412}
2413
2414function getUUID() {
2415	return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
2416		var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 3 | 8);
2417		return v.toString(16);
2418	});
2419}
2420
2421$(".doctorqna_tip a").click(function(){
2422	$(".doctorqna_tip").hide();
2423});
2424
2425
2426// 건강 Q&A 작성 placeholder
2427$("body").on("change keyup", ".placeholder_wrap textarea", function() {
2428	var length = $(this).val().length;
2429	if (length > 0) {
2430		$(this).addClass('on');
2431	} else {
2432		$(this).removeClass('on');
2433	}
2434});
2435$("body").on("paste", ".placeholder_wrap textarea", function(e) {
2436	var data = e.originalEvent.clipboardData.getData('Text');
2437	if (data.length > 0) {
2438		$(this).addClass('on');
2439	} else {
2440		$(this).removeClass('on');
2441	}
2442});
2443
2444//건강 Q&A list, view 병원약국 바로가기
2445function linkToExpandHnpPage(e){
2446	var link = e.dataset.href;
2447	var targetDocument = (self == top ? window.document : top.window.document);
2448	if(link != undefined && link != "") {
2449		targetDocument.location.href = link;
2450	} else {
2451			return false;
2452	}
2453}
2454
2455function getOpeningTime(item, htmlType, openStartTimes, openEndTimes, saturdayLunch) {
2456	try{
2457		$.ajax({
2458			type: "get",
2459			url : "/hospital/find/ajaxIsHolidayOpen",
2460			dataType : "json",
2461			data : {"ykiho" : item},
2462			success : function(result){
2463				var isHoliday = result.body;
2464				var holidayIndex = 39;
2465				if(isHoliday == 1) {
2466					setDetailOpenTime(openStartTimes, openEndTimes, holidayIndex, item, htmlType);
2467				} else if(isHoliday > 1) {
2468					setHospitalHoliday(item, htmlType);
2469				} else {
2470					setDetailOpenTime(openStartTimes, openEndTimes, -1, item, htmlType, saturdayLunch);
2471				}
2472			},
2473			error : function(error){
2474			}
2475		});
2476	}catch(e){
2477		console.dir(e);
2478	};
2479}
2480function setHospitalHoliday(ykiho, htmlType) {
2481
2482	removeNowOpen(ykiho, htmlType);
2483}
2484
2485function setDetailOpenTime(startTime, endTime, idx, ykiho, htmlType, saturdayLunch) {
2486
2487	if(startTime == "" || endTime == "" || startTime == undefined || endTime == undefined) {
2488		removeNowOpen(ykiho, htmlType);
2489		return;
2490	}
2491
2492	var todayDate = new Date();
2493	var todayIndex = 0;
2494	var dgtmIndex = 31;
2495	if(idx < 0) {
2496		todayIndex = todayDate.getDay();
2497		if(todayIndex > 0) {
2498			todayIndex += dgtmIndex;
2499		} else {
2500			todayIndex = 38;
2501		}
2502	} else {
2503		todayIndex = idx;
2504	}
2505
2506	var startTimeArr = startTime.split(",");
2507	var endTimeArr = endTime.split(",");
2508
2509	if(startTimeArr.length != endTimeArr.length ) {
2510		return;
2511	}
2512
2513	var resultTime = "";
2514	var lunchStartTime = "";
2515	var lunchEndTime = "";
2516	var isSatLunchtmYn = false;
2517	try{
2518		$.each(startTimeArr, function(idx, item) {
2519			if(item != "") {
2520				var targetIdx = item.substring(0,2);
2521				if(todayIndex == targetIdx && item.substring(2,6) != "0000" && endTimeArr[idx].substring(2,6) != "0000" ) {
2522					resultTime = item.substring(2,4) + ":"  + item.substring(4,6) + " ~ "
2523					+ endTimeArr[idx].substring(2,4) + ":"  + endTimeArr[idx].substring(4,6);
2524				}
2525				if (item.length == 7 && item.substring(0,3) == "310") {
2526					lunchStartTime = item.substring(3,7);
2527					lunchEndTime = endTimeArr[idx].substring(3,7);
2528				}
2529			}
2530		});
2531	} catch(e) {
2532		resultTime = "";
2533	}
2534
2535	if(resultTime != "") {
2536		if(htmlType == "ad") {	//병원검색 - 광고영역
2537			resultTime = "<span>" + "오늘 " + resultTime + "</span>";
2538		} else if(htmlType == "relation") {	//병원상세 - 관련병원/약국
2539			var isOpen = getNowOpen(resultTime, todayDate);
2540			if(isOpen) {
2541				if(ykiho.length > 10) {
2542					resultTime = "진료중";
2543				} else {
2544					resultTime = "영업중";
2545				}
2546			} else {
2547				$(".clsName_" + ykiho).remove();
2548			}
2549		} else if(htmlType == "disease" ) {	//질환백과 - 관련병원
2550			resultTime = "<i class=\"icon\"></i>" + resultTime;
2551			var isOpen = getNowOpen(resultTime, todayDate);
2552			if(isOpen) {
2553				resultTime += "<span class=\"bg_blue\">진료중</span>";
2554			}
2555		} else if(htmlType == "main") {	//질환백과 - 관련병원
2556			resultTime = "<i class=\"icon\"></i>" + resultTime;
2557			var isOpen = getNowOpen(resultTime, todayDate);
2558			if(isOpen) {
2559				if($(".tag_" + ykiho).length > 0) {
2560					if(ykiho.length > 10) {
2561						$(".tag_" + ykiho).html("<span>진료중</span>");
2562					} else {
2563						$(".tag_" + ykiho).html("<span>영업중</span>");
2564					}
2565				}
2566			} else {
2567				if($(".tag_" + ykiho).length > 0) {
2568					$(".tag_" + ykiho).html("<span class=\"bg_gray\">준비중</span>");
2569				}
2570			}
2571		} else if(htmlType == "detail") {	//병원상세-진료시간
2572			var isOpen = getNowOpen(resultTime, todayDate);
2573			var isLunchTime = getLunchTime(lunchStartTime, lunchEndTime, isOpen, todayDate);
2574			$(".clsName_" + ykiho).html(resultTime);
2575
2576			if(saturdayLunch == undefined) {
2577				saturdayLunch = "Y";
2578			}
2579
2580			if(isOpen) {
2581				if($(".tag_" + ykiho).length > 0) {
2582					if(ykiho.length > 10) {
2583						$(".tag_" + ykiho).html(isLunchTime && saturdayLunch == "Y" ? "점심시간" : "진료중");
2584					} else {
2585						$(".tag_" + ykiho).html(isLunchTime && saturdayLunch == "Y" ? "점심시간" : "영업중");
2586					}
2587				}
2588			}
2589		} else {
2590			resultTime = "오늘 " + resultTime;
2591		}
2592
2593		if($(".clsName_" + ykiho).length > 0 ) {
2594			$(".clsName_" + ykiho).html(resultTime);
2595		}
2596	} else {
2597		removeNowOpen(ykiho, htmlType);
2598	}
2599}
2600
2601function getNowOpen(timeStr, nowDate) {
2602
2603	var isOpen = false;
2604	try{
2605		timeStr = timeStr.replace(/[^0-9]/g, "");
2606		var startTime = Number(timeStr.substring(0, 4));
2607		var endTime = Number(timeStr.substring(4,8));
2608		var nowTime = nowDate.getHours() + "" + (nowDate.getMinutes() < 10 ? "0" + nowDate.getMinutes() : nowDate.getMinutes());
2609		if(nowTime >= startTime && nowTime <= endTime) {
2610			isOpen = true;
2611		}
2612	} catch(e){}
2613
2614	return isOpen;
2615}
2616
2617function getLunchTime(lunchStartTime, lunchEndTime, isOpen, nowDate, saturdayLunch) {
2618	if (!isOpen || lunchStartTime == "" || lunchEndTime == "") {
2619		return false;
2620	}
2621	if (saturdayLunch != undefined && saturdayLunch == "N") {
2622
2623	}
2624
2625	var nowTime = nowDate.getHours() + "" + (nowDate.getMinutes() < 10 ? "0" + nowDate.getMinutes() : nowDate.getMinutes());
2626	if(nowTime >= parseInt(lunchStartTime)&& nowTime <= parseInt(lunchEndTime)) {
2627		return true;
2628	}
2629	return false;
2630}
2631
2632function removeNowOpen(ykiho, htmlType){
2633	if(htmlType == "main") {
2634		if($(".tag_" + ykiho).length > 0) {
2635			$(".tag_" + ykiho).html("<span class=\"bg_gray\">준비중</span>");
2636		}
2637	} else if(htmlType == "detail") {
2638		if($(".clsName_" + ykiho).length > 0) {
2639			if(ykiho.length > 10) {
2640				$(".clsName_" + ykiho).html("휴진");
2641			} else {
2642				$(".clsName_" + ykiho).html("휴무");
2643			}
2644		}
2645		if($(".tag_" + ykiho).length > 0) {
2646			$(".tag_" + ykiho).remove();
2647		}
2648	} else {
2649		if($(".clsName_" + ykiho).length > 0) {
2650			$(".clsName_" + ykiho).remove();
2651		}
2652		if($(".tag_" + ykiho).length > 0) {
2653			$(".tag_" + ykiho).remove();
2654		}
2655	}		
2656}
2657
2658$(function(){
2659	// 토다닥 앱으로 이동
2660	$(".banner_hospital a, .inner_todadoc a, .btn_tutorial").click(function(){
2661		window.open("https://whodadoccare.page.link/eNh4");
2662	});
2663	
2664	
2665	$(".btn_tutorial .slick-vertical").not(".slick-initialized");
2666	setTimeout(function(){
2667		$(".btn_tutorial .slick-vertical").slick({
2668			autoplay : true,
2669			autoplaySpeed : 2000,
2670			arrows : false,
2671			dots: false,
2672			speed : 500,
2673			vertical:true
2674		});
2675	},1000);
2676
2677	// 케어 연동 이벤트
2678	$(".event_care_rolling").slick({
2679		infinite : false,
2680		centerMode: true,
2681		centerPadding: '19%',
2682		arrow: false,
2683		dots: true,
2684		dotsClass: 'event_care_dots'
2685	});
2686
2687	// 윈앤티켓 이벤트
2688	$(".btn_winnticket").click(function(){
2689		$(".wrap_winnticket .alert_layer").show();
2690	});
2691	$(".wrap_winnticket .btn_no").click(function(){
2692		$(".wrap_winnticket .alert_layer").hide();
2693	});
2694	$(".wrap_winnticket .btn_yes").click(function(){
2695		$(".wrap_winnticket .alert_layer").hide();
2696		if (idopIF.isApp) {
2697			idopIF.openInNewWindow("https://winnticket.com/whodadoc");
2698		} else {
2699			window.open("https://winnticket.com/whodadoc","_blank");
2700		}
2701	});
2702
2703	// 평생회원 이벤트
2704	$(".wrap_member .btn_member").click(function(){
2705		$(".wrap_member .pop_member").show();
2706	});
2707	$(".wrap_member .pop_close").click(function(){
2708		$(".wrap_member .pop_member").hide();
2709	});
2710});
2711
2712$(window).on("load", function(){
2713	setTimeout(function() {
2714		$(".btn-reviewWrite").animate({ "width": "46px", "padding":0 },"fast");
2715		$(".btn-reviewWrite i").animate({"opacity":1},"fast")
2716		$(".btn-reviewWrite span").animate({ "opacity": 0 }, "fast").hide();
2717	}, 5000);
2718});

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.