PageSourceSearch

https://skoolooks.com/app/javascript/js/common-function.js?dummy=20210713191300

js skoolooks.com collected 2026-10-07 04:32:30 UTC 116,426 bytes, 3,494 lines download raw bytes

1
2var gl_basic_currency					= 'KRW';
3var gl_skin_currency					= 'KRW';
4var gl_basic_currency_symbol			= '원';
5var gl_basic_currency_symbol_position	= 'after';
6
7function strip_tags(html){
8
9	//PROCESS STRING
10	if(arguments.length < 3) {
11		html=html.replace(/<\/?(?!\!)[^>]*>/gi, '');
12	} else {
13		var allowed = arguments[1];
14		var specified = eval("["+arguments[2]+"]");
15		if(allowed){
16			var regex='</?(?!(' + specified.join('|') + '))\b[^>]*>';
17			html=html.replace(new RegExp(regex, 'gi'), '');
18		} else{
19			var regex='</?(' + specified.join('|') + ')\b[^>]*>';
20			html=html.replace(new RegExp(regex, 'gi'), '');
21		}
22	}
23
24	//CHANGE NAME TO CLEAN JUST BECAUSE
25	var clean_string = html;
26
27	//RETURN THE CLEAN STRING
28	return clean_string;
29}
30
31/* input form style 적용*/
32function apply_input_style(){
33
34	setDefaultText();
35	setDatepicker();
36
37	$(".onlynumber, .onlynumber_signed").on("keydown", function(e) {
38		if($(this).hasClass('onlynumber')) return onlynumber(e);
39		if($(this).hasClass('onlynumber_signed')) return onlynumber_signed(e);
40	}).on('focusin', function() {
41		if ($(this).val() == '0') $(this).val('');
42	}).on('focusout', function() {
43		if ($(this).val() == '') $(this).val('0');
44	}).on('change', function() {
45		if($(this).attr('max')){
46			var max = num($(this).attr('max'));
47			if(num($(this).val()) > max){
48				$(this).val(max).change();
49			}
50		}
51		if($(this).attr('min')){
52			var min = num($(this).attr('min'));
53			if(num($(this).val()) < min){
54				$(this).val(min).change();
55			}
56		}
57		$(this).val( $(this).val().replace(/[^0-9\-]*/gi, ''));
58	});
59
60	$(".onlyfloat").on("keydown", function(e) {
61		if (e.keyCode != 190 && e.keyCode != 110) return onlynumber(e);
62	}).on('focusin', function() {
63		if ($(this).val() == '0') $(this).val('');
64	}).on('focusout', function() {
65		if ($(this).val() == '') $(this).val('0');
66	}).on('change', function() {
67		if (gl_set_mode != 'mobile') {
68			$(this).val( $(this).val().replace(/[^0-9\-\.]*/gi, '') );
69		}
70	});
71
72	$(".percent").bind("keyup",function(){
73		if( $(this).val() > 100 ){
74			$(this).val(100);
75		}
76	});
77
78	help_tooltip();
79}
80
81function help_tooltip(){
82/* 툴팁 */
83	$(".helpicon, .mainhelpicon, .help, .colorhelpicon, .underhelpicon").each(function(){
84
85		var options = {
86			className: 'tip-darkgray',
87			bgImageFrameSize: 8,
88			alignTo: 'target',
89			alignX: 'right',
90			alignY: 'center',
91			offsetX: 10,
92			allowTipHover: false,
93			slide: false,
94			showTimeout : 0
95		}
96
97		if($(this).attr('options')){
98			var customOptions = eval('('+$(this).attr('options')+')');
99			for(var i in customOptions){
100				options[i] = customOptions[i];
101			}
102		}
103
104		$(this).poshytip(options);
105	});
106
107	// 상세 레이어창 열기 :: 2016-08-17 lwh
108	$(".detailDescriptionLayerBtn").unbind("click").bind("click",function(){
109		currencyCompareList($(this));
110	});
111
112	//상세 레이어창 열기 :: 마우스 오버용 @2016-11-08
113	$(".detailDescriptionLayerBtn.over").unbind("mouseover").bind("mouseover",function(){
114		currencyCompareList($(this));
115	});
116	$(".detailDescriptionLayerBtn.over").unbind("mouseout").bind("mouseout",function(){
117		$('div.detailDescriptionLayer').hide();
118	});
119
120	$(".currency_compare_lay .detailDescriptionLayerCloseBtn").bind("click",function(){
121		$('div.detailDescriptionLayer').hide();
122	});
123}
124
125// 비교통화 노출
126function currencyCompareList(obj){
127
128	var layer	= $(obj).parent().find('div.detailDescriptionLayer');
129	var title	= $(obj).attr("title");
130	var idx		= parseInt(Math.random()*10000000);
131
132	if(title){
133		var message	= "";
134		if($(obj).parent().find('div.detailDescriptionLayer .layer_wrap .layer_inner').html() != null){
135			message	= $(obj).parent().find('div.detailDescriptionLayer .layer_wrap .layer_inner').html();
136		}else{
137			message	= layer.html();
138		}
139		var cont	= "";
140		cont_new	= '<div class="layer_wrap">';
141		cont_new	= cont_new + '<h1>' + title + '</h1>';
142		cont_new	= cont_new + '<div class="layer_inner">' + message + '</div>';
143		cont_new	= cont_new + '<a href="javascript:;" class="detailDescriptionLayerCloseBtn '+idx+'" onclick="detailDescriptionLayerClose('+idx+')"></a>';
144		cont_new	= cont_new + '</div>';
145		layer.html(cont_new);
146		$(".helpicon_noimg").each(function(){ //상품정보 재고/가용 팁툴 마우스오버용
147
148			var options = {
149				className: 'tip-darkgray',
150				bgImageFrameSize: 8,
151				alignTo: 'target',
152				alignX: 'left',
153				alignY: 'center',
154				offsetX: 10,
155				allowTipHover: false,
156				slide: false,
157				showTimeout : 0
158			}
159
160			if($(this).attr('options')){
161				var customOptions = eval('('+$(this).attr('options')+')');
162				for(var i in customOptions){
163					options[i] = customOptions[i];
164				}
165			}
166
167			$(this).poshytip(options);
168		});
169	}
170
171	$('div.detailDescriptionLayer').not($(obj).next('div.detailDescriptionLayer')).hide();$(obj).next('div.detailDescriptionLayer').toggle()
172}
173
174// 특정 영역 하위만 활성화
175function area_help_tooltip(obj){
176	$(obj).find(".helpicon, .mainhelpicon, .help, .colorhelpicon, .underhelpicon").each(function(){
177
178		var options = {
179			className: 'tip-darkgray',
180			bgImageFrameSize: 8,
181			alignTo: 'target',
182			alignX: 'right',
183			alignY: 'center',
184			offsetX: 10,
185			allowTipHover: false,
186			slide: false,
187			showTimeout : 0
188		}
189
190		if($(this).attr('options')){
191			var customOptions = eval('('+$(this).attr('options')+')');
192			for(var i in customOptions){
193				options[i] = customOptions[i];
194			}
195		}
196
197		$(this).poshytip(options);
198	});
199}
200
201/* input form style 적용*/
202function chk_small_goods_image(){
203	$('img.small_goods_image').error(function(){
204		var noImageSrc = '/data/icon/goods/error/noimage_list.gif';
205		if (this.src != noImageSrc) {// image was broken, replace with your new image
206			this.src = noImageSrc;
207		}
208	}).each(function(){
209		this.setAttribute('src',this.getAttribute('src'));
210	});
211}
212
213function reMakeHelpIcon(){
214	/* 툴팁 */
215	$(".addHelpIcon").each(function(){
216
217		var options = {
218			className: 'tip-darkgray',
219			bgImageFrameSize: 8,
220			alignTo: 'target',
221			alignX: 'right',
222			alignY: 'center',
223			offsetX: 10,
224			allowTipHover: false,
225			slide: false,
226			showTimeout : 0
227		}
228
229		if($(this).attr('options')){
230			var customOptions = eval('('+$(this).attr('options')+')');
231			for(var i in customOptions){
232				options[i] = customOptions[i];
233			}
234		}
235
236		$(this).poshytip(options);
237	});
238}
239
240function setDatepicker(selector){
241
242	if(!selector) selector = ".datepicker";
243	var randKey = Math.floor(Math.random() * 0x75bcd15);
244
245	/* 달력 */
246	$(selector).each(function(i){
247
248		if(!$(this).is(".datepicker")){
249			return;
250		}
251		if($(this).data('datepickerSettingDone')){
252			return;
253		}
254
255		var randId = randKey.toString() + '_' + i.toString();
256
257		var options = {
258			dateFormat : 'yy-mm-dd',
259			timeFormat: 'hh:mm:ss',
260			showOn: "button",
261			dayNamesMin : ['일', '월', '화', '수', '목', '금', '토'],
262			monthNamesShort : ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
263			showButtonPanel : true,
264			showMonthAfterYear : true,
265			changeYear : true,
266			changeMonth : true,
267			closeText : '닫기',
268			currentText : '오늘',
269			yearRange : '1900:c+10',
270			buttonImage: "/app/javascript/jquery/icon_calendar.gif",
271			buttonImageOnly: true
272		}
273
274		if($(this).attr('gettype')){
275			options.dateFormat	= $(this).attr('gettype');
276		}
277
278		if(!$(this).attr('id') || $(this).attr('id').substring(0,11)=='datepicker_'){
279			$(this).attr('id','datepicker_'+randId);
280		}
281
282		if($(this).attr('options')){
283			var customOptions = eval('('+$(this).attr('options')+')');
284			for(var i in customOptions){
285				options[i] = customOptions[i];
286			}
287		}
288
289		if($(this).is(".datepicker"))		{
290			$(this).datepicker(options);
291			$(this).data('datepickerSettingDone',true);
292		}
293
294	});
295}
296
297/*
298* datepicker 날짜 선택 제한
299*/
300function fnDatepicker(mode,day) {
301	if(typeof day == 'undefined') day = 0;
302	var options = new Array();
303
304	if(mode == 'min'){
305		options['minDate'] = day;
306	}else if (mode == 'max'){
307		options['maxDate'] = day;
308	}
309
310	return options;
311}
312
313function setTimepicker(selector){
314
315	if(!selector) selector = ".datetimepicker";
316
317	/* 달력 */
318	$(selector).each(function(i){
319
320		var options = {
321			dateFormat : 'yy-mm-dd',
322			timeFormat: 'hh:mm:ss',
323			showOn: "button",
324			dayNamesMin : ['일', '월', '화', '수', '목', '금', '토'],
325			monthNamesShort : ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
326			showButtonPanel : true,
327			showMonthAfterYear : true,
328			changeYear : true,
329			changeMonth : true,
330			closeText : '닫기',
331			currentText : '오늘',
332			buttonImage: "/app/javascript/jquery/icon_calendar.gif",
333			buttonImageOnly: true
334		}
335
336		if(!$(this).attr('id') || $(this).attr('id').substring(0,11)=='datepicker_'){
337			$(this).attr('id','datepicker_'+i);
338		}
339
340		if($(this).attr('options')){
341			var customOptions = eval('('+$(this).attr('options')+')');
342			for(var i in customOptions){
343				options[i] = customOptions[i];
344			}
345		}
346
347		if($(this).is(".datetimepicker"))	$(this).datetimepicker(options);
348
349	});
350}
351
352function onlynumber(event){
353	var e = event.keyCode;
354
355	if (e>=48 && e<=57) return;
356	if (e>=96 && e<=105) return;
357	if (e>=37 && e<=40) return;
358	if (e==8 || e==9 || e==13 || e==46 || (e==229 && gl_set_mode == 'mobile')) return;
359
360	event.preventDefault();
361	return false;
362}
363function onlynumber_signed(event){
364	var e = event.keyCode;
365
366	if (e>=48 && e<=57) return;
367	if (e>=96 && e<=105) return;
368	if (e>=37 && e<=40) return;
369	if (e==8 || e==9 || e==13 || e==46 || e==109 || e==189) return;
370
371	event.preventDefault();
372	return false;
373}
374
375//password -> type change , title add 2012-10-19
376function setDefaultText(){
377	try{
378		$('input, textarea')
379		.each(function(){
380			var thisInputObj = $(this);
381			if(thisInputObj.attr('title') != thisInputObj.attr('placeholder') || !thisInputObj.attr('placeholder')) thisInputObj.attr('placeholder',thisInputObj.attr('title'));
382		})
383		// $('input, textarea').placeholder();
384	} catch (e) {
385		setTimeout(function(){
386			$("input[type='text'][title!=''], textarea[title!=''], input[type='password'][title!=''][password='password']")
387			.each(function(){
388				var thisInputObj = $(this);
389				$(this.form).submit(function(){
390					if(thisInputObj.val() == thisInputObj.attr('title')) thisInputObj.val('');
391				})
392			})
393			.bind('focusin focusout keydown',function(event){
394				if(event.type=='focusout')
395				{
396					if($(this).val() == '')
397					{
398						if ( $(this).attr('password') == 'password' && $(this).attr('title')) {
399							if(($.browser.version >= 9.0 && $.browser.msie) || !$.browser.msie ) {
400								if( $(this).attr("id")){
401									document.getElementById($(this).attr("id")).type = "text";
402								}else{
403									document.getElementsByName($(this).attr("name")).type = "text";
404								}
405								$(this).val($(this).attr('title')).addClass('input-box-default-text');
406							}
407						}else{
408							$(this).val($(this).attr('title')).addClass('input-box-default-text');
409						}
410					}
411				}
412				if(event.type=='focusin' || event.type=='keydown')
413				{
414					if($(this).val() == $(this).attr('title') ){
415						if ( $(this).attr('password') == 'password' && $(this).attr('title')) {
416							if(($.browser.version >= 9.0 && $.browser.msie) || !$.browser.msie ) {
417								if( $(this).attr("id")){
418									document.getElementById($(this).attr("id")).type = "password";
419								}else{
420									document.getElementsByName($(this).attr("name")).type = "password";
421								}
422								$(this).val('');
423							}
424						}else{
425							$(this).val('');
426						}
427					}
428					$(this).removeClass('input-box-default-text');
429				}
430			}).focusout();
431		},300);
432
433		setTimeout(function(){
434			$("input[type='password'][title][password!='password']")
435			.each(function(){
436				var thisInputObj = $(this);
437				if(!thisInputObj.attr('uniqCloneId')){
438					var uniqCloneId = uniqid();
439					var thisCloneObj = $("<input type='text' />");
440					thisCloneObj
441					.attr('style',$(this).attr('style'))
442					.attr('size',$(this).attr('size'))
443					.attr('class',$(this).attr('class'))
444					.addClass('input-box-default-text');
445					//var thisCloneObj = $(this).clone().attr({'type':'text','name':'','id':uniqCloneId});
446					if($(this).attr('tabIndex')) thisCloneObj.attr('tabIndex',$(this).attr('tabIndex'));
447					$(this).attr('uniqCloneId',uniqCloneId);
448					$(thisCloneObj).attr({'value':$(this).attr('title'),'title':''});
449
450					thisCloneObj.bind('focus',function(){
451						thisInputObj.show().focus();
452						$(this).hide();
453					});
454					$(this).hide().after(thisCloneObj);
455
456					$(this).bind('focusout',function(event){
457						if($(this).val() == '')
458						{
459							$(this).hide();
460							thisCloneObj.show();
461						}else{
462							$(this).show();
463							thisCloneObj.hide();
464						}
465					}).focusout();
466				}
467			})
468
469		},300);
470	}
471}
472
473
474//password -> type change , title add 2012-10-19
475function areaSetDefaultText(obj){
476	try{
477		$(obj).find('input, textarea')
478		.each(function(){
479			var thisInputObj = $(this);
480			if(thisInputObj.attr('title') != thisInputObj.attr('placeholder') || !thisInputObj.attr('placeholder')) thisInputObj.attr('placeholder',thisInputObj.attr('title'));
481		})
482		// $('input, textarea').placeholder();
483	} catch (e) {
484		setTimeout(function(){
485			$(obj).find("input[type='text'][title!=''], textarea[title!=''], input[type='password'][title!=''][password='password']")
486			.each(function(){
487				var thisInputObj = $(this);
488				$(this.form).submit(function(){
489					if(thisInputObj.val() == thisInputObj.attr('title')) thisInputObj.val('');
490				})
491			})
492			.bind('focusin focusout keydown',function(event){
493				if(event.type=='focusout')
494				{
495					if($(this).val() == '')
496					{
497						if ( $(this).attr('password') == 'password' && $(this).attr('title')) {
498							if(($.browser.version >= 9.0 && $.browser.msie) || !$.browser.msie ) {
499								if( $(this).attr("id")){
500									document.getElementById($(this).attr("id")).type = "text";
501								}else{
502									document.getElementsByName($(this).attr("name")).type = "text";
503								}
504								$(this).val($(this).attr('title')).addClass('input-box-default-text');
505							}
506						}else{
507							$(this).val($(this).attr('title')).addClass('input-box-default-text');
508						}
509					}
510				}
511				if(event.type=='focusin' || event.type=='keydown')
512				{
513					if($(this).val() == $(this).attr('title') ){
514						if ( $(this).attr('password') == 'password' && $(this).attr('title')) {
515							if(($.browser.version >= 9.0 && $.browser.msie) || !$.browser.msie ) {
516								if( $(this).attr("id")){
517									document.getElementById($(this).attr("id")).type = "password";
518								}else{
519									document.getElementsByName($(this).attr("name")).type = "password";
520								}
521								$(this).val('');
522							}
523						}else{
524							$(this).val('');
525						}
526					}
527					$(this).removeClass('input-box-default-text');
528				}
529			}).focusout();
530		},300);
531
532		setTimeout(function(){
533			$(obj).find("input[type='password'][title][password!='password']")
534			.each(function(){
535				var thisInputObj = $(this);
536				if(!thisInputObj.attr('uniqCloneId')){
537					var uniqCloneId = uniqid();
538					var thisCloneObj = $("<input type='text' />");
539					thisCloneObj
540					.attr('style',$(this).attr('style'))
541					.attr('size',$(this).attr('size'))
542					.attr('class',$(this).attr('class'))
543					.addClass('input-box-default-text');
544					//var thisCloneObj = $(this).clone().attr({'type':'text','name':'','id':uniqCloneId});
545					if($(this).attr('tabIndex')) thisCloneObj.attr('tabIndex',$(this).attr('tabIndex'));
546					$(this).attr('uniqCloneId',uniqCloneId);
547					$(thisCloneObj).attr({'value':$(this).attr('title'),'title':''});
548
549					thisCloneObj.bind('focus',function(){
550						thisInputObj.show().focus();
551						$(this).hide();
552					});
553					$(this).hide().after(thisCloneObj);
554
555					$(this).bind('focusout',function(event){
556						if($(this).val() == '')
557						{
558							$(this).hide();
559							thisCloneObj.show();
560						}else{
561							$(this).show();
562							thisCloneObj.hide();
563						}
564					}).focusout();
565				}
566			})
567
568		},300);
569	}
570}
571/*
572function comma(x)
573{
574	var temp = "";
575	var x = String(uncomma(x));
576
577	num_len = x.length;
578	co = 3;
579	while (num_len>0){
580		num_len = num_len - co;
581		if (num_len<0){
582			co = num_len + co;
583			num_len = 0;
584		}
585		temp = ","+x.substr(num_len,co)+temp;
586	}
587	var result = temp.substr(1);
588	result = result.replace('-,', '-');
589	result = result.replace('-0', '0');
590
591	return result;
592}
593*/
594
595function comma(data_value) {
596	var data_value = String(uncomma(data_value));
597    var txtNumber = '' + data_value;    // 입력된 값을 문자열 변수에 저장합니다.
598    if (isNaN(txtNumber) || txtNumber == "") {    // 숫자 형태의 값이 정상적으로 입력되었는지 확인합니다.
599        alert("숫자만 입력 하세요");
600        return;
601    }
602    else {
603        var rxSplit = new RegExp('([0-9])([0-9][0-9][0-9][,.])');    // 정규식 형태 생성
604        var arrNumber = txtNumber.split('.');    // 입력받은 숫자를 . 기준으로 나눔. (정수부와 소수부분으로 분리)
605        arrNumber[0] += '.'; // 정수부 끝에 소수점 추가
606        do {
607            arrNumber[0] = arrNumber[0].replace(rxSplit, '$1,$2'); // 정수부에서 rxSplit 패턴과 일치하는 부분을 찾아 replace 처리
608        } while (rxSplit.test(arrNumber[0])); // 정규식 패턴 rxSplit 가 정수부 내에 있는지 확인하고 있다면 true 반환. 루프 반복.
609        if (arrNumber.length > 1) { // txtNumber를 마침표(.)로 분리한 부분이 2개 이상이라면 (즉 소수점 부분도 있다면)
610            return arrNumber.join(''); // 배열을 그대로 합칩. (join 함수에 인자가 있으면 인자를 구분값으로 두고 합침)
611        }
612        else { // txtNumber 길이가 1이라면 정수부만 있다는 의미.
613            return arrNumber[0].split('.')[0]; // 위에서 정수부 끝에 붙여준 마침표(.)를 그대로 제거함.
614        }
615    }
616}
617
618function uncomma(x){
619	var result		= '';
620	var reg			= /(,)*/g;
621	var txtNumber	= '' + String(x);
622	var arrNumber	= txtNumber.split('.');
623	arrNumber[0]	= parseInt(String(arrNumber[0]).replace(reg,""));
624
625	if	(arrNumber.length > 1){
626		result		= arrNumber.join('.');
627	}else{
628		result		= arrNumber[0];
629	}
630
631	return (isNaN(result)) ? 0 : result;
632}
633
634function uncomma_float(x)
635{
636	var reg = /(,)*/g;
637	x = parseFloat(String(x).replace(reg,""));
638	return (isNaN(x)) ? 0 : x;
639}
640
641function num(val){
642	if(!val || val=='' || isNaN(val)){
643		return 0;
644	}else{
645		return parseInt(val);
646	}
647}
648
649function num_float(val){
650	if(!val || val=='' || isNaN(val)){
651		return 0;
652	}else{
653		return parseFloat(val);
654	}
655}
656
657// 소숫점을 포함한 comma함수
658function float_comma(price){
659	var result	= price + '';
660	if	(result.search(/\./) != -1){
661		var tmp	= result.split('.');
662		result	= comma(tmp[0]) + '.' + tmp[1];
663	}else{
664		result	= comma(price);
665	}
666
667	result	= result.replace('-,', '-');
668	result	= result.replace('-0', '0');
669
670	return result;
671}
672
673/* 카테고리 가져오기*/
674function category_select_load(preSelectName,selectName,code,callbackFunction){
675	$("select[name='" + selectName + "'] option").each(function(){ if( $(this).val() ) $(this).remove(); });
676	if(preSelectName && !code) return;
677	$.ajax({
678		type: "GET",
679		url: "/common/category2json",
680		data: "categoryCode=" + code,
681		dataType: 'json',
682		success: function(result){
683			var options = "";
684			for(var i=0;i<result.length;i++) options += "<option value='"+result[i].category_code+"'>"+result[i].title+"</option>";
685			$("select[name='" + selectName + "']").append(options);
686			if(options){
687				$("select[name='" + selectName + "']").show();
688			}
689			if(preSelectName){
690				$("select[name='" + preSelectName + "'] option[value='"+code+"']").attr("selected",true);
691			}
692
693			if(callbackFunction){
694				callbackFunction(result);
695			}
696		}
697	});
698}
699
700
701function loadingStart(target,customOptions){
702	var options = {segments: 12, width: 5.5, space: 15, length: 13, color: '#ffffff', speed: 1.5};
703
704	if(customOptions != undefined){
705		for(var i in customOptions){
706			options[i] = customOptions[i];
707		}
708	}
709
710	if(!target) var target = "#ajaxLoadingLayer";
711
712	$(target).css({'opacity':'0.5'}).activity(options).show();
713	$(target).find("div").eq(0).css({'z-index':'1000'});//mobile loadingimg
714}
715
716function loadingStop(target,noHidden){
717	if(!target) var target = "#ajaxLoadingLayer";
718	if(noHidden){
719		$(target).css({'opacity':'1'}).activity(false);
720	}else{
721		$(target).hide().activity(false);
722	}
723}
724
725//모바일submit 체크
726function loadingstartsubmit(){
727	loadingStart("body",{segments: 12, width: 25.5, space: 6, length: 23, color: '#000000', speed: 1.5, valign: 'bottom',padding: '1'});
728}
729
730
731/* 다이얼로그 띄우기 (타이틀, 레이어아이디, 옵션) */
732function openDialog(title, layerId, customOptions, callback){
733
734	if((typeof layerId) != 'string') var layerSelector = layerId;
735	else if(layerId.substring(0,1)=='#' || layerId.substring(0,1)=='.' || (typeof layerId) != 'string') var layerSelector = layerId;
736	else var layerSelector = "#"+layerId;
737
738	var options = {
739		"zIndex" : 10000,
740//		"show" : "fade",
741//		"hide" : "fade",
742		"modal" : true,
743		"resizable" : false,
744		"draggable" : false,
745		"noClose" : false
746	};
747
748	if(customOptions != undefined){
749		for(var i in customOptions){
750			options[i] = customOptions[i];
751		}
752	}
753
754	options['title'] = title;
755
756	if(callback){
757		$(layerSelector).dialog({
758			"modal" : options['modal'],
759			"close" : function(){
760				callback();
761			}
762		});
763	}
764
765	$(function(){
766		if(customOptions['autoOpen']==false){
767
768			$(layerSelector)
769			.dialog({"autoOpen" : false})
770			.dialog("option", options);
771
772		}else{
773			$(layerSelector)
774			.dialog({"autoOpen" : false})
775			.dialog("option", options)
776			.dialog("open")
777			.focus();
778		}
779
780		// 스크롤시 레이어 위치 조정
781		var top_pos = parseInt($(layerSelector).closest('.ui-dialog').css('top'));
782		setTimeout(function(){
783			if( top_pos < $(document).scrollTop()){
784				top_pos = $(document).scrollTop();
785				if( top_pos < 0 ) top_pos = 0;
786				$(layerSelector).closest('.ui-dialog').css('top',top_pos+'px');
787			}
788		},200);
789
790
791
792		if(options['noClose']==false){
793
794			$(".ui-dialog-titlebar-close",$(layerSelector).closest(".ui-dialog")).show();
795			$(".ui-dialog-titlebar-close").bind("click",function(){
796
797				//lek 오늘하루그만보기 추가
798				if($('#open_limit_check').is(":checked")) setCookie("isChk","Y",1);
799
800				if(layerId=='recommendDisplayGoodsSelect'){
801					parent.$(window).css("overflow-y","auto");
802					$(this).dialog("close");
803				}else{
804					$(window).css("overflow-y","auto");
805					$(this).dialog("close");
806				}
807			});
808		}else{
809
810			$(".ui-dialog-titlebar-close",$(layerSelector).closest(".ui-dialog")).hide();
811			$(layerSelector).dialog("option","close",function(){
812				if(options['noClose'])	$(layerSelector).dialog("open").focus();
813			});
814		}
815
816		/* 해당창을 최상위로 보내기 */
817		var maxZindex	= 0;
818
819		$(".ui-widget-overlay").each(function(k){
820			if(maxZindex < $(this).css("z-index")) maxZindex = $(this).css("z-index");
821		});
822
823		maxZindex++;
824		$(layerSelector).css("z-index",eval(maxZindex)+" !important");
825	});
826
827}
828
829//lek 오늘하루그만보기 추가
830function setCookie(cname, cvalue, exdays) {
831	var d = new Date();
832	d.setTime(d.getTime() + (exdays*24*60*60*1000));
833	var expires = "expires="+d.toUTCString();
834	document.cookie = cname + "=" + cvalue + "; " + expires;
835}
836
837/* 18.03.05 kmj callback 문제로 수정 */
838function openDialogNew(title, layerId, customOptions, callback){
839
840	if((typeof layerId) != 'string') var layerSelector = layerId;
841	else if(layerId.substring(0,1)=='#' || layerId.substring(0,1)=='.' || (typeof layerId) != 'string') var layerSelector = layerId;
842	else var layerSelector = "#"+layerId;
843
844	var options = {
845		"zIndex" : 10000,
846//		"show" : "fade",
847//		"hide" : "fade",
848		"modal" : true,
849		"resizable" : false,
850		"draggable" : false,
851		"noClose" : false
852	};
853
854	if(customOptions != undefined){
855		for(var i in customOptions){
856			options[i] = customOptions[i];
857		}
858	}
859
860	options['title'] = title;
861
862	$(function(){
863		if(customOptions['autoOpen']==false){
864
865			$(layerSelector)
866			.dialog({"autoOpen" : false})
867			.dialog("option", options);
868
869		}else{
870			$(layerSelector)
871			.dialog({"autoOpen" : false})
872			.dialog("option", options)
873			.dialog("open")
874			.focus();
875		}
876
877		// 스크롤시 레이어 위치 조정
878		var top_pos = parseInt($(layerSelector).closest('.ui-dialog').css('top'));
879		setTimeout(function(){
880			if( top_pos < $(document).scrollTop()){
881				top_pos = $(document).scrollTop();
882				if( top_pos < 0 ) top_pos = 0;
883				$(layerSelector).closest('.ui-dialog').css('top',top_pos+'px');
884			}
885		},200);
886
887		if(options['noClose']==false){
888			$(".ui-dialog-titlebar-close",$(layerSelector).closest(".ui-dialog")).show();
889			$(".ui-dialog-titlebar-close").bind("click",function(){
890				if(layerId=='recommendDisplayGoodsSelect'){
891					parent.$(window).css("overflow-y","auto");
892					$(this).dialog("close");
893				}else{
894					$(window).css("overflow-y","auto");
895					$(this).dialog("close");
896				}
897			});
898		}else{
899			$(".ui-dialog-titlebar-close",$(layerSelector).closest(".ui-dialog")).hide();
900			$(layerSelector).dialog("option","close",function(){
901				if(options['noClose'])	$(layerSelector).dialog("open").focus();
902			});
903		}
904
905		/* 해당창을 최상위로 보내기 */
906		var maxZindex	= 0;
907
908		$(".ui-widget-overlay").each(function(k){
909			if(maxZindex < eval($(this).css("z-index"))) maxZindex = eval($(this).css("z-index"));
910		});
911
912		maxZindex++;
913		$(layerSelector).css("z-index",eval(maxZindex)+" !important");
914
915		if(callback){
916			$(layerSelector).dialog({
917				"modal" : options['modal'],
918				"close" : function(){
919					callback();
920				}
921			});
922		}
923	});
924}
925
926/* 다이얼로그 닫기 */
927function closeDialog(layerId){
928	if((typeof layerId) != 'string') var layerSelector = layerId;
929	else if(layerId.substring(0,1)=='#' || layerId.substring(0,1)=='.' || (typeof layerId) != 'string') var layerSelector = layerId;
930	else var layerSelector = "#"+layerId;
931	$(layerSelector).dialog("close");    
932}
933
934/* 다이얼로그 팝업창띄우기(미리 div영역을 만들어놓을필요가 없음) */
935function openDialogPopup(title, layerId, customOptions, onloadCallback){
936	closeDialog(layerId);
937
938	var layerSelector = "#"+layerId;
939
940	if($(layerSelector).length==0){
941		layerSelector = $("<div id='"+layerId+"'></div>").appendTo('body');
942	}
943
944	if(customOptions['url']){
945		$.ajax({
946			'cache' : false,
947			'url' : customOptions['url'],
948			'type' : customOptions['type']?customOptions['type']:'get',
949			'data' : customOptions['data']?customOptions['data']:{},
950			'success' : function(result){
951				$(layerSelector).html(result);
952				openDialog(title, layerId, customOptions);
953				if(onloadCallback){
954					onloadCallback();
955				}
956			}
957		});
958	}
959
960}
961
962/* Alert 다이얼로그 */
963/* 사용예
964	openDialogAlert("저장했습니다.",400,140,function(){
965		alert("확인을 눌렀습니다.");
966	});
967*/
968function openDialogAlert(msg,width,height,callback,customOptions){
969	if(gl_mobile_mode && gl_set_mode == 'mobile'){
970		openDialogAlertmobile(msg,width,height,callback,customOptions);
971		return;
972	}
973	var options = {
974		"z-index"		: 999999,
975		"hideButton"	: false,
976		"modal" 		: true
977	};
978
979	if(customOptions != undefined){
980		for(var i in customOptions){
981			options[i] = customOptions[i];
982		}
983	}
984
985	if(width) options['width'] = width;
986	if(height) options['height'] = height;
987
988	document.getElementById('openDialogLayerMsg').innerHTML = msg;
989
990	admin_flag = check_is_admin();
991
992	//알림 <span class='desc'>알림 정보를 표시합니다.</span>
993	title = getAlert('et352');
994	if	(admin_flag)
995		title = "알림 <span class='desc'>알림 정보를 표시합니다.</span>";
996	openDialog(title, "openDialogLayer", options);
997
998	if(callback){
999		$("#openDialogLayer").dialog({
1000			"modal" : options['modal'],
1001			"close" : function(){
1002				callback();
1003			}
1004		});
1005	}
1006	//확인
1007	btn_y = getAlert('et353')
1008	if	(admin_flag)
1009		btn_y = '확인';
1010
1011	options.btn_title	= (options.btn_title) ? options.btn_title : btn_y;
1012	options.btn_class	= (options.btn_class) ? options.btn_class : 'btn medium';
1013	options.btn_action	= (options.btn_action) ? options.btn_action : function(){ $('#openDialogLayer').dialog('close'); };
1014
1015	$("#openDialogLayerBtns").remove();
1016	if(!options.hideButton){
1017		var button = $('<input>').attr('type', 'button');
1018		if(options.btn_title) button.attr('value', options.btn_title);
1019		if(options.btn_action) {
1020			if(typeof options.btn_action === 'string'){
1021				button.attr('onclick', options.btn_action);
1022			} else if(typeof options.btn_action === 'function'){
1023				if($().jquery == '1.6.4'){
1024					button.bind('click', options.btn_action);
1025				}else{
1026					button.on('click', options.btn_action);
1027				}
1028			}
1029		}
1030		$("#openDialogLayer").append(
1031			$('<div>').attr('id', 'openDialogLayerBtns').css({'text-align': 'center', 'padding-top': '15px'}).append(
1032				$('<span>').addClass(options.btn_class).append(
1033					button
1034				)
1035			)
1036		);
1037	}
1038	$("#openDialogLayerBtns input:eq(0)").focus();
1039}
1040
1041function openDialogAlerttitle(title, msg,width,height,callback,customOptions){
1042
1043	var options = {
1044		"hideButton"	: false,
1045		"modal" 		: true
1046	};
1047
1048	if(customOptions != undefined){
1049		for(var i in customOptions){
1050			options[i] = customOptions[i];
1051		}
1052	}
1053
1054	if(width) options['width'] = width;
1055	if(height) options['height'] = height;
1056
1057	document.getElementById('openDialogLayerMsg').innerHTML = msg;
1058	openDialog(title, "openDialogLayer", options);
1059
1060	if(callback){
1061		$("#openDialogLayer").dialog({
1062			"modal" : options['modal'],
1063			"close" : function(){
1064				callback();
1065			}
1066		});
1067	}
1068
1069	$("#openDialogLayerBtns").remove();
1070	if(!options.hideButton){
1071		$("#openDialogLayer").append("<div id='openDialogLayerBtns' align='center' style='padding-top:15px'><button class='resp_btn v3 size_XL' onclick=\"$('#openDialogLayer').dialog('close');\" >닫기</button></div>");
1072	}
1073	$("#openDialogLayerBtns input:eq(0)").focus();
1074
1075}
1076
1077/* Confirm 다이얼로그 */
1078/* 사용예
1079	openDialogConfirm('저장하시겠습니까?',400,140,function(){
1080		alert('예를 눌렀습니다.');
1081	},function(){
1082		alert('아니오를 눌렀습니다.');
1083	});
1084
1085*/
1086function openDialogConfirm(msg,width,height,yesCallback,noCallback,params){
1087	if(gl_mobile_mode && gl_set_mode == 'mobile'){
1088		openDialogConfirmmobile(msg,width,height,yesCallback,noCallback,params);
1089		return;
1090	}
1091
1092	var choicedYes = false;
1093	admin_flag = check_is_admin();
1094
1095	document.getElementById('openDialogLayerMsg').innerHTML = msg;
1096	//알림 <span class='desc'>알림 정보를 표시합니다.</span>
1097	title = getAlert('et352');
1098	if	(admin_flag)
1099		title = "알림 <span class='desc'>알림 정보를 표시합니다.</span>";
1100	openDialog(title, "openDialogLayer", {"width":width,"height":height});
1101
1102	$("#openDialogLayer").dialog({
1103			close : function(){
1104				if(noCallback && !choicedYes){
1105					noCallback();
1106				}
1107			}
1108	});
1109	var params = typeof params!='undefined' ? params : {};
1110	//예
1111	btn_y = getAlert('et354');
1112	if	(admin_flag)
1113		btn_y = '예';
1114	if(!params['yesMsg']){params['yesMsg'] = btn_y;}
1115	//아니오
1116	btn_n = getAlert('et355');
1117	if	(admin_flag)
1118		btn_n = '아니오';
1119	if(!params['noMsg']){params['noMsg'] = btn_n;}
1120
1121	$("#openDialogLayerBtns").remove();
1122	$("#openDialogLayer").append("<div id='openDialogLayerBtns' align='center' style='padding-top:15px'><span class='btn medium'><button type='button' id='openDialogLayerConfirmYesBtn'>"+params['yesMsg']+"</button></span> <span class='btn medium'><button type='button' id='openDialogLayerConfirmNoBtn'>"+params['noMsg']+"</button></span></div>");
1123	$("#openDialogLayerBtns input:eq(0)").focus();
1124
1125	document.getElementById('openDialogLayerConfirmYesBtn').onclick = function(){
1126		choicedYes = true;
1127		$("#openDialogLayer").dialog("close");
1128		if(yesCallback) yesCallback();
1129	};
1130	document.getElementById('openDialogLayerConfirmNoBtn').onclick = function(){
1131		choicedYes = false;
1132		$("#openDialogLayer").dialog("close");
1133	};
1134}
1135
1136function openDialogConfirmtitle(title,msg,width,height,yesCallback,noCallback){
1137	var choicedYes = false;
1138
1139	document.getElementById('openDialogLayerMsg').innerHTML = msg;
1140	openDialog(title, "openDialogLayer", {"width":width,"height":height});
1141
1142	$("#openDialogLayer").dialog({
1143			close : function(){
1144				if(noCallback && !choicedYes){
1145					noCallback();
1146				}
1147			}
1148	});
1149
1150	$("#openDialogLayerBtns").remove();
1151	$("#openDialogLayer").append("<div id='openDialogLayerBtns' align='center' style='padding-top:15px'><span class='btn medium'><input type='button' value='예' id='openDialogLayerConfirmYesBtn' class='btn_resp size_b'/></span> <span class='btn medium'><input type='button' value='아니오' id='openDialogLayerConfirmNoBtn' class='btn_resp size_b color2'/></span></div>");
1152	$("#openDialogLayerBtns input:eq(0)").focus();
1153
1154	document.getElementById('openDialogLayerConfirmYesBtn').onclick = function(){
1155		choicedYes = true;
1156		$("#openDialogLayer").dialog("close");
1157		if(yesCallback) yesCallback();
1158	};
1159	document.getElementById('openDialogLayerConfirmNoBtn').onclick = function(){
1160		choicedYes = false;
1161		$("#openDialogLayer").dialog("close");
1162	};
1163}
1164
1165/**
1166 * 다양한 사용자 정의 대화상자를 띄웁니다.
1167 * @param {Object} options
1168 * @param {Element} options.text
1169 * @param {string} [options.title]
1170 * @param {Array.<{text: string, attributes?: Object, action?: Function, default?: boolean}|Element|string>} [options.buttons=[]]
1171 * @param {number} [options.width=400]
1172 * @param {number} [options.height]
1173 * @param {Function} [options.close]
1174 * @param {Function} [options.beforeclose]
1175 */
1176function openCustomDialog(options){
1177	if(!options || typeof options !== 'object') throw TypeError('"options" is required and must supplied as object');
1178	var _this = this;
1179
1180	/* default values */
1181	options.title = options.title || getAlert('et352');
1182	options.buttons = options.buttons || [];
1183	options.width = +options.width || 400;
1184
1185	/* check type of arguments */
1186	if(typeof options.text !== 'string') throw TypeError('"text" is required and must supplied as string');
1187	if(!isNumber(options.width)) throw TypeError('"width" must supplied as 
1187number');
1188	if(options.height && !isNumber(options.height)) throw TypeError('"height" must supplied as number');
1189	if(!Array.isArray(options.buttons)) throw TypeError('"buttons" must supplied as Array');
1190
1191	/* create new dialog layer */
1192	var dialogLayer = $(document.createElement('div')).hide();
1193	var buttonLayer = null;
1194	var defaultButton = null;
1195	var dialogOptions = {'width':options.width, 'height': options.height || 'auto','beforeClose':options.beforeclose || null,'close':function(e) {
1196		if(options.close && typeof options.close === 'function') options.close(e);
1197		_this.dispose();
1198	}};
1199	dialogLayer.append($('<div>').append(options.text));
1200
1201	/* check if buttons required? */
1202	if(options.buttons.length > 0) {
1203		buttonLayer = $(document.createElement('div'));
1204		buttonLayer.css('text-align', 'center');
1205		options.buttons.forEach(function(button_options) {
1206			if(typeof button_options === 'string') button_options = {'text': button_options};
1207			if(typeof button_options !== 'object') { _this.dispose(); throw TypeError('"buttons" must supplied as Array of Object or string') };
1208			var buttonWrapper = $(document.createElement('span')).addClass('btn').addClass('medium');
1209			var button = (((button_options instanceof Element || button_options instanceof $) && $(button_options)) || $(document.createElement('button')).append(button_options.text)).attr('type', 'button');
1210			button.on('click', function(e) {
1211				if(button_options.action && typeof button_options.action === 'function') button_options.action(e);
1212				if(!e.isDefaultPrevented()) dialogLayer.dialog('close');
1213			});
1214			buttonLayer.append(buttonWrapper.append(button)).append(' ');
1215			if(button_options.default) defaultButton = button;
1216		});
1217		dialogLayer.append(buttonLayer);
1218		defaultButton = defaultButton || dialogLayer.find('button:first-of-type');
1219	}
1220
1221	openDialog(options.title, dialogLayer, dialogOptions);
1222	if(defaultButton) defaultButton.focus();
1223
1224	_this.dispose = function() {
1225		dialogLayer.remove();
1226	}
1227}
1228
1229function openSearchSet(id, title){
1230	var html = "<div class=\"search-form-container\" style='padding:10px;'>";
1231	html += "<form id='setForm'>";
1232	html += $("#"+id).html();
1233	html += "</form>";
1234	html += "</div>";
1235	html += "<div style=\"padding-top:10px;\" class=\"center\">";
1236	html += "<span class=\"btn large black\">";
1237	html += "<button type=\"submit\" class=\"setBtn\" onclick='settingForm();'>저장하기</button>";
1238	html += "</span>";
1239	html += "</div>";
1240	$('#'+id).html(html);
1241	openDialog(title+" <span class='desc'>"+title+"을 합니다.</span>", id, {"width":"900","height":"300"});
1242}
1243
1244function JSONtoString(object,quote) {
1245    var results = [];
1246
1247    if(!quote) quote = '"';
1248
1249    for (var property in object) {
1250    	var value = object[property];
1251    	if (value){
1252    		if(typeof value == "string") value = quote+value+quote;
1253    		results.push(quote+property.toString()+quote + ':' + value);
1254    	}
1255    }
1256
1257    return '{' + results.join(', ') + '}';
1258}
1259
1260/**
1261 * 새창으로 팝업을 띄웁니다
1262 * popup('zoom.php?seq=7',750,550)
1263 */
1264function popup(src,width,height,popupId) {
1265	var scrollbars = "1";
1266	var resizable = "no";
1267	if (typeof(arguments[3])!="undefined") scrollbars = arguments[3];
1268	if (arguments[4]) resizable = "yes";
1269	if (typeof popupId == 'undefinedd') popupId = '';
1270	window.open(src,popupId,'width='+width+',height='+height+',scrollbars='+scrollbars+',toolbar=no,status=no,resizable='+resizable+',menubar=no');
1271}
1272
1273
1274function sprintf () {
1275	// Return a formatted string
1276	//
1277	// version: 1103.1210
1278	// discuss at: http://phpjs.org/functions/sprintf    // +   original by: Ash Searle (http://hexmen.com/blog/)
1279	// + namespaced by: Michael White (http://getsprink.com)
1280	// +    tweaked by: Jack
1281	// +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
1282	// +      input by: Paulo Freitas    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
1283	// +      input by: Brett Zamir (http://brett-zamir.me)
1284	// +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
1285	// *     example 1: sprintf("%01.2f", 123.1);
1286	// *     returns 1: 123.10    // *     example 2: sprintf("[%10s]", 'monkey');
1287	// *     returns 2: '[    monkey]'
1288	// *     example 3: sprintf("[%'#10s]", 'monkey');
1289	// *     returns 3: '[####monkey]'
1290	var regex = /%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuidfegEG])/g;
1291	var a = arguments,
1292		i = 0,
1293		format = a[i++];
1294
1295	// pad()
1296	var pad = function (str, len, chr, leftJustify) {
1297		if (!chr) {
1298			chr = ' ';
1299		}
1300		var padding = (str.length >= len) ? '' : Array(1 + len - str.length >>> 0).join(chr);
1301		return leftJustify ? str + padding : padding + str;
1302	};
1303
1304	// justify()
1305	var justify = function (value, prefix, leftJustify, minWidth, zeroPad, customPadChar) {
1306		var diff = minWidth - value.length;
1307		if (diff > 0) {
1308			if (leftJustify || !zeroPad) {
1309				value = pad(value, minWidth, customPadChar, leftJustify);
1310			} else {
1311				value = value.slice(0, prefix.length) + pad('', diff, '0', true) + value.slice(prefix.length);
1312			}
1313		}
1314		return value;
1315	};
1316	// formatBaseX()
1317	var formatBaseX = function (value, base, prefix, leftJustify, minWidth, precision, zeroPad) {
1318		// Note: casts negative numbers to positive ones
1319		var number = value >>> 0;        prefix = prefix && number && {
1320			'2': '0b',
1321			'8': '0',
1322			'16': '0x'
1323		}[base] || '';        value = prefix + pad(number.toString(base), precision || 0, '0', false);
1324		return justify(value, prefix, leftJustify, minWidth, zeroPad);
1325	};
1326
1327	// formatString()
1328	var formatString = function (value, leftJustify, minWidth, precision, zeroPad, customPadChar) {
1329		if (precision != null) {
1330			value = value.slice(0, precision);
1331		}
1332		return justify(value, '', leftJustify, minWidth, zeroPad, customPadChar);
1333	};
1334
1335	// doFormat()
1336	var doFormat = function (substring, valueIndex, flags, minWidth, _, precision, type) {
1337		var number;
1338		var prefix;
1339		var method;
1340		var textTransform;
1341		var value;
1342		 if (substring == '%%') { return '%'; }
1343
1344		// parse flags
1345		var leftJustify = false,
1346			positivePrefix = '',
1347			zeroPad = false,
1348			prefixBaseX = false,
1349			customPadChar = ' ';
1350		var flagsl = flags.length;
1351		for (var j = 0; flags && j < flagsl; j++) {
1352			switch (flags.charAt(j)) {
1353				case ' ':
1354					positivePrefix = ' ';
1355					break;
1356				case '+':
1357					positivePrefix = '+';
1358					break;
1359				case '-':
1360					leftJustify = true;
1361					break;
1362				case "'":
1363					customPadChar = flags.charAt(j + 1);
1364					break;
1365				case '0':
1366					zeroPad = true;
1367					break;
1368				case '#':
1369					prefixBaseX = true;
1370					break;
1371			}
1372		}
1373
1374		// parameters may be null, undefined, empty-string or real valued
1375		// we want to ignore null, undefined and empty-string values
1376		if (!minWidth) {
1377			minWidth = 0;
1378		} else if (minWidth == '*') {
1379			minWidth = +a[i++];
1380		} else if (minWidth.charAt(0) == '*') {
1381			minWidth = +a[minWidth.slice(1, -1)];
1382		} else {
1383			minWidth = +minWidth;
1384		}
1385		// Note: undocumented perl feature:
1386		if (minWidth < 0) {
1387			minWidth = -minWidth;
1388			leftJustify = true;
1389		}
1390
1391		if (!isFinite(minWidth)) {
1392			throw new Error('sprintf: (minimum-)width must be finite');
1393		}
1394		if (!precision) {
1395			precision = 'fFeE'.indexOf(type) > -1 ? 6 : (type == 'd') ? 0 : undefined;
1396		} else if (precision == '*') {
1397			precision = +a[i++];
1398		} else if (precision.charAt(0) == '*') {
1399			precision = +a[precision.slice(1, -1)];
1400		} else {
1401			precision = +precision;
1402		}
1403		// grab value using valueIndex if required?
1404		value = valueIndex ? a[valueIndex.slice(0, -1)] : a[i++];
1405
1406		switch (type) {
1407			case 's':
1408				return formatString(String(value), leftJustify, minWidth, precision, zeroPad, customPadChar);
1409			case 'c':
1410				return formatString(String.fromCharCode(+value), leftJustify, minWidth, precision, zeroPad);
1411			case 'b':
1412				return formatBaseX(value, 2, prefixBaseX, leftJustify, minWidth, precision, zeroPad);
1413			case 'o':
1414				return formatBaseX(value, 8, prefixBaseX, leftJustify, minWidth, precision, zeroPad);
1415			case 'x':
1416				return formatBaseX(value, 16, prefixBaseX, leftJustify, minWidth, precision, zeroPad);
1417			case 'X':
1418				return formatBaseX(value, 16, prefixBaseX, leftJustify, minWidth, precision, zeroPad).toUpperCase();
1419			case 'u':
1420				return formatBaseX(value, 10, prefixBaseX, leftJustify, minWidth, precision, zeroPad);
1421			case 'i':
1422			case 'd':
1423				number = (+value) | 0;
1424				prefix = number < 0 ? '-' : positivePrefix;
1425				value = prefix + pad(String(Math.abs(number)), precision, '0', false);
1426				return justify(value, prefix, leftJustify, minWidth, zeroPad);
1427			case 'e':
1428			case 'E':
1429			case 'f':
1430			case 'F':
1431			case 'g':
1432			case 'G':
1433				number = +value;
1434				prefix = number < 0 ? '-' : positivePrefix;
1435				method = ['toExponential', 'toFixed', 'toPrecision']['efg'.indexOf(type.toLowerCase())];
1436				textTransform = ['toString', 'toUpperCase']['eEfFgG'.indexOf(type) % 2];
1437				value = prefix + Math.abs(number)[method](precision);
1438				return justify(value, prefix, leftJustify, minWidth, zeroPad)[textTransform]();
1439			default:
1440				return substring;
1441		}
1442	};
1443
1444    return format.replace(regex, doFormat);
1445}
1446
1447
1448
1449
1450/**
1451 * 현재 시각을 Time 형식으로 리턴
1452 */
1453function getCurrentTime(date) {
1454	return toTimeString(new Date(date));
1455}
1456
1457/**
1458 * 자바스크립트 Date 객체를 Time 스트링으로 변환
1459 * parameter date: JavaScript Date Object
1460 */
1461function toTimeString(date) {
1462	var year  = date.getFullYear();
1463	var month = date.getMonth() + 1; // 1월=0,12월=11이므로 1 더함
1464	var day   = date.getDate();
1465
1466	if (("" + month).length == 1) {month = "0" + month;}
1467	if (("" + day).length   == 1) {day   = "0" + day;}
1468
1469	return ("" + year + month + day)
1470}
1471/**
1472 * 현재 年을 YYYY형식으로 리턴
1473 */
1474function getYear(date) {
1475	return getCurrentTime(date).substr(0,4);
1476}
1477
1478/**
1479 * 현재 月을 MM형식으로 리턴
1480 */
1481function getMonth(date) {
1482	return getCurrentTime(date).substr(4,2);
1483}
1484
1485/**
1486 * 현재 日을 DD형식으로 리턴
1487 */
1488function getDay(date) {
1489	return getCurrentTime(date).substr(6,2);
1490}
1491//
1492function getDate(day) {
1493	var d = new Date();
1494	var dt = d - day*24*60*60*1000;
1495	return getYear(dt) + '-' + getMonth(dt) + '-' + getDay(dt);
1496}
1497/**
1498 * 특정일 기준 0day 이전 날짜 계산
1499*/
1500function getTheDate(default_date, day) {
1501	if(default_date == 'today'){
1502		var d = new Date();
1503	}else{
1504		var d = new Date(default_date);
1505	}
1506	var dt = d - day*24*60*60*1000;
1507	return getYear(dt) + '-' + getMonth(dt) + '-' + getDay(dt);
1508}
1509
1510/**
1511 * 콤마 붙이기 함수
1512 * @param value int
1513 */
1514function setComma(nStr) {
1515	nStr += '';
1516	x = nStr.split('.');
1517	x1 = x[0];
1518	x2 = x.length > 1 ? '.' + x[1] : '';
1519	var rgx = /(\d+)(\d{3})/;
1520	while (rgx.test(x1)) {
1521		x1 = x1.replace(rgx, '$1' + ',' + '$2');
1522	}
1523	return x1 + x2;
1524}
1525
1526
1527/**
1528 * 신규생성 다이얼로그 창을 띄운다.
1529 * <pre>
1530 * 1. createElementContainer 함수를 이용하여 매번 div 태그를 입력하지 않고 다이얼로그 생성시 자동으로 생성한다.
1531 * 2. refreshTable 함수를 이용하여 다이얼로그 내용 부분을 불러온다.
1532 * </pre>
1533 * @param string url 폼화면 주소
1534 * @param int width 가로 사이즈
1535 * @param int height 세로 사이즈
1536 * @param string title 제목
1537 * @param string btn_yn 'false'이면 닫기버튼만 나타낸다.
1538 */
1539function addFormDialog(url, width, height, title, btn_yn, class_name) {
1540	newcreateElementContainer(title);
1541	newrefreshTable(url);
1542
1543	if (btn_yn != 'false') {
1544		var buttons = {
1545			'닫기': function() {
1546				$(this).dialog('close');
1547			},
1548			'저장하기': function() {
1549				$('#form1').submit();
1550			}
1551		}
1552	}
1553	else if (btn_yn == 'false') {
1554		var buttons =  [{
1555			text:"닫기",
1556			class : class_name,
1557			click: function() {
1558				$(this).dialog('close');
1559			}
1560		}]
1561	}
1562	else if (btn_yn == 'close') {
1563		var buttons =  {
1564			'닫기': function() {
1565				$(this).dialog('close');
1566			}
1567		}
1568	}
1569	
1570	if (btn_yn == 'select') {
1571		var buttons =  [{
1572			text:"저장",
1573			class :'resp_btn active size_XL',
1574			click: function() {
1575				$('#npayFrm').submit();
1576				$(this).dialog('close');
1577			}},
1578			{
1579			text:"닫기",
1580			class : 'resp_btn v3 size_XL',
1581			click: function() {
1582				$(this).dialog('close');
1583			}
1584		}]		
1585	}
1586
1587	// background layer의 z-index는 9999인데 본창의 z-index가 9999보다 낮은 경우가 발생해서 추가함.
1588	var dialog_zIndex	= $('.ui-dialog').last().css('z-index');
1589	if	(dialog_zIndex < 9999)	dialog_zIndex	= 10001;
1590	if( height>0 ) {
1591		$('#dlg').dialog({
1592			bgiframe: true,
1593			autoOpen: false,
1594			width: width,
1595			height: height,
1596			resizable: false,
1597			draggable: false,
1598			zIndex: dialog_zIndex,
1599			modal: true,
1600			overlay: {
1601				backgroundColor: '#000000',
1602				opacity: 0.8
1603			},
1604			buttons: buttons,
1605			open: function() {
1606					$("#ui-datepicker-div").css("z-index",
1607					$(this).parents(".ui-dialog").css("z-index")+1);
1608			}
1609		}).dialog('open');
1610	}else{
1611		$('#dlg').dialog({
1612			bgiframe: true,
1613			autoOpen: false,
1614			width: width,
1615			resizable: false,
1616			draggable: false,
1617			zIndex: dialog_zIndex,
1618			modal: true,
1619			overlay: {
1620				backgroundColor: '#000000',
1621				opacity: 0.8
1622			},
1623			buttons: buttons,
1624			open: function() {
1625					$("#ui-datepicker-div").css("z-index",
1626					$(this).parents(".ui-dialog").css("z-index")+1);
1627			}
1628		}).dialog('open');
1629	}
1630	return false;
1631}
1632
1633function newcreateElementContainer(title) {
1634	var dlg_title = title ? title : '등록 폼';
1635	var el = '<div id="dlg" title="' + dlg_title + '"   ><div id="dlg_content" ></div></div>';
1636	$('#dlg').remove();
1637	$(el).appendTo('body');
1638}
1639
1640function newrefreshTable(url) {
1641	$.get(url, {}, function(data, textStatus) {
1642		$('#dlg_content').html(data);
1643	});
1644}
1645
1646
1647
1648function goTwitter(msg,url) {
1649	var href = "http://twitter.com/intent/tweet?text=" + encodeURIComponent(msg) + " " + encodeURIComponent(url);
1650	var a = window.open(href, 'twitter', '');
1651	if ( a ) {
1652		a.focus();
1653	}
1654}
1655function goMe2Day(msg,url,tag) {
1656	var href = "http://me2day.net/posts/new?new_post[body]=" + encodeURIComponent(msg) + " " + encodeURIComponent(url) + "&new_post[tags]=" + encodeURIComponent(tag);
1657	var a = window.open(href, 'me2Day', '');
1658	if ( a ) {
1659		a.focus();
1660	}
1661}
1662function goFaceBook(msg,url) {
1663	var href = "https://www.facebook.com/sharer/sharer.php?u=" + url + "&t=" + encodeURIComponent(msg);
1664	var a = window.open(href, 'facebook', '');
1665	if ( a ) {
1666		a.focus();
1667	}
1668}
1669function goCyWorld(no) {
1670	var href = "http://api.cyworld.com/openscrap/post/v1/?xu=http://ticketmonster.co.kr/html/cyworldConnectToXml.php?no=" + no +"&sid=suGPZc14uNs4a4oaJbVPWkDSZCwgY8Xe";
1671	var a = window.open(href, 'cyworldpost', 'width=450,height=410');
1672	if ( a ) {
1673		a.focus();
1674	}
1675}
1676function goYozmDaum(link,prefix,parameter) {
1677	var href = "http://yozm.daum.net/api/popup/post?sourceid=&link=" + encodeURIComponent(link) + "&prefix=" + encodeURIComponent(prefix) + "&parameter=" + encodeURIComponent(parameter);
1678	var a = window.open(href, 'yozmSend', 'width=466, height=356');
1679	if ( a ) {
1680		a.focus();
1681	}
1682}
1683
1684function snsWin(sns, enc_tit, enc_sbj, enc_tag, enc_url, isMobile,imgurl,imgwidth,imgheight)
1685{
1686	//짧은주소체크
1687	var sourturl = enc_url;
1688	$.ajax({url: '/common/get_shortURL?url='+enc_url,global:false,async: false,dataType: 'json',success: function(data) {if(data) sourturl = data;}});
1689
1690	var snsset = new Array();
1691	if(isMobile){
1692		snsset['tw']	= 'http://twitter.com/intent/tweet?text=' + enc_sbj + '+++' + sourturl;
1693		snsset['me']	= 'http://me2day.net/plugins/mobile_post/new?new_post[body]=' + enc_sbj + '+++["'+enc_tit+'":' + sourturl + '+]&new_post[tags]='+enc_tag;
1694		snsset['my']	= 'https://m.mypeople.daum.net/mypeople/mweb/share.do?s
1694ource_id=' + enc_tit + '&link=' + sourturl + '&prefix=' + enc_sbj;
1695	}else{
1696		snsset['tw']	= 'http://twitter.com/intent/tweet?text=' + enc_sbj + '+++' + sourturl;
1697		snsset['me']	= 'http://me2day.net/posts/new?new_post[body]=' + enc_sbj + '+++["'+enc_tit+'":' + sourturl + '+]&new_post[tags]='+enc_tag+'&redirect_url='+sourturl;
1698		snsset['my']	= 'https://mypeople.daum.net/mypeople/web/share.do?source_id=' + enc_tit + '&link=' + sourturl + '&prefix=' + enc_sbj;
1699	}
1700
1701	snsset['ka'] 		= 'kakaolink://sendurl?msg=' + enc_sbj + '&url=' + sourturl + '&appid=' + document.domain + '&appver=4.0&type=link&appname=' + enc_tit + '&apiver=2.0';
1702	snsset['kaapi']		= "api";
1703	snsset['kakaostory']= 'storylink://posting?post=' + enc_sbj + '&appid=' + document.domain + '&appver=4.0&apiver=1.0&appname=' + enc_tit + '&urlinfo=' + sourturl + '';
1704	snsset['go']		= 'https://plus.google.com/share?url=' + sourturl;
1705	snsset['fa']		= 'https://www.facebook.com/sharer/sharer.php?u=' + sourturl + '&t=' + enc_sbj;
1706	snsset['yo']		= "http://yozm.daum.net/api/popup/prePost?link=" + sourturl + "&prefix=" + enc_sbj + "&parameter=" + sourturl;
1707
1708	snsset['pi']		= '';//이미지전용
1709	snsset['na']		= 'http://api.nateon.nate.com/web/note/SendNote.do?msg='+enc_sbj+ '&lurl='+sourturl;
1710	snsset['cy']		= 'http://csp.cyworld.com/bi/bi_recommend_pop.php?title='+enc_tit+ '&url='+sourturl+ '&thumbnail='+imgurl+ '&summary='+enc_sbj;
1711	snsset['line']		= 'https://line.me/R/share/?text=' + encodeURI(enc_sbj) + '%0D%0A' + encodeURIComponent(sourturl);
1712
1713	if( snsset[sns] ) {
1714		if(sns == 'ka'){//app link copy
1715			executeURLLink(enc_sbj, enc_tit, sourturl,isMobile);
1716		}else if(sns == 'kaapi'){
1717			sendKakaotalk(enc_sbj, enc_tit, enc_url,imgurl,imgwidth,imgheight);
1718		}else if(sns == 'kakaostory'){
1719			sendKakaostorynew(enc_sbj, enc_tit, sourturl,isMobile,imgurl);
1720		}else{
1721			var a = window.open(snsset[sns], "SnsWinUp"+sns);
1722			if ( a ) {
1723				a.focus();
1724			}
1725		}
1726	}
1727}
1728
1729//카카오스토리연동
1730function sendKakaostorynew(enc_sbj, enc_tit, enc_url,isMobile,imgurl)
1731{
1732	var appid = 'http://' + document.domain;
1733	kakaostorynew.link("story").send({
1734        post : enc_url,
1735        appid : appid,
1736        appver : "1.0",
1737        appname : enc_tit,
1738        urlinfo : JSON.stringify({title:enc_sbj, imageurl:[imgurl], type:"article"})
1739    });
1740}
1741
1742
1743
1744//카카오톡 연결
1745function sendKakaotalk(enc_sbj, enc_tit, enc_url,imgurl,imgwidth,imgheight)
1746{
1747	if(imgurl && imgwidth >= 81 && imgheight >= 81) {
1748	Kakao.Link.createTalkLinkButton({
1749	container: '.kakao-link-btn',
1750	label: enc_tit,
1751	image: {
1752	src: imgurl,
1753	width: imgwidth,
1754	height: imgheight
1755	},
1756	webButton: {
1757	text: enc_sbj,
1758	url: enc_url
1759	}
1760		});
1761	}else{
1762		Kakao.Link.createTalkLinkButton({
1763		container: '.kakao-link-btn',
1764		label: enc_tit,
1765		webButton: {
1766		text: enc_sbj,
1767		url: enc_url
1768		}
1769		});
1770	}
1771	// 앱 설정의 웹 플랫폼에 등록한 도메인의 URL이어야 합니다. 개발자 사이트에 등록한 웹사이트 중 첫번째 URL
1772}
1773
1774function executeURLLink(enc_sbj, enc_tit, enc_url,isMobile,imgurl)
1775{
1776	if ( !isMobile ) {
1777		//PC에서 접속한 경우에는 작동하지 않습니다.\n\n카카오톡이 설치된 아이폰/안드로이드폰등으로 접속하는 경우에만 사용 가능합니다.
1778		alert( getAlert('et070') );
1779		return;
1780	}
1781    /*
1782    msg, url, appid, appname은 실제 서비스에서 사용하는 정보로 업데이트되어야 합니다.
1783    */
1784	var appid = location.protocol+'://' + document.domain;
1785    kakao.link("talk").send({
1786        msg : enc_sbj,
1787        url : enc_url,
1788        appid : appid,
1789        appver : "2.0",
1790        appname : enc_tit,
1791        type : "link"
1792    });
1793
1794}
1795
1796//데모경고창
1797function servicedemoalert(e) {
1798	if( e.name == "use_f"  ||e.name == "use_t" ) {
1799		$("input[name="+e.name+"]").attr("checked",'checked');
1800	}else if( e.type == "checkbox" ) {
1801		$("input[name="+e.name+"]").attr("checked",'');
1802		$("input[name="+e.name+"]").removeAttr("checked");
1803	}else if( e.type == "file" ) {
1804		$("input[name="+e.name+"]").attr("disabled","disabled");
1805	}
1806
1807	$.ajax({
1808		type: "get",
1809		url: "/admin/main/main_demo",
1810		success: function(result){
1811			$("#main_demo").html(result);
1812			openDialog("제한 기능 안내", "main_demo", {"width":"700","height":"700","show" : "fade","hide" : "fade"});
1813		}
1814	});
1815
1816	//alert( "type:" + e.type + "/name:" + e.name );
1817	//alert( '체험 사이트에서는 해당 기능을 제공하지 않습니다.' );
1818	return;
1819}
1820
1821
1822//무료몰업그레이드
1823function serviceUpgrade(){
1824	window.open('https://firstmall.kr/ec_hosting/addservice/upgrade.php','','');
1825}
1826//무료몰 > 게시판추가
1827function serviceBoardAdd(){
1828	$.get('board_payment', function(data) {
1829		var target = $(document.createElement('div')).html(data);
1830		openDialog("게시판 추가 신청", target, {
1831			width: 800,
1832			height: 650,
1833		}, function() {
1834			$(target).dialog('destroy').remove();
1835		});
1836		$(document.forms['gabiaFrm']).submit();
1837	});
1838}
1839
1840function htmlspecialchars(str) {
1841	if (typeof(str) == "string") {
1842		str = str.replace(/&/g, "&amp;"); /* must do &amp; first */
1843		str = str.replace(/"/g, "&quot;");
1844		str = str.replace(/'/g, "&#039;");
1845		str = str.replace(/</g, "&lt;");
1846		str = str.replace(/>/g, "&gt;");
1847	}
1848	return str;
1849}
1850
1851//flash(파일주소, 가로, 세로, 배경색, 윈도우모드, 변수, 경로)
1852function flash(url,w,h,bg,win,vars,base,target){
1853	var s=
1854	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' align='middle'>"+
1855	"<param name='allowScriptAccess' value='always' />"+
1856	"<param name='movie' value='"+url+"' />"+
1857	"<param name='wmode' value='transparent' />"+
1858	"<param name='menu' value='false' />"+
1859	"<param name='quality' value='high' />"+
1860	"<param name='FlashVars' value='"+vars+"' />"+
1861	"<param name='bgcolor' value='"+bg+"' />"+
1862	"<param name='base' value='"+base+"' />"+
1863	"<embed src='"+url+"' base='"+base+"' wmode='transparent' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' align='middle' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
1864	"</object>";
1865
1866	$('.'+target).html(s);
1867}
1868
1869function isNumber(s) {
1870	s += ''; // 문자열로 변환
1871	s = s.replace(/^\s*|\s*$/g, ''); // 좌우 공백 제거
1872	if (s == '' || isNaN(s)) return false;
1873	return true;
1874}
1875
1876function uniqid (prefix, more_entropy) {
1877	  // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
1878	  // +    revised by: Kankrelune (http://www.webfaktory.info/)
1879	  // %        note 1: Uses an internal counter (in php_js global) to avoid collision
1880	  // *     example 1: uniqid();
1881	  // *     returns 1: 'a30285b160c14'
1882	  // *     example 2: uniqid('foo');
1883	  // *     returns 2: 'fooa30285b1cd361'
1884	  // *     example 3: uniqid('bar', true);
1885	  // *     returns 3: 'bara20285b23dfd1.31879087'
1886	  if (typeof prefix == 'undefined') {
1887	    prefix = "";
1888	  }
1889
1890	  var retId;
1891	  var formatSeed = function (seed, reqWidth) {
1892	    seed = parseInt(seed, 10).toString(16); // to hex str
1893	    if (reqWidth < seed.length) { // so long we split
1894	      return seed.slice(seed.length - reqWidth);
1895	    }
1896	    if (reqWidth > seed.length) { // so short we pad
1897	      return Array(1 + (reqWidth - seed.length)).join('0') + seed;
1898	    }
1899	    return seed;
1900	  };
1901
1902	  // BEGIN REDUNDANT
1903	  if (!this.php_js) {
1904	    this.php_js = {};
1905	  }
1906	  // END REDUNDANT
1907	  if (!this.php_js.uniqidSeed) { // init seed with big random int
1908	    this.php_js.uniqidSeed = Math.floor(Math.random() * 0x75bcd15);
1909	  }
1910	  this.php_js.uniqidSeed++;
1911
1912	  retId = prefix; // start with prefix, add current milliseconds hex string
1913	  retId += formatSeed(parseInt(new Date().getTime() / 1000, 10), 8);
1914	  retId += formatSeed(this.php_js.uniqidSeed, 5); // add seed hex string
1915	  if (more_entropy) {
1916	    // for more entropy we add a float lower to 10
1917	    retId += (Math.random() * 10).toFixed(8).toString();
1918	  }
1919
1920	  return retId;
1921}
1922
1923
1924//정식 오픈그라피>바로구매시 적용
1925function getfbopengraph(gdseq, type, urldomain, id)
1926{
1927
1928	 if (document.location.protocol == "https:") {
1929		var url = 'https://'+urldomain+'/sns_process/fbopengraph';
1930	 }else{
1931	var url = 'http://'+urldomain+'/sns_process/fbopengraph';
1932	 }
1933	$.getJSON(url + "?no="+gdseq+"&id="+id+"&type="+type+"&jsoncallback=?");
1934}
1935
1936//페이스북>me/feed 글남기기
1937function getfbmefeed(boardseq, type, urldomain, boardid)
1938{
1939	 if (document.location.protocol == "https:") {
1940		var url = 'https://'+urldomain+'/sns_process/fbmefeed';
1941	 }else{
1942		var url = 'http://'+urldomain+'/sns_process/fbmefeed';
1943	 }
1944	$.getJSON(url + "?no="+boardseq+"&id="+boardid+"&type="+type+"&jsoncallback=?");
1945}
1946
1947
1948function chkByte(str){
1949	var cnt = 0;
1950	for(i=0;i<str.length;i++) {
1951		cnt += str.charCodeAt(i) > 128 ? 2 : 1;
1952		if(str.charCodeAt(i)==10) cnt++;
1953	}
1954	return cnt;
1955}
1956
1957//단독이벤트 남은 시간
1958function showClockTime(numberType, year, month, day, hour, min, second, dayDiv, hourDiv, minDiv, secondDiv, goods_seq, classType){
1959	var close_date = new Date(year, month-1, day, hour, min, second);
1960	var close_timestamp = Math.floor(close_date.getTime()/1000);
1961	var now_timestamp = Math.floor((new Date()).getTime()/1000);
1962	var remind_timestamp = close_timestamp - now_timestamp;
1963
1964	if(remind_timestamp<0) {
1965		return;
1966	}
1967
1968	var remind_days = Math.floor(remind_timestamp/86400);
1969	var remind_hours = Math.floor((remind_timestamp - (86400 * remind_days))/3600);
1970	var remind_minutes = Math.floor((remind_timestamp - ((86400 * remind_days) + (3600 * remind_hours))) / 60);
1971	var remind_seconds = remind_timestamp%60;
1972	var day="";
1973	var hour="", min="", second="";
1974
1975	if(numberType == "img"){
1976		if (remind_days > 0){
1977			day = "";
1978			for(var i=0;i<remind_days.toString().length;i++){
1979				day += "<img src='/data/icon/goods/social_no"+remind_days.toString().substring(i,i+1)+".png'>";
1980			}
1981			$('.'+dayDiv).html(day);
1982		}else{
1983			day = "<img src='/data/icon/goods/social_no0.png'>";
1984			$('.'+dayDiv).html(day);
1985		}
1986
1987		// 시간처리
1988		if (remind_hours > -1){
1989			if (remind_hours < 10){
1990				hour = "<img src='/data/icon/goods/social_no0.png'><img src='/data/icon/goods/social_no"+Math.floor(remind_hours % 10)+".png'>";
1991			} else {
1992				hour = "<img src='/data/icon/goods/social_no"+Math.floor(remind_hours / 10)+".png'>";
1993				hour += "<img src='/data/icon/goods/social_no"+Math.floor(remind_hours % 10) +".png'>";
1994			}
1995			$('.'+hourDiv).html(hour);
1996		}
1997
1998		// 분처리
1999		if (remind_minutes > -1){
2000			if (remind_minutes < 10){
2001				min = "<img src='/data/icon/goods/social_no0.png'><img src='/data/icon/goods/social_no"+Math.floor(remind_minutes % 10)+".png'>";
2002			} else {
2003				min = "<img src='/data/icon/goods/social_no"+Math.floor(remind_minutes / 10)+".png'>";
2004				min += "<img src='/data/icon/goods/social_no"+Math.floor(remind_minutes % 10)+".png'>";
2005			}
2006			$('.'+minDiv).html(min);
2007		}
2008
2009		// 초처리
2010		if (remind_seconds > -1){
2011			if (remind_seconds < 10){
2012				second = "<img src='/data/icon/goods/social_no0.png'><img src='/data/icon/goods/social_no"+Math.floor(remind_seconds % 10)+".png'>";
2013			} else {
2014				second = "<img src='/data/icon/goods/social_no"+Math.floor(remind_seconds / 10)+".png'>";
2015				second += "<img src='/data/icon/goods/social_no"+Math.floor(remind_seconds % 10)+".png'>";
2016			}
2017			$('.'+secondDiv).html(second);
2018		}
2019	}else{
2020		remind_hours = strRight("0"+remind_hours, 2);
2021		remind_minutes = strRight("0"+remind_minutes, 2);
2022		remind_seconds = strRight("0"+remind_seconds, 2);
2023		if(classType == 'class'){
2024			$('.'+dayDiv).html(remind_days);
2025			$('.'+hourDiv).html(remind_hours);
2026			$('.'+minDiv).html(remind_minutes);
2027			$('.'+secondDiv).html(remind_seconds);
2028		}else{
2029			$('#'+dayDiv).html(remind_days);
2030			$('#'+hourDiv).html(remind_hours);
2031			$('#'+minDiv).html(remind_minutes);
2032			$('#'+secondDiv).html(remind_seconds);
2033		}
2034	}
2035
2036	return remind_timestamp;
2037
2038}
2039
2040
2041function strRight(Str, Num){
2042	if(Num <= 0){
2043		return "";
2044	}else if(Num > String(Str).length){
2045		return Str;
2046	}else{
2047		var iLen = String(Str).length;
2048		return String(Str).substring(iLen, iLen-Num);
2049	}
2050}
2051
2052function strstr (haystack, needle, bool) {
2053  // From: http://phpjs.org/functions
2054  // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
2055  // +   bugfixed by: Onno Marsman
2056  // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
2057  // *     example 1: strstr('Kevin van Zonneveld', 'van');
2058  // *     returns 1: 'van Zonneveld'
2059  // *     example 2: strstr('Kevin van Zonneveld', 'van', true);
2060  // *     returns 2: 'Kevin '
2061  // *     example 3: strstr('[email protected]', '@');
2062  // *     returns 3: '@example.com'
2063  // *     example 4: strstr('[email protected]', '@', true);
2064  // *     returns 4: 'name'
2065  var pos = 0;
2066
2067  haystack += '';
2068  pos = haystack.indexOf(needle);
2069  if (pos == -1) {
2070    return false;
2071  } else {
2072    if (bool) {
2073      return haystack.substr(0, pos);
2074    } else {
2075      return haystack.slice(pos);
2076    }
2077  }
2078}
2079
2080function rgb2hex(rgb) {
2081    rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
2082    function hex(x) {
2083        return ("0" + parseInt(x).toString(16)).slice(-2);
2084    }
2085    return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
2086}
2087
2088// 배송사 배송조회 링크 추출
2089var delivery_url_list	= '';
2090function get_delivery_url_list(codecd, delivery_code, target, provider_seq){
2091	if	(typeof(provider_seq) == 'undefined') provider_seq = 1;
2092	$.getJSON("/common/get_delivery_url", {'provider_seq':provider_seq}, function(result){
2093		delivery_url_list	= result;
2094		open_search_delivery(codecd, delivery_code, target, provider_seq);
2095	});
2096}
2097
2098// 배송사 배송조회 링크 전송
2099var chk_search	= '';
2100function open_search_delivery(codecd, delivery_code, target, provider_seq){
2101	if	(typeof(provider_seq) == 'undefined') provider_seq = 1;
2102
2103	if	(!delivery_url_list){
2104		get_delivery_url_list(codecd, delivery_code, target, provider_seq);
2105	}else{
2106		var url	= delivery_url_list[codecd];
2107		if	(!url) {
2108			if(chk_search == 'Y'){
2109				//조회할수 없습니다.
2110				alert(getAlert('et071'));
2111				return;
2112			}
2113			chk_search = 'Y';
2114			get_delivery_url_list(codecd, delivery_code, target, provider_seq);
2115			url	= delivery_url_list[codecd];
2116		}else{
2117			if	(url && delivery_code){
2118				url	= url + delivery_code.replace(/[^0-9a-zA-Z]/g, '');
2119				if	(target){
2120					eval(target+'.location.href="'+url+'";');
2121				}else{
2122					window.open(url);
2123				}
2124			}else{
2125				alert(getAlert('et071'));
2126			}
2127		}
2128	}
2129}
2130
2131// 동적 폼 생성 및 Submit
2132var DomSaver	= function(fDivId, fMethod, fAction, fTarget){
2133	this.fDivId		= fDivId;
2134	this.fMethod	= fMethod;
2135	this.fAction	= fAction;
2136	this.fTarget	= fTarget;
2137	this.sTarget	= '';
2138	this.saveStatus	= 'null';
2139};
2140DomSaver.prototype.setTarget	= function(obj){
2141	this.sTarget	= obj;
2142	this.saveStatus	= 'ready';
2143};
2144DomSaver.prototype.sendValue	= function(val){
2145	if	(this.saveStatus == 'ready'){
2146
2147		// 해당 ID의 Div 객체 생성 및 초기화
2148		var oDiv		= document.getElementById(this.fDivId);
2149		oDiv.innerHTML	= '';
2150
2151		// form 생성
2152		var oForm		= document.createElement('form');
2153		oForm.method	= this.fMethod;
2154		oForm.action	= this.fAction;
2155		if	(this.fTarget)	oForm.target	= this.fTarget;
2156
2157		// input 생성
2158		var oInput		= '';
2159		for (var k in val){
2160			oInput			= '';
2161			oInput			= document.createElement('input');
2162			oInput.setAttribute('type', 'hidden');
2163			oInput.setAttribute('name', k);
2164			oInput.setAttribute('value', val[k]);
2165			oForm.appendChild(oInput);
2166		}
2167
2168		// form 추가 및 submit
2169		oDiv.appendChild(oForm);
2170		oForm.submit();
2171
2172		// this.saveStatus를 초기화
2173		this.saveStatus	= '';
2174	}
2175};
2176
2177
2178
2179//쿠폰받기
2180//반응형 분리되어있는 function 하나로 합침 2020-06-09
2181function coupondownlist(gl_goods_seq,gl_request_uri,gl_coupon_seq)
2182{
2183	title = getAlert('gv015');
2184	if( gl_operation_type == "light" || gl_mobile_mode == true) {
2185		$('div#couponDownloadDialogId').dialog('close');
2186		$('div#couponDownloadDialogBgId').dialog('close');
2187		$.ajax({
2188			'global' : false,
2189			'url':'../coupon/goods_coupon_list?no='+gl_goods_seq+'&return_url='+gl_request_uri+'&coupon='+gl_coupon_seq,
2190			'type' : 'get',
2191			'cache' : false,
2192			'success' : function(couponDownload){
2193				try{
2194					coupondownlist_view(couponDownload);					
2195				}catch(ex){}
2196				echo.init({
2197					offset: 100,
2198					throttle: 250,
2199					unload: false
2200				});
2201			}
2202		});
2203	}else{
2204		$('div#couponDownloadDialog').dialog('close');
2205		$.get('../coupon/goods_coupon_list?no='+gl_goods_seq+'&return_url='+gl_request_uri+'&coupon='+gl_coupon_seq, function(data) {
2206			$("div#couponDownloadDialog").html(data);
2207		});
2208		openDialog(title, "couponDownloadDialog", {"width":700});
2209	}
2210}
2211function coupondownlist_view(couponDownload) {
2212	
2213	if(gl_operation_type == "light" ) {
2214		$("body").append("<div id='couponDownloadDialogId' class='resp_layer_pop'></div>");
2215		var iframe = '<h4 class="title">'+title+'</h4>';
2216		iframe += '<div id="couponDownloadMobile" class="y_scroll_auto2">';
2217		iframe += '<div class="layer_pop_contents v5">';
2218		iframe += couponDownload;
2219		iframe += '</div>';
2220		iframe += '</div>';
2221		iframe += '<div class="layer_bottom_btn_area2"><button type="button" class="btn_resp size_c color5 Wmax" onclick="closeDialogCoupon()">닫기</button></div>';
2222		iframe += '<a href="javascript:void(0)" class="btn_pop_close" onclick="closeDialogCoupon()"></a>';
2223		$("#couponDownloadDialogId").html(iframe);
2224		showCenterLayer( '#couponDownloadDialogId' );
2225	} else {// 모바일모드
2226		var sheight = $('body').prop("scrollHeight");
2227		$("body").append("<div id='couponDownloadDialogBgId' style='position:absolute;top:0px;background:#000;width:100%;height:"+sheight+"px;z-index:10005;visibility:visible;filter:alpha(opacity=30); opacity:0.3; -moz-opacity:0.3;'></div>");
2228		$("body").append("<div id='couponDownloadDialogId' style='position:absolute;top:0px;background:#fff;width:100%;height:auto;z-index:10006'></div>");
2229		var iframe = '<div class="sub_division_title">'+title+'<div class="sub_division_arw sub_division_arw_x" onclick="javascript:closeDialogCoupon()"></div></div>';
2230		iframe += '<div style="height:auto:" id="couponDownloadMobile" >';
2231		iframe += couponDownload;
2232		iframe += '</div>';
2233		$("#couponDownloadDialogId").html(iframe);
2234		$(window).scrollTop(0);
2235	}
2236}
2237//쿠폰받기 - 반응형
2238// skin 에서 호출하기 때문에 coupondownlist_res 삭제는 하지 못함 .... 2020-06-09
2239function coupondownlist_res(gl_goods_seq,gl_request_uri)
2240{
2241	coupondownlist(gl_goods_seq,gl_request_uri);
2242}
2243
2244//코드보기
2245function codesalelist(gl_goods_seq,gl_request_uri)
2246{
2247	title = getAlert('gv061');
2248	if(typeof gl_mobile_mode!="undefined" && gl_mobile_mode){//모바일모드
2249
2250		$('div#couponDownloadDialogId').dialog('close');
2251		$('div#couponDownloadDialogBgId').dialog('close');
2252		var sheight = $('body').prop("scrollHeight");
2253		$.ajax({
2254			'global' : false,
2255			'url':'../promotion/goods_code_list?no='+gl_goods_seq+'&return_url='+gl_request_uri,
2256			'type' : 'get',
2257			'cache' : false,
2258			'success' : function(couponDownload){
2259				try{
2260					$("body").append("<div id='couponDownloadDialogBgId' style='position:absolute;top:0px;background:#000;width:100%;height:"+sheight+"px;z-index:10005;visibility:visible;filter:alpha(opacity=30); opacity:0.3; -moz-opacity:0.3;'></div>");
2261					$("body").append("<div id='couponDownloadDialogId' style='position:absolute;top:0px;background:#fff;width:100%;height:auto;z-index:10006'></div>");
2262					var iframe = '<div class="sub_division_title">'+title+'<div class="sub_division_arw sub_division_arw_x" onclick="javascript:closeDialogCoupon()"></div></div>';
2263					iframe += '<div style="height:auto:" id="couponDownloadMobile" >';
2264					iframe += couponDownload;
2265					iframe += '</div>';
2266					$("#couponDownloadDialogId").html(iframe);
2267					$(window).scrollTop(0);
2268				}catch(ex){}
2269				echo.init({
2270					offset: 100,
2271					throttle: 250,
2272					unload: false
2273				});
2274			}
2275		});
2276	}else{
2277		$('div#codeSaleDialog').dialog('close');
2278		$.get('../promotion/goods_code_list?no='+gl_goods_seq+'&return_url='+gl_request_uri, function(data) {
2279			$("div#couponDownloadDialog").html(data);
2280		});
2281		openDialog(title, "couponDownloadDialog", {"width":700});
2282	}
2283}
2284//코드보기 - 반응형
2285function codesalelist_res(gl_goods_seq,gl_request_uri)
2286{
2287	title = getAlert('gv061');
2288	$('div#couponDownloadDialogId').dialog('close');
2289	$('div#couponDownloadDialogBgId').dialog('close');
2290	var sheight = $('body').prop("scrollHeight");
2291	$.ajax({
2292		'global' : false,
2293		'url':'../promotion/goods_code_list?no='+gl_goods_seq+'&return_url='+gl_request_uri,
2294		'type' : 'get',
2295		'cache' : false,
2296		'success' : function(couponDownload){
2297			try{
2298				$("body").append("<div id='couponDownloadDialogId' class='resp_layer_pop'></div>");
2299				var iframe = '<h4 class="title">'+title+'</h4>';
2300				iframe += '<div id="couponDownloadMobile" class="y_scroll_auto2">';
2301				iframe += '<div class="layer_pop_contents v5">';
2302				iframe += couponDownload;
2303				iframe += '</div>';
2304				iframe += '</div>';
2305				iframe += '<div class="layer_bottom_btn_area2"><button type="button" class="btn_resp size_c color5 Wmax" onclick="closeDialogCoupon()">닫기</button></div>';
2306				iframe += '<a href="javascript:void(0)" class="btn_pop_close" onclick="closeDialogCoupon()"></a>';
2307				$("#couponDownloadDialogId").html(iframe);
2308				showCenterLayer( '#couponDownloadDialogId' );
2309			}catch(ex){}
2310			echo.init({
2311				offset: 100,
2312				throttle: 250,
2313				unload: false
2314			});
2315		}
2316	});
2317}
2318
2319function closeDialogCoupon()
2320{
2321	$("div#couponDownloadDialogId, .resp_layer_bg").remove();
2322	$("div#couponDownloadDialogBgId").remove();
2323	$('body').css( 'overflow', 'auto' );
2324}
2325
2326//비밀번호 변경
2327function popup_change_pass(){
2328	if (typeof gl_operation_type != 'undefined' && gl_operation_type == 'light') {
2329		showCenterLayer('#popupChangePassword');
2330	} else {
2331		openDialog(getAlert('mb188'), "popupChangePassword", {"width":500,"height":250, "noClose":true});
2332	}
2333}
2334
2335function close_popup_change(){
2336	if (typeof gl_operation_type != 'undefined' && gl_operation_type == 'light') {
2337		hideCenterLayer();
2338	} else {
2339		closeDialog('popupChangePassword');
2340	}
2341}
2342
2343function update_rate_checked(){
2344	//나중에 하기 클릭 시....비활성화
2345	if($("input[name='update_rate']").attr("checked")){
2346		$("input[name='old_password']").val('');
2347		$("input[name='new_password']").val('');
2348		$("input[name='re_new_password']").val('');
2349		$(".passwordField").attr("disabled",true);
2350	}else{
2351		$(".passwordField").attr("disabled",false);
2352	}
2353
2354}
2355
2356
2357function passwordAfterUpdate(){
2358	$("input[name='password_mode']").val('after');
2359	$('#passUpdateForm').submit();
2360}
2361
2362function sms_replace(str){
2363	str = str.replace("{userName}","홍길동");
2364	return str
2365}
2366
2367// 현재 페이지 인쇄
2368function thisPagePrint(){
2369	if	(window.matchMedia) {
2370		var mediaQueryList = window.matchMedia('print');
2371		mediaQueryList.addListener(function(mql) {
2372			if (mql.matches) {	$('.unprints').hide();	} else {	$('.unprints').show();	}
2373		});
2374	}
2375
2376	window.onbeforeprint	= function(){	$('.unprints').hide();	}
2377	window.onafterprint		= function(){	$('.unprints').show();	}
2378	window.print();
2379}
2380
2381function viewCrm(mseq){
2382	window.open("/admincrm/main/index?member_seq="+mseq);
2383}
2384
2385function changeCrm(mseq){
2386	top.location.href="/admincrm/main/user_detail?member_seq="+mseq;
2387
2388}
2389
2390// 파일찾기 메시지 박스처리
2391function chagne_file_msg(obj){
2392	var bobj = $(obj);
2393	var mobj = bobj.closest("span.filebox").parent().find(".filebox_msg");
2394	if( bobj.val() ){
2395		mobj.html('선택됨');
2396	}
2397}
2398
2399/* 멀티/글로벌 통화기준 관련 처리 */
2400function get_currency_price(price,mode,currency,currency_symbol,currency_symbol_position,pmode,replace_str){
2401
2402	if(typeof(pmode) == "undefined"){ pmode = ""; }
2403
2404	if(!currency) currency = "basic";
2405	if(currency == "basic"){
2406		currency					= gl_basic_currency;
2407		currency_symbol				= gl_basic_currency_symbol;
2408		currency_symbol_position	= gl_basic_currency_symbol_position;
2409	}else if(currency == "skin"){
2410		currency					= gl_skin_currency;
2411		currency_symbol				= gl_basic_currency_symbol;
2412		currency_symbol_position	= gl_basic_currency_symbol_position;
2413	}
2414
2415	price = get_cutting_price(price,currency,pmode);
2416
2417	if(currency == "KRW" || currency == "JPY"){
2418		if(mode != 1){
2419			price = comma(price);
2420		}else{
2421			price = price;
2422		}
2423	}else{
2424		if(price){
2425			price = ""+price+"";
2426			var tmp = price.split(".");
2427			if(tmp[1]){
2428				price = tmp[0] + rpad("."+tmp[1],3,"0");
2429			}else{
2430				price = price + ".00";
2431			}
2432			//price = eval(price);
2433		}else{
2434			price = 0;
2435		}
2436	}
2437	
2438	// 치환처리
2439	if(replace_str){
2440		price = replace_str.replace("_str_price_",price);
2441	}
2442
2443	if(mode == 2){
2444		if(currency_symbol_position == "before"){
2445			price = currency_symbol + "" + price;
2446		}else if(currency_symbol_position == "after"){
2447			price =  price + "" + currency_symbol;
2448		}
2449	}else if(mode == 3){
2450		if(currency_symbol_position == "before"){
2451			price = currency_symbol + price;
2452		}else if(currency_symbol_position == "after"){
2453			price =  price + currency_symbol;
2454		}
2455	}
2456
2457	return price;
2458}
2459
2460// currency			: 통화
2461// exchange_rate	: currency 기준 환율
2462// 비교통화 환율 적용 금액
2463function get_currency_exchange(price,currency,exchange_rate){
2464
2465	if(!currency){
2466		currency		= gl_basic_currency;
2467	}
2468	if(!exchange_rate){
2469		exchange_rate	= gl_currency_exchange;
2470	}
2471
2472	var basic_amout		= gl_amout_list[currency];	//기본통화의 환율 기준액
2473	var return_price	= 0;
2474	return_price		= price / basic_amout * exchange_rate;
2475	//return_price		= get_currency_price(return_price,'',gl_basic_currency);
2476
2477	return return_price;
2478}
2479
2480
2481// 멀티/글로벌 환율
2482function get_compare_currency(price){
2483
2484	var compare_price = {'KRW':1000,'CNY':500,'JPY':1200};
2485	var compare_data = {};
2486
2487	for(var key in compare_price){
2488		price				= price * compare_price[key];
2489		compare_data[key]	= get_currency_price(price,1,key);
2490	}
2491
2492	return compare_data;
2493}
2494
2495
2496// 기본 절사처리(기본통화 기준) @2016-05-25 pjm
2497function get_cutting_price(price,currency,mode){
2498
2499	if(!mode) mode = "backoffice";
2500
2501	if(!currency) currency = 'basic';
2502	if(currency == "basic"){
2503		currency = gl_basic_currency;
2504	}else if(currency == "skin"){
2505		currency = gl_skin_currency;
2506	}
2507
2508	var reg = /,/;
2509	if(price != "" && reg.test(price)){
2510		price = price.replaceAll(",","");
2511	}
2512
2513	//backoffice용 : 원화,엔화 소수점 버림/ 그외 소수점 3째자리 버림.
2514	if(mode == "backoffice"){
2515		if(currency == "KRW" || currency == "JPY"){
2516			price = Math.floor(price);
2517		}else{
2518			price = Math.floor(price * 100) / 100;
2519		}
2520	//front용 : 설정 > 상점관리 설정 기준.
2521	}else{
2522
2523		$.ajax({
2524			url		: '/common/get_front_cutting_price',
2525			async	: false,
2526			data	: {'price':price,'currency':currency},
2527			success	: function(res){
2528				price = res;
2529			}
2530		});
2531	}
2532
2533	return price;
2534}
2535
2536function get_front_cutting_price(price,currency){
2537
2538	return $.ajax({
2539		'url' : '/common/get_front_cutting_price',
2540		'data' : {'price':price,'currency':currency}
2541	});
2542
2543}
2544
2545// 희망 배송일 달력 팝업 :: 2016-07-22 lwh
2546function hop_calendar_pop(grp_seq, set_seq){
2547	var cal_lay	= $(".hopCalendarLayer");
2548	var hop_select_date = $("#hop_select_date").val();
2549	if(cal_lay.css('display') == 'block'){ cal_lay.hide(); return false; }
2550	$.ajax({
2551		'url' : '/goods/hop_calendar_pop',
2552		'data' : {'grp_seq':grp_seq,'set_seq':set_seq,'hop_select_date':hop_select_date},
2553		'success' : function(html){
2554			if(html){
2555				cal_lay.html(html);
2556				cal_lay.show();
2557			}else{
2558				alert('달력생성에 실패하였습니다.');
2559			}
2560		}
2561	});
2562}
2563
2564// 희망배송일 변경
2565function chg_hopdate(hop_date){
2566	$("#hop_select_date").val(hop_date);
2567	var myDate = new Date(hop_date);
2568	$(".hop_view_date").html('(' + (myDate.getMonth()+1) + '/' + myDate.getDate() + ')');
2569}
2570
2571// javascript 용 STR_PAD :: 2016-07-29 lwh
2572function pad_zero(str,max,type){
2573	str = str + "";
2574	if(str.length < max){
2575		if(type == 'right'){
2576			str = str+"0";
2577		}else{
2578			str = "0" + str;
2579		}
2580		pad_zero(str, max);
2581	}else{
2582		return str;
2583	}
2584
2585	return str.length < max ? pad_zero("0" + str, max) : str;
2586}
2587
2588
2589function rpad(originalstr, length, strToPad) {
2590
2591	while (originalstr.length < length) originalstr = originalstr + strToPad;
2592
2593	return originalstr;
2594}
2595
2596/*
2597	app/javascript/js/L10n_KOR.js
2598	arg1 = code
2599	arg2 = string, array
2600*/
2601if(!$.isFunction("getAlert")){
2602function getAlert(code,args){
2603	if	(!code) return;
2604	var ret = L10n[code];
2605	if	(!ret || ret == undefined) return '';
2606	ret = ret.replace(/%n/g, '\n');
2607	ret = ret.replace(/%b/g, '<br />');
2608
2609	if	(ret.indexOf('%s') >  -1) {
2610		str_len				= ret.match(/%s/g).length;
2611		arr_len				= $.isArray(args) ? args.length : 1;
2612
2613		if	(str_len > arr_len) {
2614			if	(!$.isArray(args)) {
2615				args_temp	= args;
2616				args		= new Array();
2617				args.push(args_temp);
2618				arr_len		= 1;
2619			}
2620			for	( i=0; i<str_len-arr_len; i++ ) args.push('');
2621		}
2622
2623		if	(args == undefined) args = '';
2624
2625		ret = $.isArray(args) ? $.vsprintf(ret, args) : sprintf(ret, args);
2626	}
2627
2628	if	(ret == undefined) ret = '';
2629
2630	return ret;
2631}
2632}
2633
2634function detailDescriptionLayerClose(idx){
2635	$('.detailDescriptionLayerCloseBtn.'+idx).parent().parent().parent().find('div.detailDescriptionLayer').toggle();
2636}
2637
2638/*
2639	언어별 validation 간단 입력 체크
2640*/
2641function validationCheck(area){
2642
2643	var required_full_text	= new Array();
2644	var result				= true;
2645	var exception			= ['order_cellphone[]','international_recipient_cellphone[]','recipient_cellphone[]','recipient_input_cellphone[]'];
2646	var selector			= $("input, select, textarea");
2647
2648	if	(area != 'all')
2649		selector			= $("input, select, textarea",$('.'+area));
2650
2651	required_full_text['KR'] = "%s 항목은 필수입니다.";
2652	required_full_text['US'] = "The %s field is required.";
2653	required_full_text['CN'] = "The %s field is required.";
2654	required_full_text['JP'] = "The %s field is required.";
2655
2656	selector.each(function(){
2657
2658		var required = $(this).attr("required");
2659
2660		if(typeof required != 'undefined'){
2661
2662			var title = $(this).attr("title");
2663			var value = $(this).val().trim();
2664
2665			if( $.inArray($(this).attr("name"), exception) > -1 )
2666				title = $(this).attr("valid");
2667
2668			if(typeof title == 'undefined'){ title = $(this).attr("name"); }
2669
2670			if	(required_full_text[gl_language])
2671				title = required_full_text[gl_language].replace("%s",title);
2672
2673			if(value == ''){
2674				var that = $(this);
2675				$(this).addClass("bg_yellow");
2676				openDialogAlert(title, 400, 150, function () {
2677					if (typeof gl_operation_type != 'undefined' && gl_operation_type == 'light') {
2678						// 반응형인경우 focus 로 스크롤까지 이동함 / 전용스킨은 추가이슈가 발생할 수 있어 유지함
2679						$(that).trigger('focus');
2680					} else {
2681						var obj_y = $(that).offset().top - $(window).scrollTop();
2682						var scroll_pos = 150 - obj_y;
2683						if (gl_set_mode == 'mobile') {
2684							scroll_pos = obj_y;
2685						}
2686						if (scroll_pos > 0) {
2687							$('html, body').animate({ scrollTop: scroll_pos });
2688						}
2689						$(that).focus();
2690					}
2691				});
2692				result = false;
2693				return false;
2694			}else{
2695				$(this).removeClass("bg_yellow");
2696			}
2697		}
2698
2699	});
2700
2701	return result;
2702
2703}
2704
2705function check_is_admin(){
2706	url			= location.href;
2707	url_arr		= url.split('/');
2708	ret			= false;
2709	if	($.inArray('admin',url_arr) > -1)
2710		ret		= true;
2711	return ret;
2712}
2713
2714function open_bigdata_quide(){
2715	html ='<div id="lay_bigdata_quide">';
2716	html +='<ul class="bullet_hyphen resp_message left mt0">';
2717	html +='<li>페이지별 해당 고객이 보고있는 상품의 기준은 아래와 같습니다.</li>';
2718	html +='<li>페이지별 기준 상품이 없을 경우 추천상품 영역을 보이지 않습니다</li>';
2719	html +='</ul>';
2720	html +='<table class="table_basic mt10">';
2721	html +='<colgroup><col width="30%"><col width="70%"></colgroup>';
2722	html +='<tr><th>페이지</th><th>해당 고객이 보고있는 상품</th></tr>';
2723	html +='<tr><th>검색 페이지</th><td class="center">검색결과 최상위 상품</td></tr>';
2724	html +='<tr><th>카테고리 페이지</th><td class="center">카테고리 페이지 최상위 상품</td></tr>';
2725	html +='<tr><th>브랜드 페이지</th><td class="center">브랜드 페이지 최상위 상품</td></tr>';
2726	html +='<tr><th>지역 페이지</th><td class="center">지역 페이지 최상위 상품</td></tr>';
2727	html +='<tr><th>상품상세 페이지</th><td class="center">상품상세 페이지 상품</td></tr>';
2728	html +='<tr><th>장바구니</th><td class="center">장바구니에 담긴 최상위 상품</td></tr>';
2729	html +='<tr><th>위시리스트</th><td class="center">위시리스트에 담긴 최상위 상품</td></tr>';
2730	html +='<tr><th>주문완료 페이지</th><td class="center">주문 완료된 최상위 상품</td></tr>';
2731	html +='</table>';
2732	html +='</div>';
2733	openDialogAlerttitle('<span class="fm_default_font">추천상품 노출 페이지별 해당 고객이 보고 있는 상품 기준</span>',html,'800','560',function(){});
2734}
2735
2736//장바구니 개선 스크립트
2737//가격정보 설정
2738function setPriceInfo(){
2739	var checkGoods = '';
2740			var checkCartSeqs = '';
2741
2742	$('input[name*="cart_option_seq"]').each(function(){
2743		if($(this).attr('checked') == 'checked'){
2744			var goodsSeq = $(this).attr('rel');
2745			checkGoods += goodsSeq + '||';
2746			checkCartSeqs += $(this).val() + '||';
2747		}
2748	});
2749
2750	var nation = $('input[name=nation]').val();
2751
2752	//장바구니 데이터 json 호출
2753	$.ajax({
2754		url : '/order/cart_price',
2755		dataType : 'json',
2756		data : {'goodsSeq' : checkGoods, 'nation' : nation, 'checkCartSeqs' : checkCartSeqs},
2757		type : 'post' ,
2758		async : false,
2759		success : function (data){
2760			setCartPriceInfo(data);
2761		},
2762		error : function (e){
2763			alert('error : ' + e);
2764		}
2765	});
2766}
2767
2768//전체 체크시 금액 계산 스크립트
2769function setPriceInfoCheck(){
2770	var trueChk = 0;
2771	$('input[name*="cart_option_seq"]').each(function(){
2772		if($(this).attr('checked') == 'checked'){
2773			trueChk++;
2774		}
2775	});
2776
2777	if(trueChk == 0){
2778		/**
2779		 * 20210408 : kjw
2780		 * 기존, gl_set_mode 만 mobile 검사를 진행하여 반응형 모바일 웹에서도 테두리의 색상을 변경하고 디자인이 깨지는 문제가 발생
2781		 * 따라서, gl_operation_type 을 같이 검사함에 따라, 전용스킨-모바일 버전에서만 아래 로직이 타도록 수정
2782		 */
2783		if(gl_set_mode == 'mobile' && gl_operation_type != 'light') { // 전용스킨-모바일
2784			$("form#cart_form input[name='cart_option_seq[]']").eq(0).attr('checked',true).closest("div").addClass("ez-checkbox-on");
2785			var cartOptionSeq = $("form#cart_form input[name='cart_option_seq[]']").eq(0).val();
2786
2787			/**
2788			 * 20210408 : kjw
2789			 * 배송 가능 상품 여부에 따른 테두리 색상 변경로직 추가
2790			 */
2791			var ship_possible_flag = $("input[name='ship_possible["+cartOptionSeq+"]']").val();
2792			if(ship_possible_flag == "N") {
2793				$("#cart_goods_"+cartOptionSeq).css('outline','2px solid #F15F5F');
2794			} else {
2795				$("#cart_goods_"+cartOptionSeq).css('outline','2px solid #769dff');
2796			}
2797		} else {
2798			$('input[name*="cart_option_seq"]').eq(0).attr('checked',true);
2799		}
2800		setPriceInfo();
2801		alert('주문이나 상품 삭제는 하나이상의 상품을 선택 하셔야 합니다.');	
2802	}else{
2803		setPriceInfo();
2804	}
2805}
2806
2807//가격 설정
2808function setCartPriceInfo(data){
2809
2810	// 체크 여부에 따라 네이버페이 버튼 노출 toggle
2811	if(data.npay_display == 'hide') {
2812		$('#nhn_btn').hide();
2813	} else {
2814		$('#nhn_btn').show();
2815	}
2816	
2817	//전체 상품금액 html create
2818	var goodsTotalViewPrice = get_currency_price(data.cart.total,3,gl_skin_currency,gl_basic_currency_symbol,gl_basic_currency_symbol_position,'');
2819	$('#totalGoodsPrice').html(goodsTotalViewPrice);
2820
2821	//전체 배송금액 html create
2822	var shippingTotalViewPrice = get_currency_price(data.shippingGroupList.total_shipping_price,3,gl_skin_currency,gl_basic_currency_symbol,gl_basic_currency_symbol_position,'','<span id="total_sale">_str_price_</span>');
2823	if(data.shippingGroupList.total_shipping_price > 0){
2824		shippingTotalViewPrice = '(+) ' + shippingTotalViewPrice
2825	}
2826	$('#shippingTotalPrice').html(shippingTotalViewPrice);
2827
2828	//전체 결제금액 html create
2829	var totalViewPrice = get_currency_price(data.cart.total_price,3,gl_skin_currency,gl_basic_currency_symbol,gl_basic_currency_symbol_position,'','<span class="tahoma">_str_price_</span>');
2830	$('#totalPrice').html(totalViewPrice);
2831	
2832	//전체 할인금액 html create
2833	var saleTotalViewPrice = get_currency_price(data.cart.total_sale,3,gl_skin_currency,gl_basic_currency_symbol,gl_basic_currency_symbol_position,'','<span id="total_sale">_str_price_</span>');
2834	if(data.cart.total_sale > 0){
2835		saleTotalViewPrice = '(-) ' + saleTotalViewPrice
2836	}
2837	$('#saleTotalPrice').html(saleTotalViewPrice);
2838
2839	//전체 결제금액 비교통화
2840	var totalPriceCompare = data.cart.total_price_compare;
2841	$('#totalPriceCompare').html(totalPriceCompare);	
2842
2843	//배송비 html 바인딩
2844	if(typeof gl_operation_type != 'undefined' && gl_operation_type == 'light') {
2845		shippingInfoHtmlCreateResp(data);
2846	}else if(gl_set_mode == 'mobile'){
2847		shippingInfoHtmlCreateMobile(data);
2848	}else{
2849		shippingInfoHtmlCreate(data);
2850		//배송비 상세정보 바인딩
2851		if(data.shippingCostDetail != null){
2852			shippingInfoDetailHtmlCreate(data);
2853		}
2854		//할인금액 상세정보 바인딩
2855		if(data.totalSaleList != null){
2856			saleCostInfoHtmlCreate(data);
2857		}	
2858	}
2859}
2860
2861//할인금액 상세 내역 html create
2862function saleCostInfoHtmlCreate(data){
2863	var saleDetailHtml = '<h1>할인내역</h1><div class="layer_inner"><p class="center">총 <span class="red">' + get_currency_price(data.cart.total_sale,3,gl_skin_currency,gl_basic_currency_symbol,gl_basic_currency_symbol_position,'','<span class="total_sales_price totalprice">_str_price_</span>') + '</span> 할인</p><table class="tbl_col" width="100%" border="0" cellpadding="0" cellspacing="0"><caption>할인내역</caption><colgroup><col style="width:50%" /><col style="width:50%" /></colgroup><thead class="hide"><tr><th scope="col">항목</th><th scope="col">할인금액</th></tr></thead><tbody>';
2864	var enuri = 0;
2865	var ehideClass = '';
2866	var target = $('#saleDetailInfo');
2867
2868	$.each(data.totalSaleList,function(_key, _value){
2869		var hideClass = '';
2870		var price = 0;
2871
2872		if(_value['price'] == 0){
2873			hideClass = 'class="hide"';
2874		}else{
2875			price = get_currency_price(_value['price'],3,gl_skin_currency,gl_basic_currency_symbol,gl_basic_currency_symbol_position,'','<span cclass="total_' + _key + '_sale">_str_price_</span>')
2876		}
2877
2878		saleDetailHtml += '<tr id="total_' + _key + '_sale_tr" ' + hideClass + '><th scope="row">' + _value['title'] + '</th><td class="bolds ends prices">' + price + '';
2879	});
2880
2881
2882	if(data.cart.enuri > 0){
2883		enuri = get_currency_price(data.cart.enuri,3,gl_skin_currency,gl_basic_currency_symbol,gl_basic_currency_symbol_position,'','<span cclass="enuri">_str_price_</span>')
2884		saleDetailHtml += '<tr><th scope="row">에누리</th><td>' + enuri + '</td></tr>';
2885	}
2886
2887	saleDetailHtml += '</tbody></table></div><a href="javascript:;" class="detailDescriptionLayerCloseBtn">닫기</a>';
2888
2889	target.html(saleDetailHtml);
2890}
2891
2892//배송비 상세 내역 html create
2893function shippingInfoDetailHtmlCreate(data){
2894
2895	var shippingDetailHtml = '';
2896	var target = $('#shippingDetailInfo');
2897	var totalShippingCost = 0;
2898	var totalPostpaidCost = 0;
2899	var dsCost = 0;
2900	var daCost = 0;
2901	var dhCost = 0;
2902	var psCost = 0;
2903	var paCost = 0;
2904	var phCost = 0;
2905
2906	if(data.shippingCostDetail.hasOwnProperty('delivery')){
2907		$.each(data.shippingCostDetail.delivery,function(_key, _value){
2908			totalShippingCost += _value;
2909		});
2910
2911		dsCost = data.shippingCostDetail.delivery.std;
2912		daCost = data.shippingCostDetail.delivery.add;
2913		dhCost = data.shippingCostDetail.delivery.hop;
2914	}
2915
2916	if(data.shippingCostDetail.hasOwnProperty('postpaid')){
2917		$.each(data.shippingCostDetail.postpaid,function(_key, _value){
2918			totalPostpaidCost += _value;
2919		});
2920
2921		psCost = data.shippingCostDetail.postpaid.std;
2922		paCost = data.shippingCostDetail.postpaid.add;
2923		phCost = data.shippingCostDetail.postpaid.hop;
2924	}
2925
2926	shippingDetailHtml = '<h1>배송비내역</h1><div class="layer_inner"><!-- 선불 배송비 상세 :: START --><p class="center">주문 시 결제 배송비 : 총<span class="red">' + get_currency_price(totalShippingCost,3,gl_skin_currency,gl_basic_currency_symbol,gl_basic_currency_symbol_position,'','<span class="total_org_shipping_price totalprice">_str_price_</span>') + '</span></p><table class="tbl_col" width="100%" border="0" cellpadding="0" cellspacing="0"><caption>주문 시 결제 배송비</caption><colgroup><col style="width:50%" /><col style="width:50%" /></colgroup><thead class="hide"><tr><th scope="col">항목</th><th scope="col">배송비</th></tr></thead><tbody><tr><th scope="row">기본배송비</th><td>' + get_currency_price(dsCost,3,gl_skin_currency,gl_basic_currency_symbol,gl_basic_currency_symbol_position,'','<span class="basic_delivery">_str_price_</span>') + '</td></tr><tr class="total_add_delivery_lay"><th scope="row">추가배송비</th><td>' + get_currency_price(daCost,3,gl_skin_currency,gl_basic_currency_symbol,gl_basic_currency_symbol_position,'','<span class="add_delivery">_str_price_</span>') + '</td></tr><tr><th scope="row">희망일 배송비</th><td>' + get_currency_price(dhCost,3,gl_skin_currency,gl_basic_currency_symbol,gl_basic_currency_symbol_position,'','<span class="hop_delivery">_str_price_</span>') + '</td></tr></tbody></table><!-- 선불 배송비 상세 :: END --><!-- 착불 배송비 상세 :: START --><p class="mt10 center">착불 결제 배송비 : 총 <span class="red">' + get_currency_price(totalPostpaidCost,3,gl_skin_currency,gl_basic_currency_symbol,gl_basic_currency_symbol_position,'','<span class="totalprice">_str_price_</span>') + '</span></p><table class="tbl_col" width="100%" border="0" cellpadding="0" cellspacing="0"><caption>착불 결제 배송비</caption><colgroup><col style="width:50%" /><col style="width:50%" /></colgroup><thead class="hide"><tr><th scope="col">항목</th><th scope="col">배송비</th></tr></thead><tbody><tr><th scope="row">기본배송비</th><td>' + get_currency_price(psCost,3,gl_skin_currency,gl_basic_currency_symbol,gl_basic_currency_symbol_position,'','<span class="basic_delivery">_str_price_</span>') + '</td></tr><tr class="total_add_delivery_lay"><th scope="row">추가배송비</th><td>' + get_currency_price(paCost,3,gl_skin_currency,gl_basic_currency_symbol,gl_basic_currency_symbol_position,'','<span class="add_delivery">_str_price_</span>') + '</td></tr><tr><th scope="row">희망일 배송비</th><td>' + get_currency_price(phCost,3,gl_skin_currency,gl_basic_currency_symbol,gl_basic_currency_symbol_position,'','<span class="hop_delivery">_str_price_</span>') + '</td></tr></tbody></table><!-- 착불 배송비 상세 :: END --></div><a href="javascript:;" class="detailDescriptionLayerCloseBtn">닫기</a>';
2927
2928	target.html(shippingDetailHtml);
2929}
2930
2931//배송 방법 변경 이벤트
2932function bind_shipping_modify_btn(){
2933	$(".btn_shipping_modify").off('click').on("click",function() {
2934		var cart_seq	= $(this).attr('cart_seq');
2935		var prepay_info = $(this).attr('prepay_info');
2936		var nation		= $(this).attr('nation');
2937		var hop_date	= $(this).attr('hop_date');
2938		var goods_seq	= $(this).attr('goods_seq');
2939		var reserve_txt	= $(this).attr('reserve_txt');
2940
2941		$.ajax({
2942			'url': '/goods/shipping_detail_info',
2943			'data': {'mode':'cart','cart_seq':cart_seq,'prepay_info':prepay_info,'nation':nation,'hop_date':hop_date,'goods_seq':goods_seq,'reserve_txt':reserve_txt},
2944			'type': 'get',
2945			'dataType': 'text',
2946			'success': function(html){
2947				if(html){
2948					// 반응형스킨
2949					if (typeof gl_operation_type != 'undefined' && gl_operation_type == 'light') {
2950						$("#shipping_detail_lay .layer_pop_contents").html(html);
2951						showCenterLayer('#shipping_detail_lay');
2952					}else{
2953						// 전용 스킨
2954						$("div#shipping_detail_lay").html(html);
2955						//배송방법 안내 및 변경
2956						openDialog(getAlert('oc040'), "shipping_detail_lay", {"width":500,"height":650});
2957					}
2958				}else{
2959					//오류가 발생했습니다. 새로고침 후 다시시도해주세요.
2960					alert(getAlert('oc041'));
2961					document.location.reload();
2962				}
2963			}
2964		});
2965	});
2966}
2967
2968/**
2969 * 배송비 html 동적 생성(Mobile 전용 스킨)
2970 * @param object data 상품 가격이 재계산된 후 넘어온 데이터(장바구니 데이터, 배송그룹 데이터, 총 결제 금액)
2971 */
2972function shippingInfoHtmlCreateMobile(data){
2973	//배송 그룹별 배송비 html create
2974	$.each(data.shippingGroupList,function(_key, _value){
2975		var shippingInfoHthml = '';
2976
2977		if(_key != 'shipping_cost_detail' && _key != 'total_shipping_price'){
2978			if(data.shippingGroupList[_key].hasOwnProperty('shipping_std_cfg')){
2979
2980				var target = $('#sippingInfo' + data.shippingGroupList[_key].shipping_std_cfg.shipping_group_seq);
2981
2982				//티켓 상품일 경우
2983				if(data.shippingGroupList[_key].cfg.baserule.shipping_set_code == 'coupon'){
2984					if(data.shippingGroupList[_key].shipper_name){
2985						shippingInfoHthml += '<span>' + data.shippingGroupList[_key].shipper_name + '  -  티켓배송</span>';
2986					}else{
2987						shippingInfoHthml += '<span>티켓배송</span>';
2988					}
2989
2990				//티켓 상품이 아닐 경우
2991				}else{
2992					shippingInfoHthml = '<div class="fleft">';
2993					if(data.shippingGroupList[_key].shipper_name){
2994						shippingInfoHthml += '<span class="blue">[' + data.shippingGroupList[_key].shipper_name + ']</span> ';
2995					}
2996
2997					shippingInfoHthml += '<span>' + data.shippingGroupList[_key].cfg.baserule.shipping_set_name + '</span> ';
2998
2999					if(data.shippingGroupList[_key].cfg.baserule.shipping_set_code == 'direct_store'){
3000						shippingInfoHthml += '<span class="ship_info">수령매장 ' + data.shippingGroupList[_key].store_info.shipping_store_name + '</span>';
3001					}
3002
3003					if(data.shippingGroupList[_key].shipping_hop_date){
3004						shippingInfoHthml += '<span class="ship_info">희망배송일 : ' + data.shippingGroupList[_key].shipping_hop_date + '</span>';
3005					}else if (data.shippingGroupList[_key].reserve_sdate){
3006						shippingInfoHthml += '<span class="ship_info">예약배송일 : ' + data.shippingGroupList[_key].reserve_sdate + '</span>';
3007					}
3008
3009					shippingInfoHthml += '<input type="button" class="btn_style small bt
3009n_shipping_modify" cart_seq="' + data.shippingGroupList[_key].goods[0].cart_seq + '" prepay_info="' + data.shippingGroupList[_key].shipping_prepay_info + '" nation="' + data.shippingGroupList[_key].cfg.baserule.delivery_nation + '" goods_seq="' + data.shippingGroupList[_key].goods[0].goods_seq + '" hop_date="' + data.shippingGroupList[_key].shipping_hop_date + '" reserve_txt="' + data.shippingGroupList[_key].reserve_sdate + data.shippingGroupList[_key].reserve_txt + '" value="변경" /></div><div class="fright pdt5">';
3010
3011					if(data.shippingGroupList[_key].cfg.baserule.shipping_set_code != 'direct_store'){
3012						if(data.shippingGroupList[_key].grp_shipping_price > 0){
3013							if(data.shippingGroupList[_key].shipping_prepay_info == 'delivery'){
3014								shippingInfoHthml += '<span class="ship_info">(' + getAlert('sy004') + ')</span>';
3015							}else{
3016								shippingInfoHthml += '<span class="ship_info">(' + getAlert('sy003') + ')</span>';
3017							}
3018						}
3019					}
3020
3021					if(data.shippingGroupList[_key].grp_shipping_price > 0){
3022						shippingInfoHthml += '<span id="price_' + data.shippingGroupList[_key].shipping_group + '"> ' + get_currency_price(data.shippingGroupList[_key].grp_shipping_price,3,gl_skin_currency,gl_basic_currency_symbol,gl_basic_currency_symbol_position,'','<span class="add_delivery">_str_price_</span>') + '</span>';
3023					}else{
3024						if(data.shippingGroupList[_key].ship_possible == 'Y'){
3025							shippingInfoHthml += '<span id="price_' + data.shippingGroupList[_key].shipping_group + '">무료</span>';
3026						}else{
3027							shippingInfoHthml += '<span class="red" id="price_' + data.shippingGroupList[_key].shipping_group + '">배송불가</span>';
3028						}
3029					}
3030				}
3031
3032				shippingInfoHthml += '</div>';
3033
3034
3035				target.html(shippingInfoHthml);
3036				bind_shipping_modify_btn();
3037			}
3038		}
3039	});
3040}
3041
3042/**
3043 * 배송비 html 동적 생성(PC전용 스킨)
3044 * @param object data 상품 가격이 재계산된 후 넘어온 데이터(장바구니 데이터, 배송그룹 데이터, 총 결제 금액)
3045 */
3046function shippingInfoHtmlCreate(data){
3047
3048	$.each(data.shippingGroupList,function(_key, _value){
3049
3050		if(_key != 'shipping_cost_detail' && _key != 'total_shipping_price'){
3051			if(data.shippingGroupList[_key].hasOwnProperty('shipping_std_cfg')){
3052				var shipperName = '';
3053				if(data.shippingGroupList[_key].shipper_name){
3054					shipperName = data.shippingGroupList[_key].shipper_name;
3055				}
3056				var shippingInfoHthml = '<table width="100%" cellpadding="0" cellspacing="0"><tr><td><div class="blue">' + shipperName + '</div>';
3057
3058				var target = $('#sippingInfo' + data.shippingGroupList[_key].shipping_std_cfg.shipping_group_seq);
3059
3060				//티켓 상품일 경우
3061				if(data.shippingGroupList[_key].cfg.baserule.shipping_set_code == 'coupon'){
3062					shippingInfoHthml += '티켓발송';
3063				//티켓 상품이 아닐 경우
3064				}else{
3065					shippingInfoHthml += '<div>' + data.shippingGroupList[_key].cfg.baserule.shipping_set_name + '</div>';
3066
3067					if(data.shippingGroupList[_key].grp_shipping_price > 0){
3068						shippingInfoHthml += '<span>' + get_currency_price(data.shippingGroupList[_key].grp_shipping_price,3,gl_skin_currency,gl_basic_currency_symbol,gl_basic_currency_symbol_position,''); + '</span>';
3069
3070						if(data.shippingGroupList[_key].cfg.baserule.shipping_set_code != 'direct_store'){
3071							if(data.shippingGroupList[_key].shipping_prepay_info == 'delivery'){
3072								shippingInfoHthml += '<span class="ship_info">(' + getAlert('sy004') + ')</span>';
3073							}else{
3074								shippingInfoHthml += '<span class="ship_info">(' + getAlert('sy003') + ')</span>';
3075							}
3076						}
3077					}else{
3078						if(data.shippingGroupList[_key].ship_possible == 'Y'){
3079							shippingInfoHthml += '<div>무료</div>';
3080						}else{
3081							shippingInfoHthml += '<div class="red">배송불가</div>';
3082						}
3083					}
3084				}
3085				shippingInfoHthml += '</td>';
3086				shippingInfoHthml += '<td><!-- 배송방법 변경 :: START --><div class="order_change"><button type="button" class="btn_shipping_modify btn_chg small" cart_seq="' + data.shippingGroupList[_key].goods[0].cart_seq + '" prepay_info="' + data.shippingGroupList[_key].shipping_prepay_info + '" nation="' + data.shippingGroupList[_key].cfg.baserule.delivery_nation + '" goods_seq="' + data.shippingGroupList[_key].goods[0].goods_seq + '" hop_date="' + data.shippingGroupList[_key].shipping_hop_date + '" reserve_txt="' + data.shippingGroupList[_key].reserve_sdate + data.shippingGroupList[_key].reserve_txt + '">변경</button></div>
3086<!-- 배송방법 변경 :: END --></td>';
3087				shippingInfoHthml += '</tr></table>';
3088
3089				if(data.shippingGroupList[_key].cfg.baserule.shipping_set_code == 'direct_store'){
3090					shippingInfoHthml += '<div class="ship_info">수령매장 : ' + data.shippingGroupList[_key].store_info.shipping_store_name + '</div>';
3091				}
3092
3093				if(data.shippingGroupList[_key].shipping_hop_date){
3094					shippingInfoHthml += '<div class="ship_info">희망배송일 : ' + data.shippingGroupList[_key].shipping_hop_date + '</div>';
3095				}else if (data.shippingGroupList[_key].reserve_sdate){
3096					shippingInfoHthml += '<div class="ship_info">예약배송일 : ' + data.shippingGroupList[_key].reserve_sdate + '</div>';
3097				}
3098
3099				target.html(shippingInfoHthml);
3100				bind_shipping_modify_btn();
3101			}
3102		}
3103	});
3104}
3105
3106/**
3107 * 배송비 html 동적 생성(반응형 스킨)
3108 * @param object data 상품 가격이 재계산된 후 넘어온 데이터(장바구니 데이터, 배송그룹 데이터, 총 결제 금액)
3109 */
3110function shippingInfoHtmlCreateResp(data){
3111	
3112	//배송 그룹별 배송비 html create
3113	$.each(data.shippingGroupList,function(_key, _value){
3114		
3115		if(_key != 'shipping_cost_detail' && _key != 'total_shipping_price'){
3116			if(data.shippingGroupList[_key].hasOwnProperty('shipping_std_cfg')){
3117				var html = '';
3118				html += '<ul class="detail">';
3119				var target = $('#sippingInfo' + data.shippingGroupList[_key].shipping_std_cfg.shipping_group_seq);
3120				html += '<li class="th">배송 :</li>';
3121				//티켓 상품일 경우
3122				if(data.shippingGroupList[_key].cfg.baserule.shipping_set_code == 'coupon'){
3123					if(data.shippingGroupList[_key].shipper_name){
3124						html += '<li class="ticket">' + data.shippingGroupList[_key].shipper_name + '  -  티켓배송</li>';
3125					}else{
3126						html += '<li class="ticket">티켓배송</li>';
3127					}
3128
3129				//티켓 상품이 아닐 경우
3130				}else{
3131					html += '<li class="silmul">';
3132					if(data.shippingGroupList[_key].shipper_name){
3133						html += '<span class="gray_01">[' + data.shippingGroupList[_key].shipper_name + ']</span> ';
3134					}
3135
3136					html += '<span>' + data.shippingGroupList[_key].cfg.baserule.shipping_set_name + '</span> ';
3137
3138					if(data.shippingGroupList[_key].cfg.baserule.shipping_set_code != 'direct_store'){
3139						if(data.shippingGroupList[_key].grp_shipping_price > 0){
3140							if(data.shippingGroupList[_key].shipping_prepay_info == 'delivery'){
3141								html += '<span class="ship_info">(' + getAlert('sy004') + ')</span>';
3142							}else{
3143								html += '<span class="ship_info">(' + getAlert('sy003') + ')</span>';
3144							}
3145						}
3146					}
3147
3148					if(data.shippingGroupList[_key].grp_shipping_price > 0){
3149						html += '<span id="price_' + data.shippingGroupList[_key].shipping_group + '"> ' + get_currency_price(data.shippingGroupList[_key].grp_shipping_price,3,gl_skin_currency,gl_basic_currency_symbol,gl_basic_currency_symbol_position,'','<span class="add_delivery">_str_price_</span>') + '</span>';
3150					}else{
3151						if(data.shippingGroupList[_key].ship_possible == 'Y'){
3152							html += '<span id="price_' + data.shippingGroupList[_key].shipping_group + '">무료</span>';
3153						}else{
3154							html += '<span class="red" id="price_' + data.shippingGroupList[_key].shipping_group + '">배송불가</span>';
3155						}
3156					}
3157					
3158					html += '<div class="hope">';
3159					if(data.shippingGroupList[_key].cfg.baserule.shipping_set_code == 'direct_store'){
3160						html += '<span class="ship_info">수령매장 ' + data.shippingGroupList[_key].store_info.shipping_store_name + '</span>';
3161					}
3162
3163					if(data.shippingGroupList[_key].shipping_hop_date){
3164						html += '<span class="ship_info">희망배송일 : ' + data.shippingGroupList[_key].shipping_hop_date + '</span>';
3165					}else if (data.shippingGroupList[_key].reserve_sdate){
3166						html += '<span class="ship_info">예약배송일 : ' + data.shippingGroupList[_key].reserve_sdate + '</span>';
3167					}
3168					
3169					html += '</div>';
3170					
3171					html += '</li>';
3172				}
3173				
3174				html += '<li class="btn_area">';
3175				html += '<button type="button" class="btn_resp" onclick="bundle_goods_search(\'' + data.shippingGroupList[_key].cfg.baserule.shipping_group_seq +'\');" title="새창">묶음배송 상품보기</button> ';
3176				
3177				var reserve_txt = "";
3178				if(typeof data.shippingGroupList[_key].reserve_sdate !== 'undefined') {
3179					reserve_txt += data.shippingGroupList[_key].reserve_sdate;
3180				}
3181				if(typeof data.shippingGroupList[_key].reserve_txt !== 'undefined') {
3182					reserve_txt += data.shippingGroupList[_key].reserve_txt;
3183				}
3184				html += '<input type="button" class="btn_resp btn_shipping_modify" cart_seq="' + data.shippingGroupList[_key].goods[0].cart_seq +'" prepay_info="'+ data.shippingGroupList[_key].shipping_prepay_info +	'" nation="' + data.shippingGroupList[_key].cfg.baserule.delivery_nation + '" goods_seq="' + data.shippingGroupList[_key].goods[0].goods_seq + '" hop_date="' + data.shippingGroupList[_key].shipping_hop_date + '" reserve_txt="' + reserve_txt + '" value="배송 변경" />';
3185				html += '</li>';
3186				html += '</ul>';
3187				target.html(html);
3188				bind_shipping_modify_btn();
3189			}
3190		}
3191		
3192	});
3193	
3194}
3195
3196//전체 체크 해제
3197function checkBoxCheck(){
3198	var falseChk = 0;
3199	$('input[name*="cart_option_seq"]').each(function(){
3200		if($(this).attr('checked') != 'checked'){
3201			falseChk++;
3202		}
3203	});
3204
3205	if (typeof gl_operation_type != 'undefined' && gl_operation_type == 'light') { // 반응형스킨
3206		if(falseChk == 0){
3207			$("form#cart_form .btn_select_all").attr("checked",true);
3208		}else{
3209			$("form#cart_form .btn_select_all").attr("checked",false);
3210		}		
3211	} else if(gl_set_mode === 'mobile'){ // 전용스킨-모바일
3212		if(falseChk == 0){
3213			$("form#cart_form .btn_select_all").attr("checked",true).closest("div").addClass("ez-checkbox-on");
3214		}else{
3215			$("form#cart_form .btn_select_all").attr("checked",false).closest("div").removeClass("ez-checkbox-on");
3216		}
3217	} else { // 전용스킨-pc
3218		if(falseChk == 0){
3219			$('.chk_select_all').attr('checked',true);
3220		}else{
3221			$('.chk_select_all').attr('checked',false);
3222		}
3223	}
3224}
3225//장바구니 개선 스크립트
3226
3227
3228// 모바일 에이전트 구분
3229var isMobile = {
3230	Android: function () {
3231			 return navigator.userAgent.match(/Android/i) == null ? false : true;
3232	},
3233	BlackBerry: function () {
3234			 return navigator.userAgent.match(/BlackBerry/i) == null ? false : true;
3235	},
3236	IOS: function () {
3237			 return navigator.userAgent.match(/iPhone|iPad|iPod/i) == null ? false : true;
3238	},
3239	Opera: function () {
3240			 return navigator.userAgent.match(/Opera Mini/i) == null ? false : true;
3241	},
3242	Windows: function () {
3243			 return navigator.userAgent.match(/IEMobile/i) == null ? false : true;
3244	},
3245	any: function () {
3246			 return (isMobile.Android() || isMobile.BlackBerry() || isMobile.IOS() || isMobile.Opera() || isMobile.Windows());
3247	}
3248};
3249
3250//카카오톡 링크
3251function kakaotalk_link(type, url, subject, title, img, price, price_discount, price_rate){
3252	var kakao_obj = {
3253		objectType: type,
3254		content: {
3255			title: subject,
3256			imageUrl: img,
3257			link: {
3258				mobileWebUrl: url,
3259				webUrl: url
3260			}
3261		},
3262		buttons: [
3263		  {
3264			title: '피드',
3265			link: {
3266				mobileWebUrl: url,
3267				webUrl: url
3268			}
3269		  }
3270		]
3271	};
3272	if	( type == 'commerce' ) {
3273		if(price_rate == "0") {
3274			kakao_obj.commerce = {
3275				regularPrice:	price_discount,
3276			}
3277		} else {
3278			kakao_obj.commerce = {
3279				regularPrice:	price,
3280				discountPrice:	price_discount,
3281				discountRate:	price_rate
3282			}
3283		}
3284		kakao_obj.buttons[0].title = '구매하기';
3285		kakao_obj.content.title = title;
3286	}
3287
3288	Kakao.Link.sendDefault(kakao_obj);
3289}
3290
3291// 클립보드 복사 함수 :: 2018-11-22 lwh
3292function clipboard_copy(str){
3293
3294	if(typeof(str) === "undefined") retrun;	
3295	
3296	if(typeof(str) === "object")
3297	{
3298		var code =  $(str).attr('code');
3299		if(typeof(code) === "undefined") retrun;
3300		var arr = code.split("/||/");	
3301		str = arr.join("");
3302		alert("클립보드에 저장되었습니다.");
3303	}	
3304
3305	var $temp = $("<input>");		// $temp 에 인풋 변수저장
3306    $("body").append($temp);		// body안 끝에 $temp인풋 생성
3307    $temp.val(str).select();		// $temp value는 param str 로하고 셀렉트한다.
3308    document.execCommand("copy");	// 현재의 선택한 내용을 클립보드로 복사한다.
3309    $temp.remove();					// $temp 지우기
3310}
3311
3312function callbackIdChk(json){
3313	var response = $.parseJSON(json);
3314	var text = response.return_result;
3315	var userid = response.userid;
3316	$("#id_info").html(text);
3317	$("input[name='userid']").val(userid);
3318}
3319
3320// 객체 -> 숫자로 타입체크 변환시 사용 (채널톡)
3321function check_obj(data) {
3322	var ret;
3323	var sum = 0;
3324
3325	if (Object.keys(data).length > 0) {
3326		ret = {};
3327		for (var key in data){ 
3328			sum = 0;
3329			if (Array.isArray(data[key])){
3330				data[key].forEach(function(val,idx,arr){
3331					sum += check_number(val);
3332				});
3333			} else {
3334				sum += check_number(data[key]);
3335			}
3336			ret[key] = sum;				
3337		};
3338	};
3339	return ret;
3340}
3341
3342// 숫자로 타입변환시 사용 (채널톡)
3343function check_number(x) {
3344
3345	var pattern = /[^0-9.]/gi; // 이외에는 제외
3346	var pattern2 = /./; // 포함 
3347
3348	// 숫자를 제외하고는 제거
3349	if (pattern.test(x)) {  
3350		x = x.replace(pattern,''); 
3351	}
3352
3353	// 변환
3354	if (pattern2.test(x)) { 
3355		x = uncomma_float(x); 
3356	} else { 
3357		x = uncomma(x); 
3358	}
3359	return x;
3360
3361}
3362
3363// 채널톡 위시리스트 이벤트
3364function AddToWish(id,name,amount) {
3365    if (id == null || typeof id == 'undefined') {
3366        id = '';
3367    } 
3368
3369    if (name == null || typeof name == 'undefined'){
3370        name = '';
3371    }
3372
3373    if (amount == null || typeof amount == 'undefined'){
3374        amount = 0;
3375    }
3376	if (typeof ChannelIO != 'undefined') {
3377		ChannelIO('track', 'AddToWish', {
3378			'id': id,
3379			'name': name,
3380			'amount': amount
3381		});
3382	}
3383}
3384
3385// 리스트에서 위시리스트 사용시 or 장바구니에서 위시리스트 사용시 호출
3386function channeltalk_wish_in(seq,type,obj){
3387
3388	// 초기값
3389	var name = '';
3390	var amount = '';
3391	var ret;
3392	
3393	// 가공할 데이터가 있을 경우
3394	if (typeof obj != 'undefined' && typeof type != 'undefined') { 
3395		switch (type) {
3396            case 'setWish': // (반응형스킨) 리스트에서 찜버튼 클릭시
3397                var goods = $(obj).parents('.item_img_area').siblings('.item_info_area'); // 상품정보
3398                name = goods.children('.goods_name_area').find('.name').text(); // 상품명
3399                amount = goods.children('.goods_price_area').find('.sale_price > .num').text();
3400                break;
3401            case 'display_goods_zzim_heavy': // (전용스킨) 메인페이지 or 리스트에서 찜버튼 클릭시
3402                name = $(obj).find('.goods_name').text(); // 상품명
3403				var classObj = $(obj).find('.sale_price');
3404				amount = 0;
3405				if ( $(obj).find('.sale_price').length > 0) {
3406					if ($(obj).find('.sale_price').length === 1 ){
3407						amount = $(obj).find('.sale_price').text(); // 상품 가격
3408						amount = check_number(amount);
3409					} else {
3410						classObj.each(function(){
3411							var tmp_amount = check_number($(this).text());
3412							if (amount === 0){
3413								amount = tmp_amount;
3414							} else if (amount > tmp_amount) {
3415								amount = tmp_amount;
3416							}
3417						});
3418					}
3419				}
3420                break;
3421            case 'display_goods_zzim': // (반응형스킨) 메인페이지에서 찜버튼 클릭시
3422                name = $(obj).find('.displaY_goods_name > .areA > a').text(); // 상품명
3423                amount = $(obj).find('.displaY_sales_price > .areA > .nuM').text(); // 상품 가격
3424                break;
3425			// case 'cart_wish': // (공통) 장바구니에서 찜버튼 클릭시
3426			// 	name = $(obj).siblings('.relative').find('.order_name').text();
3427			// 	amount = $(obj).siblings('.right').find('[class^="cart_option_price"]').text();
3428			// 	console.log(name,amount);
3429			// 	break;
3430			default:
3431				name = '';
3432				amount = '';
3433				break;
3434        }
3435	}
3436	if (typeof seq != 'undefined') {
3437		// 옵션값이 존재할때 사용
3438		if (name != '' && name != null && amount !='' && amount != null && amount != 0 ) {
3439
3440			// 금액외에 특수문자 포함여부 확인 
3441			if (type == 'display_goods_zzim_heavy') {
3442				 AddToWish(seq,name,amount);
3443			} else {
3444				ret = check_number(amount);
3445				if (typeof ret != 'undefined'){
3446					amount = ret;
3447					AddToWish(seq,name,amount);
3448				}
3449			}
3450			
3451		} else {
3452			var url = "/goods/now_wish?seqs="+ seq;
3453
3454			$.getJSON(url,function(res){
3455				if (res != null) {
3456					name = res.goods_name;
3457					amount = res.price;
3458					ret = check_number(amount);
3459					if (typeof ret != 'undefined'){
3460						amount = ret;
3461						AddToWish(seq,name,amount);
3462					}
3463				}
3464			});
3465		}
3466	} else {
3467		return false;
3468	}
3469}
3470
3471// 자주 묻는 질문 조회
3472function call_faq_view(faqviewBtn) {
3473	var boardId = faqviewBtn.attr('board_id');
3474	var boardSeq = faqviewBtn.attr('board_seq');
3475	var viewLink = faqviewBtn.attr('href');
3476	var elementType = faqviewBtn.prop('nodeName');
3477
3478	$.ajax({
3479		'url' : '../board/view',
3480		'data' : {'id': boardId, 'seq': boardSeq},
3481		'type' : 'get',
3482		'dataType': 'html',
3483		'success' : function(res){
3484			// PC 스킨 고객센터 자주 묻는 질문 글 클릭한 경우
3485			if (elementType == "A") {
3486				document.location.href= viewLink;
3487			}
3488			// 그 외 글 클릭한 경우
3489			else {
3490				$("#faqcontent_"+boardSeq).toggle();
3491			}
3492		}
3493	});
3494}

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.