PageSourceSearch

https://static.go.co.kr/js/all_common.js?ver=20261006122725

js go.co.kr collected 2026-10-06 03:28:07 UTC 95,417 bytes, 3,391 lines download raw bytes

1var base_url2 = burl;
2var ad_day	= "2018년 05월 29일";
3
4/* 서브리스트 공통 */
5var listing = {
6	single_list: function(page, loca, sub_loca, ttype, sort) {
7		$.ajax({
8			type: "post",
9			url: "state.php",
10			data: "mode=single_list&page="+page+"&loca="+loca+"&ttype="+ttype+"&sort="+sort+"&sub_loca="+sub_loca,
11			success: function(data) {
12				page = parseInt(page);
13				$("#list_p").append(data);
14			}
15		});
16	},
17	
18	main_list_scroll: function(page, search_type, gubun) {
19		currentlyLoading = true;
20
21		var string = $("#sub_sform").serialize();
22		if($("#stat_mode").val() == "map_geo") {
23			//var b_max = "50";
24			var b_max = "20";
25		} else {
26			//var b_max = "10";
27			var b_max = "50";
28		}
29
30		if(gubun == "add" || gubun == "zeronew"){ // 지역확장을 위해 추가
31			var addnum = $("#addnum").val();
32		}
33
34		if(gubun == "zeronew"){ // 지역 확장을 위해 추가
35			$("#no_result").hide();
36			$("#room_recommend").hide();
37			$("#near_area").hide();
38		}
39
40		$.ajax({
41			url : "./state.php",
42			type : "post",
43			data: "mode="+$("#stat_mode").val()+"&page="+page+"&search_type="+search_type+"&b_max="+b_max+"&"+string+"&gubun="+gubun+"&addnum="+addnum, // 지역확장을 위해 추가,
44			success: function(e) {
45				
46				if(gubun == "new") {
47					$("#scroll_main").html(e);
48				} else{
49					if(gubun == "add"){ // 지역확장을 위해 추가
50						$("#scroll_main").append(e);
51						$("#room_recommend").hide();
52						$("#near_area").hide();
53					} else if(gubun == "zeronew"){ // total_cnt 가 0일때						
54						$("#scroll_main").html(e);
55					} else if(gubun == "prev") {
56						$("#scroll_main").prepend(e);				
57						
58					} else {
59						$("#scroll_main").append(e);
60					}
61				}
62
63				if($("#sch_tab").hasClass("tab_search_ov") == true) {
64					$("#sch_tab").addClass("tab_search");
65					$("#sch_tab").removeClass("tab_search_ov");
66					$("#sch_line").hide();
67					$("#sch_line_tr").hide();
68					$("#arr_img").attr("src", "http://img.go.co.kr/mobile/btn_arrow_bottom2.jpg");
69				}
70			},
71			
72			beforeSend: function() {
73				if(gubun == "new") {
74					$(".loading2").show();
75					$("#scroll_main").html($("#loading2_box").html());
76				} else {
77					$(".loading2:last").show();
78					if(gubun == "add"){ // 지역확장을 위해 추가
79						$("#room_recommend").hide();
80						$("#near_area").hide();
81					}
82					
83					$(".loading2").css("margin", "50px 0 50px 0");
84					$("#scroll_main").append($("#loading2_box").html());					
85
86					$("body").scrollTop($(document).height()-135);
87				}
88
89				$("#btmLogo").hide();
90				$("#scroll_main").addClass("loading_on");
91
92
93			},
94			
95			complete: function() {
96				if(gubun == "new") {
97					currentlyLoading = false;
98				} else{
99					$(".loading2").hide();
100					currentlyLoading = false;
101				}
102
103				$("#btmLogo").show();
104				$("#scroll_main").removeClass("loading_on");
105			}
106		});
107	},
108
109	locallist_ver2: function(local) {
110		$("#local_tab li a").removeClass("on");
111		$(".local_"+local).addClass("on");
112		$.ajax({
113			url : "/home/main/state.php",
114			type: "post",
115			data: "mode=local_list&local="+local+"&page=1",
116			success: function(data) {
117				$(".local_list").html(data);
118
119				/* 슬라이드 왼쪽*/				
120				$(".local_list").bjqs({height : 290, width : 676, animduration : 450, responsive  : true, automatic	: true, showcontrols : true, showmarkers : true, centermarkers : false, nexttext : "<img src=\"http://img.go.co.kr/btnNext.png\" alt=\"다음\">", prevtext : "<img src=\"http://img.go.co.kr/btnPrevious.png\" alt=\"이전\">"});
121			}
122		});
123	},
124
125	locallist_abr_ver2: function(local) {
126		$("#local_tab_abr li a").removeClass("on");
127		$(".local_"+local).addClass("on");
128		$.ajax({
129			url : "/home/main/state.php",
130			type: "post",
131			data: "mode=local_abr&local="+local,
132			success: function(data) {
133				$("#local_abr_list").html(data);
134			}
135		});
136	},
137	
138	locallist_ver2: function(local) {
139		$("#local_tab li a").removeClass("on");
140		$(".local_"+local).addClass("on");
141		$.ajax({
142			url : "/home/main/state.php",
143			type: "post",
144			data: "mode=local_list&local="+local+"&page=1",
145			success: function(data) {
146				$(".local_list").html(data);
147
148				/* 슬라이드 왼쪽*/				
149				$(".local_list").bjqs({height : 290, width : 676, animduration : 450, responsive  : true, automatic	: true, showcontrols : true, showmarkers : true, centermarkers : false, nexttext : "<img src=\"http://img.go.co.kr/btnNext.png\" alt=\"다음\">", prevtext : "<img src=\"http://img.go.co.kr/btnPrevious.png\" alt=\"이전\">"});
150			}
151		});
152	},
153	
154	locallist_detail: function(local) {
155		$("#local_tab li a").removeClass("on");
156		$(".local_"+local).addClass("on");
157
158		$.ajax({
159			url : "state.php",
160			type: "post",
161			data: "mode=local_detail&local="+local+"",
162			success: function(data) {
163				$("#local_detail_list").html(data);
164			},
165			
166			beforeSend: function() {
167				$("#local_detail_list").html("<div class=\"loading2\" style=\"text-align:center;height:400px;padding-top:100px;\"><p style=\"font-size:15px; line-height:3; color:#807f7f\">국내 지역별 <span style=\"color:#ff610a\">추천 숙박 상품</span>을 업데이트중입니다...</p><img src=\""+load_img+"\" alt=\"loading\" /></div>");
168			}
169		});
170	},
171	
172	locallist_detail_abr: function(local) {
173		$("#local_tab li a").removeClass("on");
174		$(".local_"+local).addClass("on");
175
176		$.ajax({
177			url : "state.php",
178			type: "post",
179			data: "mode=local_detail&local="+local+"&abr=true",
180			success: function(data) {
181				$("#local_detail_list").html(data);
182			},
183			
184			beforeSend: function() {
185				$("#local_detail_list").html("<div class=\"loading2\" style=\"text-align:center;height:400px;padding-top:100px;\"><p style=\"font-size:15px; line-height:3; color:#807f7f\">해외 지역별 <span style=\"color:#ff610a\">추천 숙박 상품</span>을 업데이트중입니다...</p><img src=\""+load_img+"\" alt=\"loading\" /></div>");
186			}
187		});
188	},
189	
190	recent_list: function(pnum) {
191		$.ajax({
192			url : "/home/main/state.php",
193			type : "post",
194			data: "mode=recent_list&pnum="+pnum,
195			success: function(data) {
196				$("#recent_box").html(data);
197			}
198		});
199	},
200	
201	recomm_list_th: function() {
202		var string = $("#sub_sform").serialize();
203		
204		$.ajax({
205			url : "./state.php",
206			type : "post",
207			data: "mode=recomm_list_th&"+string+"",
208			success: function(e) {
209				if(e == "no_result") {
210					$("#localrecomm_box").hide();
211				} else {
212					$("#localrecomm_box").show();
213					$("#localrecomm").html(e);
214				}
215			}
216		});
217	},
218	
219	asearch_op2: function() {
220		if($("#area_search_list3").hasClass("a_on") == true) {
221			$("#area_search_list3").hide();
222			$("#area_search_list3").removeClass("a_on");
223			
224			
225			$(".hide_div").show();
226
227			if((set_ver == "high" && user_flag == "ios") || user_flag == "android") {
228				$("#bottomMenu2").hide();
229			}
230			
231		} else {
232			$("#area_search_list3").show();
233			$("#area_search_list3").addClass("a_on");
234
235			$(".hide_div").hide();
236		}
237	}
238}
239
240/* 검색관련 공통함수 */
241var searching = {
242	search_go: function() {
243		if($("#keyword").val() == "") {
244			alert("검색어를 입력하세요.");
245			$("#keyword").focus();
246			return;
247		}
248		
249		$("#kform").submit();
250	},
251	
252	dateshow: function(val) {
253		$("#"+val).datepicker('show');
254	},
255	
256	simple_go_ver2: function(formname) {
257		if($("#"+formname+" #skeyword2").val() == "지역, 숙소명, 여행지명") {
258			$("#"+formname+" #skeyword2").val('');
259		}
260
261		$("#"+formname+"").submit();
262	},
263	
264	location_city_ver2: function(formname, city1) {
265		if(city1 == "전국") {
266			$("#"+formname+" select[name='city_2']").text('');
267			$("#"+formname+" select[name='city_2']").append("<option value=''>군/구</option>");
268		} else {
269			$.ajax({
270				type : "post",
271				url : "/home/search/state.php",
272				data: "mode=city_2&city1="+city1+"",
273				success: function(data) {
274					$("#"+formname+" select[name='city_2']").text('');
275					$("#"+formname+" select[name='city_2']").append(data);
276				}
277
278			});
279		}
280	},
281	
282	location_city_sub: function(id, city1, city2, mode) {
283		if(city1 == "전국") {
284			$("#"+id).text('');
285			$("#"+id).append("<option value=''>군/구</option>");
286		} else {
287			$.ajax({
288				type : "post",
289				url : "/home/search/state.php",
290				data: "mode="+mode+"&city1="+city1+"&city2="+city2,
291				success: function(data) {
292					$("#"+id).text('');
293					$("#"+id).append(data);
294					
295				}
296
297			});
298		}
299	},
300
301	location_detail: function(id, city1, city2, city3, mode) {
302		$("#"+id).text('');
303		if(city1 == "전국") {
304			$("#"+id).text('');
305			$("#"+id).append("<option value=''>군/구</option>");
306		} else {
307			$.ajax({
308				type : "post",
309				url : "/home/search/state.php",
310				data: "mode="+mode+"&city1="+city1+"&city2="+city2+"&city3="+city3+"&boxid="+id,
311				success: function(data) {
312					if(data == "no_result") {
313						$("#"+id+"_box").hide();
314					} else {
315						$("#"+id+"_box").show();
316						$("#"+id).text('');
317						$("#"+id).append(data);
318					}					
319				}
320			});
321		}
322	},
323	
324	mtab_change: function(id) {
325		var tabname = $("#tab_"+id);
326		var formname = $("#"+id+"_form");
327		
328		$(".mforms").hide();
329		
330
331		if(tabname.hasClass(id+"_on") == false) {
332			if(id == "internal") {
333				$("#tab_global").removeClass("global_on");	
334			} else {
335				$("#tab_internal").removeClass("internal_on");	
336			}
337			tabname.addClass(id+"_on");
338			formname.show();
339		}
340	},
341	
342	simply_sh: function(val) {
343		if($(val).attr("class") == "son") {
344			$(val+" input").attr("disabled", true);
345			$(val+" select").attr("disabled", true);
346			$(val).hide();
347			$(val).removeClass("son");
348		} else {
349			$(val+" input").attr("disabled", false);
350			$(val+" select").attr("disabled", false);
351			$(val).show();
352			$(val).addClass("son");
353		}
354	},
355
356	reset: function() {
357		$("input[type='checkbox']").prop("checked", false);
358		$("input[type='text']").val("");
359		$("select option:eq(0)").attr("selected", "selected");
360
361		$("input[name='city_detail']").val("ex) 강남구");
362		$("input[name='tour_detail']").val("ex) 남산");
363		$("input[name='tra_detail']").val("ex) 강남역");
364		
365	},
366	
367	simply_hide: function(val) {
368		$(val).hide();
369	},
370	
371	allclick: function(name, type) {
372		if(type == "chk") {
373			$(".allchk").attr("onclick", "sh.allclick('"+name+"', 'unchk')");
374		} else {
375			$(".allchk").attr("onclick", "sh.allclick('"+name+"', 'chk')");
376		}
377		$("input[name='"+name+"[]']").each(function(i) {
378			if(type == 'chk') {
379				$("input[name='"+name+"[]']").eq(i).prop("checked", true);
380			} else {
381				$("input[name='"+name+"[]']").eq(i).prop("checked", false);
382			}
383		});
384	},
385	
386	hotel_chk: function() {
387		$("input[name='bun[]']").each(function(i) {
388			if($("input[name='bun[]']").eq(i).val() == "호텔") {
389				$("input[name='bun[]']").eq(i).attr("checked", true);
390			}
391		});
392	},
393	
394	location_city_v2: function(city1, city2) {
395		if(city1 == "전국") {
396			$("select[name='city_2']").text('');
397			$("select[name='city_2']").append("<option value=''>군/구</option>");
398		} else {
399			$.ajax({
400				type : "post",
401				url : "/home/search/state.php",
402				data: "mode=city_2&city1="+city1+"",
403				success: function(data) {
404					$("select[name='city_2']").text('');
405					$("select[name='city_2']").append(data);
406					if(city2 == "") {
407						$("select[name='city_2']").val('000');
408					} else {
409						$("select[name='city_2']").val(city2);
410					}
411				}
412
413			});
414		}
415	},
416	
417	searching_main: function(formid, gubun, uflag) {
418		var loca1   = $("#"+formid+" #city_1").val();
419		var keyword = $("#"+formid+" #sub_keyword").val();
420		var ttype	= $("#"+formid+" #ttype").val();
421
422		if(gubun == "kor") { 
423			var s_select = "sh_internal"; 
424			
425			var loca2 = $("#"+formid+" #city_2").val();
426			var sub_s = $("#"+formid+" #sub_sdate").val();
427			var sub_e = $("#"+formid+" #sub_edate").val();
428			
429
430		} else if(gubun == "abr") { 
431			var s_select = "sh_global"; 
432
433			var loca2 = $("#"+formid+" #abr_city_2").val();
434			var sub_s = $("#"+formid+" #p_class").val();
435			var sub_e = "";
436		}
437
438		if(loca1 == "" && loca2 == "" && ttype == "" && sub_s == "" && sub_e == "" && keyword != "") {
439			$("#"+formid).attr("action", "http://search."+base_url2+"/home/?search_select="+s_select+"&hotel_detail="+keyword);
440		} 
441
442		$("#"+formid).submit();
443	},
444	
445	local_click: function(id) {
446		$("#"+id).addClass("on");
447		$.ajax({
448			url : "/home/search/state.php",
449			data: "mode=sub_open&loca="+id,
450			type: "post",
451			success: function(e) {
452				$(".localSmall").html(e);
453			}
454		});
455	},
456	
457
458	search_chk: function() {
459		if($("#kform #hotel_detail").val() == "") {
460			alert("검색어를 입력하세요.");
461			$("#kform #hotel_detail").focus();
462			return;
463		}
464
465		$("#kform").submit();
466	},
467	
468	scalender2: function(ts, val, mode) {
469		
470		if($("."+val+"_calender").hasClass("c_on") == true && mode == 'close') {
471			
472			$("#top_box").css("z-index", "9999");
473			$("#pop_cal").hide();
474
475			//$("."+val+"_calender").slideUp('400');
476			$("."+val+"_calender").html('');
477			$("."+val+"_calender").removeClass("c_on");
478			//$("."+val+"_calender").css("border-bottom", "none");
479			$("#"+val+"_bt").attr("href", "javascript:searching.scalender2('"+ts+"', '"+val+"', 'open')");
480		} else {
481			$("#top_box").css("z-index", "5");
482			$("#pop_cal").show();
483
484			var _val = $("input[name='"+val+"']").val();
485			$.ajax({
486				url : "/home/search/search_calender.php",
487				data: "ts="+ts+"&val="+val+"&mode="+mode+"&pts="+_val,
488				type: "post",
489				success: function(data) {
490					$("."+val+"_calender").html(data);
491					//$("."+val+"_calender").slideDown('400');
492					$("."+val+"_calender").addClass("c_on");
493					//$("."+val+"_calender").css("border-bottom", "1px solid #d2d2d2");
494					$("#"+val+"_bt").attr("href", "javascript:searching.scalender2('"+ts+"', '"+val+"', 'close')");
495				}
496			});
497		}
498	},
499	
500	schoice2: function(val, sdate, ndate) {
501		$("input[name='"+val+"']").val(sdate);
502		$("."+val+"_cal_table .red_bg").removeClass("red_bg");
503	
504		var ex = sdate.split("-");
505		var _ex = ex[0]+ex[1]+ex[2];
506
507		$("."+val+"_cal_table #date_"+_ex).addClass("red_bg");
508		$("."+val+"_cal_table #date_"+_ex+" a").addClass("font_white");
509		
510		//체크아웃날짜를 자동세팅 
511		if(val == "sdate" || val == "sub_sdate") {
512			searching.scalender2(sdate, 'sdate', 'close');
513			if(val == "sub_sdate") {
514				$("input[name='sub_edate']").val(ndate);
515			} else {
516				$("input[name='edate']").val(ndate);
517			}
518			//searching.scalender2(ndate, 'edate', 'nset');
519		} else {
520			searching.scalender2(ndate, 'edate', 'close');
521		}
522	},
523	
524	local_click_ver2: function(id, val, div_gubun) {
525		if($("#"+id).hasClass("on") == false) {
526			$("#"+id).addClass("on");
527			//$("#"+id).children("a").append(" <img src=\"http://img.go.co.kr/mobile/icon_check_on.png\" height=\"15\" class=\"check_img\">");
528			$("#"+id).children("a").before(" <img src=\"http://img.go.co.kr/mobile/icon_check_on.png\" height=\"15\" class=\"check_img\">");
529		}
530		
531		var layer_mode = $("#local_layer_mode").val();
532		
533		if(div_gubun == "global_div") {
534			var mode = "sub_open2_abr";
535			var str_ex = id.split("sloca_abr_");		
536		} else {
537			var mode = "sub_open2";
538			var str_ex = id.split("sloca_");		
539		}
540
541		$.ajax({
542			url : "/home/search/state.php",
543			data: "mode="+mode+"&loca="+id+"&prev_sub="+$("#city_2").val()+"&layer_mode="+layer_mode,
544			type: "post",
545			success: function(e) {
546				$("#"+div_gubun+" .localSmall").html(e);
547				$("#city1_temp").val(str_ex[1]);
548				$("#city1_temp_txt").text(val);
549				$("#city1_prev").val(val);
550				if(str_ex[1] == "all") {
551					$("#city2_temp").val("");
552				}
553			},			
554			complete: function() {
555				$('.localSmall').scrollTop($('.localSmall').prop('scrollHeight'));
556			}
557		});
558	},
559	
560	local_click_main: function(id, val, gubun, move_link, move_link2) {
561		if(gubun != "all") {
562			$("#city2_temp").val(val);
563		} else {
564			$("#city2_temp").val('');
565		}		
566
567		var layer_mode = $("#local_layer_mode").val();
568		var val = $("#city2_temp").val();
569		var prev_val = $("#city_1").val();
570	
571		$("#city_1").val($("#city1_temp").val());
572		$("#city_2").val($("#city2_temp").val());
573		
574		if($("#local_layer_gubun").val() == "global_div") {
575			$("#city_1_choice").text(val);
576		} else { 
577			$("#city_1_choice").text($("#city1_prev").val()+" "+val);
578		}
579		
580		// 지역구분
581		$.cookie("subway_chk", "no", {domain: base_url2, path : '/'})
582
583		if($("#local_layer_gubun").val() == "global_div") {
584			$.cookie("save_city_1_abr", $("#city1_temp").val(), {domain: base_url2, path : '/'});
585			$.cookie("save_sub_loca_abr", $("#city2_temp").val(), {domain: base_url2, path : '/'});
586			$.cookie("save_city_1_abr_txt", $("#city1_prev").val(), {domain: base_url2, path : '/'});
587		} else {
588			$.cookie("save_city_1", $("#city1_temp").val(), {domain: base_url2, path : '/'});
589			$.cookie("save_sub_loca", $("#city2_temp").val(), {domain: base_url2, path : '/'});
590			$.cookie("save_city_1_txt", $("#city1_prev").val(), {domain: base_url2, path : '/'});
591		}
592		
593		if(prev_val != $("#city_1").val() && $.cookie("ttype_arr") != "single,main_list" && $.cookie("ttype_arr") != "main_list,single") {
594			move_link += "&gubun="+$("#local_layer_gubun").val()+"&prev_sdate="+$("#prev_sdate").val()+"&prev_edate="+$("#prev_edate").val();
595			utils.on("#popup_btn2");
596		//	location.href = move_link;
597		} else {
598			location.href = move_link2;
599		}
600	},
601
602	local_click_menu: function(gubun, local1, local2, local_txt, move_link) {
603		if(gubun == "global") {
604			$.cookie("save_city_1_abr", local1, {domain: base_url2, path : '/'});
605			$.cookie("save_sub_loca_abr", local2, {domain: base_url2, path : '/'});
606			$.cookie("save_city_1_abr_txt", local_txt, {domain: base_url2, path : '/'});
607		} else {
608			$.cookie("save_city_1", local1, {domain: base_url2, path : '/'});
609			$.cookie("save_sub_loca", local2, {domain: base_url2, path : '/'});
610			$.cookie("save_city_1_txt", local_txt, {domain: base_url2, path : '/'});
611		}
612
613		location.href = move_link;
614	},
615	
616	local_click_sub: function(id, val, gubun) {
617		var layer_mode = $("#local_layer_mode").val();
618
619		$(".localSmall li").removeClass("on");
620		$("#"+id).addClass("on");	
621
622		if(gubun != "all") {
623			$("#city2_temp").val(val);
624		} else {
625			$("#city2_temp").val('');
626		}		
627		
628		if($("#local_layer_gubun").val() == "global_div") {
629			if($("#s_abr").val() == "Y") {
630				$.cookie("save_city_1_abr_single", $("#city1_temp").val(), {domain: base_url2, path : '/'});
631				$.cookie("save_sub_loca_abr_single", $("#city2_temp").val(), {domain: base_url2, path : '/'});
632				$.cookie("save_city_1_abr_txt_single", $("#city1_prev").val(), {domain: base_url2, path : '/'});
633			} else {
634				$.cookie("save_city_1_abr", $("#city1_temp").val(), {domain: base_url2, path : '/'});
635				$.cookie("save_sub_loca_abr", $("#city2_temp").val(), {domain: base_url2, path : '/'});
636				$.cookie("save_city_1_abr_txt", $("#city1_prev").val(), {domain: base_url2, path : '/'});
637			}
638		} else {
639			$.cookie("save_city_1", $("#city1_temp").val(), {domain: base_url2, path : '/'});
640			$.cookie("save_sub_loca", $("#city2_temp").val(), {domain: base_url2, path : '/'});
641			$.cookie("save_city_1_txt", $("#city1_prev").val(), {domain: base_url2, path : '/'});
642		}
643
644
645		searching.local_click_apply();
646	},
647	
648	local_click_apply: function() {
649		var layer_mode = $("#local_layer_mode").val();
650		var val = $("#city2_temp").val();
651		var prev_city1 = $("#city_1").val();
652
653		$("#city_1").val($("#city1_temp").val());
654		$("#city_2").val($("#city2_temp").val());
655		
656		if($("#local_layer_gubun") == "global_div") {
657			$("#city_1_choice").text(val);
658		} else { 
659			$("#city_1_choice").text($("#city1_prev").val()+" "+val);
660		}
661		
662		
663		if(layer_mode != "sub_detail") {
664			if(layer_mode == "search") {
665				$("#loca_form").submit();
666			} else {
667				//utils.full_popon('layer_local', 'id');				
668				if(layer_mode == "sub" || layer_mode == "single_abr") {
669					if(prev_city1 == $("#city1_temp").val() && $.cookie("ttype_arr") != "single,main_list" && $.cookie("ttype_arr") != "main_list,single") {
670						utils.full_popon('layer_local', 'id'); 
671						listing.main_list_scroll('1', '', 'new');
672					} else {
673						//utils.full_popon('layer_calender', 'id');
674						utils.on("#popup_btn2"); 
675					}
676				} else if(layer_mode == "map") {
677					$("#sdate").val($("#check_in").val());
678					$("#edate").val($("#check_out").val());
679					$("#move_sub_keyword").val($("#sub_keyword").val());
680
681					$("#move_form").submit();
682				}
683			}
684		} else {
685			$('#sub_sform').submit();
686		}
687	},
688	
689	new_cal: function(cal_mode, prev_date, cur_date, temp) {
690		var add_str = "";
691		if(cal_mode == "single_checkin_ad") {			
692			add_str = "&pno="+$("input[name='find_pno']").val()+"&jehu="+$("input[name='jehu_channel']").val();
693		} 
694		$.ajax({
695			url : "/home/search/state.php",
696			data: "mode=new_cal_show&cal_mode="+cal_mode+"&prev_date="+prev_date+"&check_in="+cur_date+"&temp2="+$("#chin_date").val()+"&lgubun="+$("#local_layer_gubun").val()+add_str,
697			type: "post",
698			success: function(data) {
699				$("#"+cal_mode+"_cal").html(data);
700			},			
701			complete: function() {
702				
703				if(temp != "") {
704					searching.new_choice('auto_checkout', prev_date, temp, '', '');
705				}
706			}
707		});
708	},
709	
710	new_choice: function(cal_mode, choice, choice_type1, ndate, ndate_type1) {
711		var layer_mode = $("#cal_layer_mode").val();
712		if(cal_mode == "checkin") {
713			$("#checkin_cals td").removeClass("red_bg");
714			$("#checkin_cals td a").removeClass("font_white");
715			$("#checkin_cals #date_"+choice).addClass("red_bg");
716			$("#checkin_cals #date_"+choice).children("a").addClass("font_white");
717
718			$("#chin_date").val(choice);
719			$("#chin_choice").text(choice_type1);
720			
721			searching.new_cal('checkin', choice, choice, '');
722			searching.new_cal('checkout', ndate, choice, ndate_type1);
723
724			navigate.move_slow("checkout_cal", "id");
725
726		} else if(cal_mode == "checkout" || cal_mode == "auto_checkout"){
727			$("#checkout_cals td").removeClass("red_bg");
728			$("#checkout_cals td a").removeClass("font_white");
729			$("#checkout_cals #date_"+choice).addClass("red_bg");
730			$("#checkout_cals #date_"+choice).children("a").addClass("font_white");
731
732			$("#chout_date").val(choice);
733			$("#chout_choice").text(choice_type1);
734			
735			searching.new_cal('checkout', choice, choice, '');			
736			
737
738		} else if(cal_mode == "single_checkin") {
739
740			$("#"+cal_mode+"_cals td").removeClass("red_bg");
741			$("#"+cal_mode+"_cals td a").removeClass("font_white");
742			$("#"+cal_mode+"_cals #date_"+choice).addClass("red_bg");
743			$("#"+cal_mode+"_cals #date_"+choice).children("a").addClass("font_white");
744
745			$("#check_in").val(choice);
746			$("#check_out").val(ndate);
747			
748			searching.new_cal(cal_mode, choice, choice, '');
749			$("#sub_keyword").val("성수기예약");
750			$("#city_1").val("");
751			$("#city_2").val("");
752			$("#sub_sform").submit();
753		} else if(cal_mode == "single_checkin_ad") {
754			
755			$("#"+cal_mode+"_cals td").removeClass("red_bg");
756			$("#"+cal_mode+"_cals td a").removeClass("font_white");
757			$("#"+cal_mode+"_cals #date_"+choice).addClass("red_bg");
758			$("#"+cal_mode+"_cals #date_"+choice).children("a").addClass("font_white");
759
760			$("input[name='hseldate']").val(choice);
761			$("input[name='nseldate']").val(ndate);
762
763			var dt1 = $("input[name='hseldate']").val();
764			var dt1_str = dt1;
765
766			var dt2 = $("input[name='nseldate']").val().split(".");
767			var dt2_str = dt2[1]+"."+dt2[2];
768
769			$("#date_choide").text(dt1_str+"~"+dt2_str);
770		
771			if($("#matching_state").val() == "on" && $("#matching_date").val() == dt1) {
772				utils.out("#summer_box");					
773				location.href="/home/view/?p_no="+$("#matching_code").val()+"&sub_sdate="+$("input[name='hseldate']").val()+"&sub_edate="+$("input[name='nseldate']").val()+"&matching=RhA=";				
774			} else {
775				utils.out("#summer_box");
776				booking.find_room();
777				$("#hseldate_bt").attr("href", "javascript:navigate.move2('pro_list_title2', 'id');booking.sch_calender('"+$("input[name='hseldate']").val()+"', 'hseldate', 'open');booking.sch_calender('"+ $("input[name='nseldate']").val()+"', 'nseldate', 'open')");
778			}
779		
780		}
781	},
782	
783	new_choice_select: function() {
784		var layer_mode = $("#cal_layer_mode").val();
785
786		
787		$("#check_in").val($("#chin_date").val());
788		$("#check_out").val($("#chout_date").val());
789		
790		
791		if(layer_mode == "sub" || layer_mode == "map") {
792			var chin = $("#chin_choice").text().substring(0,5);
793			var chout = $("#chout_choice").text().substring(0,5);
794			chin	= chin.replace(/-/g, "."); 
795			chout	= chout.replace(/-/g, "."); 
796			$("#sdate_choice").text(chin+"~"+chout);
797		} else {
798			if(layer_mode == "sub_detail") {
799				$("#chin_choice2").text($("#chin_choice").text());
800				$("#chout_choice2").text($("#chout_choice").text());
801			}
802			$("#sdate_choice").text($("#chin_date").val());
803		}
804		
805		$(window).scrollTop(0);
806		utils.full_popon('layer_calender', 'id');
807		if(layer_mode == "sub") {
808			listing.main_list_scroll('1', '', 'new');
809		} else if(layer_mode == "map") {
810			$("#dist1").val("");
811			$("#dist2").val("");
812			$("#dist_first").val("");
813			$("#empty_bt").show();
814
815			listing.main_list_scroll('1', $("#sort").val(), 'new');
816		}
817	},
818
819	fgubun_click: function(val) {
820		$("#fgubun2").val(val);
821		listing.main_list_scroll('1', $("#search_type").val(), 'new');
822	}
823}
824
825/* 공통으로 쓰는 유틸함수 */
826var utils = {
827	checknum: function(field, next, cnt) {
828		var len = $("input[name='"+field+"']").val().length;
829		if(len > cnt) {
830			$("input[name='"+next+"']").focus();
831		}
832	},
833	checktype: function(type, field) {
834		if (!(event.keyCode >=37 && event.keyCode<=40)) {
835			if(type == "en2") {
836				var inputVal = $("#"+field+"").val();
837			} else {
838				var inputVal = $("input[name='"+field+"']").val();
839			}
840			switch(type) {
841				case "email1":
842					$("input[name='"+field+"']").val(inputVal.replace(/[^a-z0-9\-_]/gi,''));
843					break;
844				
845				case "email2":
846					$("input[name='"+field+"']").val(inputVal.replace(/[^a-z0-9\.]/gi,''));
847					break;
848				
849				case "en":		//영문소문자와 숫자만
850					$("input[name='"+field+"']").val(inputVal.replace(/[^a-z0-9]/gi,''));
851					break;
852				
853				case "en2":		//영문소문자와 숫자만
854					$("#"+field+"").val(inputVal.replace(/[^a-z]/gi,''));
855					break;
856
857				case "number":
858					$("input[name='"+field+"']").val(inputVal.replace(/[^0-9]/gi,''));
859					break;
860				
861				case "kor":
862					$("input[name='"+field+"']").val(inputVal.replace(/[^ㄱ-힣\.]/gi,''));
863					break;
864				
865				case "pw":		//영문소문자, 대문자, 숫자, 특수문자
866					$("input[name='"+field+"']").val(inputVal.replace(/[^a-zA-Z0-9]/gi,''));
867					break;
868				
869				case "kor2":
870					$("input[name='"+field+"']").val(inputVal.replace(/[^ㄱ-힣a-zA-Z]/gi,''));
871					break;
872				
873			}
874		}
875	},
876	
877	textchk: function(val) {
878		if(val == '[도착예정시간 / 차량소지여부]') {
879			$("#memo").val('');
880		}
881	},
882	emailsel: function(val) {
883		if(val == "dr") {
884			$("#email2").val("");
885			$("#email2").show();
886		} else {
887			$("#email2").val(val);
888		}
889	},
890
891	close_mlayer: function(gubun, id) {
892		if(gubun == "today") {
893			pop = "chk_y";
894			$.cookie("pop_mypage", pop, {expires:1});
895			$("#"+id).css("display", "none");
896		} else {
897			$("#"+id).css("display", "none");
898		}
899	},
900	
901	quick_slide: function() {
902		var quick = $("#quickMenu");
903		var btimg = $("#bt_img");
904
905		if(quick.hasClass("quick_on") == true) {
906			quick.removeClass("quick_on");
907			btimg.attr("src", "http://img.go.co.kr/btn_quickMenu_open.jpg");
908			quick.animate({right: -123}, 200);
909		} else {
910			quick.addClass("quick_on");
911			btimg.attr("src", "http://img.go.co.kr/btn_quickMenu_close.jpg");	
912			quick.animate({right: 0}, 200);
913		}
914	},
915	
916	appbn: function(gubun, obj) {
917		
918		pop = "chk_y";
919		$.cookie("pop_mob", pop, {path : '/'});
920		$("#"+obj).css("display", "none");
921		
922		$(".subMenu").css("top", "193px");
923	},
924	
925	app_layer: function(obj) {
926		if($("#"+obj).hasClass("on") == true) {
927			$("#"+obj).removeClass("on");
928			$("#"+obj).hide();	
929			$("#bannertop_btn").attr("src", "http://img.go.co.kr/bn_app01.jpg");
930		} else {
931			$("#"+obj).addClass("on");
932			$("#"+obj).show();
933			$("#bannertop_btn").attr("src", "http://img.go.co.kr/bn_app02.jpg");
934		}
935	},
936	
937	app_layer_new: function(obj, ad_val) {
938		if($("#"+obj).hasClass("on") == true) {
939			$("#"+obj).removeClass("on");
940			$("#"+obj).hide();	
941			$("#bannertop_btn").attr("src", "http://img.go.co.kr/bn_app01.jpg");
942			$("#bannertop_btn2").attr("src", "http://img.go.co.kr/bn_app01.jpg");
943			
944			$("#bannertop_btn").show();
945			$("#bannertop_btn2").hide();
946
947			if(ad_val == "Y") {
948				pop = "Y";
949				$.cookie("pop_lclose", pop, {path : '/'});
950			}
951		} else {
952			$("#"+obj).addClass("on");
953			$("#"+obj).show();
954
955			$("#bannertop_btn").attr("src", "http://img.go.co.kr/bn_app02.jpg");
956			$("#bannertop_btn2").attr("src", "http://img.go.co.kr/bn_app02.jpg");
957			
958			$("#bannertop_btn").hide();
959			$("#bannertop_btn2").show();
960		}
961	},
962
963	recent_pro: function(id) {
964		var items = $.cookie("recent_items");
965		if(items == "" || items == null) {
966			var full_id = id;
967		} else {
968			if(items.indexOf(id) == -1) {
969				var full_id = items+"||"+id;
970			} else {
971				var full_id = items;
972			}
973		}
974
975		$.cookie("recent_items", full_id, {expires:1, path:'/'});
976	},
977	
978	wish: function(wish_num,wish_mode) {
979		if(wish_mode == "mobile"){
980			if (wish_num == "1"){
981				var img_name = "http://img.go.co.kr/mobile/de_wish_icon.png"; //꽉 찬 하트
982				$("#wish_id").val("0");
983			} else {
984				var img_name = "http://img.go.co.kr/mobile/de_ch_icon.png"; // 빈 하트
985				$("#wish_id").val("1");			
986			}
987		} else{			
988			if (wish_num == "1"){
989				var img_name = "http://img.go.co.kr/icon_zzim2.jpg";
990				$("#wish_id").val("0");
991			} else {
992				var img_name = "http://img.go.co.kr/icon_zzim.jpg"; 
993				$("#wish_id").val("1");			
994			}			
995		}
996		$("#wishicon").attr("src", img_name);
997		$("#wishlink").attr("href", "javascript:utils.wish('"+$("#wish_id").val()+"','"+wish_mode+"')");
998
999		var string = $("#keep_f").serialize();
1000		$.ajax({
1001			url : "/home/member/state.php",
1002			type: "post",
1003			data: string,
1004			success: function(e) {
1005				alert(e);
1006			}
1007		});
1008
1009	},
1010	
1011	wish_new: function(wish_num,wish_mode) {
1012		if(wish_mode == "mobile"){
1013			if (wish_num == "1"){
1014				var img_name = "http://img.go.co.kr/mobile/de_wish_icon.png"; //꽉 찬 하트
1015				$("#wish_id").val("0");
1016			} else {
1017				var img_name = "http://img.go.co.kr/mobile/de_ch_icon.png"; // 빈 하트
1018				$("#wish_id").val("1");			
1019			}
1020			$(".wishicon").attr("src", img_name);
1021			$(".wishlink").attr("href", "javascript:utils.wish_new('"+$("#wish_id").val()+"','"+wish_mode+"')");
1022		} else{			
1023			if (wish_num == "1"){
1024				var img_name = "http://img.go.co.kr/icon_zzim2.jpg";
1025				$("#wish_id").val("0");
1026			} else {
1027				var img_name = "http://img.go.co.kr/icon_zzim.jpg"; 
1028				$("#wish_id").val("1");			
1029			}			
1030			$("#wishicon").attr("src", img_name);
1031			$("#wishlink").attr("href", "javascript:utils.wish_new('"+$("#wish_id").val()+"','"+wish_mode+"')");
1032		}
1033
1034
1035		var string = $("#keep_f").serialize();
1036		$.ajax({
1037			url : "/home/member/state.php",
1038			type: "post",
1039			data: string,
1040			success: function(e) {
1041				alert(e);
1042			}
1043		});
1044
1045	},
1046
1047	wish_del: function(del_mode) {
1048		$("#del_mode").val(del_mode);
1049		switch(del_mode) {
1050			case "choice":
1051				var txt = "선택한 내용이 삭제됩니다.";
1052				break;
1053			
1054			case "all":
1055				var txt = "모든 찜목록이 삭제됩니다.";
1056				break;
1057		}
1058		
1059		var i = 0;
1060		if(del_mode == "choice") {
1061			$("input[name='cancel[]']").each(function(e) {
1062				if($(this).is(":checked") == true) {
1063					i = i+1;
1064				}
1065			});
1066			if(i == 0) {
1067				alert("선택된 내역이 없습니다.");
1068				return;
1069			}
1070		}
1071
1072		if(confirm(txt) == true) {
1073			$("#kdform").submit();
1074		}
1075	},
1076	
1077	on:	function(obj){
1078		var a = ($(window).height() - $(obj).height()) / 2;
1079		var b = ($(window).width() - $(obj).width()) / 2;
1080
1081		switch(obj) {
1082			case "#pop_pay_point":
1083				a = a;
1084				break;
1085			case "#pay_discount_pop":
1086				a = 100;
1087				break;
1088			
1089			case "#mailing_pop_wrap":
1090			case "#call_pop_wrap":
1091			case "#call_pop_wrap1":
1092			case "#loadcard":
1093			case "#zippop":
1094				a = $(obj).offset().top;
1095				a = a+300;
1096				break;
1097			
1098			case "#agreement_pop":
1099			case "#privacy_pop":
1100			case "#pop_app":
1101				a = 0;
1102				break;
1103			
1104			case "#pop_call":
1105			case "#server_pop":
1106			case "#summer_box":
1107				a = "15%";
1108				$(window).scrollTop(0);
1109				$(window).bind("touchmove", function(e) { e.preventDefault(); });
1110				break;
1111			
1112			default:
1113				a = a;
1114				$(window).scrollTop(0);
1115				$(window).bind("touchmove", function(e) { e.preventDefault(); });
1116				break;
1117		}
1118		
1119		var arrPageSizes = ___getPageSize();
1120		$("body").append("<div id=\"overlay\"></div>");
1121		if(obj == "#menu_bg") {
1122			$("#overlay").css({"background-color":"#000", "opacity":"0.7", "width":arrPageSizes[0], "height":$(window).height()});
1123		} else {
1124			$("#overlay").css({"background-color":"#000", "opacity":"0.7", "width":arrPageSizes[0], "height":arrPageSizes[1]});
1125		}
1126		$(obj).css({"top": a, "left": b, "z-index": 500 }).show();
1127		$("#top_box").css("z-index", "5");
1128	},
1129
1130	img_on:	function(obj){
1131		var a = ($(window).height() - $(obj).height()) / 2;
1132		var b = ($(window).width() - $(obj).width()) / 2;
1133
1134		var arrPageSizes = ___getPageSize();
1135		$("body").append("<div id=\"overlay\"></div>");
1136		if(obj == "#menu_bg") {
1137			$("#overlay").css({"background-color":"#000", "opacity":"0.7", "width":arrPageSizes[0], "height":$(window).height()});
1138		} else {
1139			$("#overlay").css({"background-color":"#000", "opacity":"0.7", "width":arrPageSizes[0], "height":arrPageSizes[1]});
1140		}
1141
1142		$(obj).css({"top": a, "left": b, "z-index": 500 }).show();
1143		$("#quickMenu2").hide();
1144		$("#topSearch").css("z-index", "1");
1145	},
1146
1147	out: function(obj){
1148		$("#overlay").slideUp(function(){ $("#overlay").remove(); });
1149		$(obj).hide();
1150		switch(obj) {
1151			case "#mailing_pop_wrap":
1152				$(".mpop2").hide();
1153				$(".mpop1").show();
1154				break;			
1155			
1156			case "#menu_bg":
1157			case "#pop_call":
1158			case "#summer_box":
1159				$(window).unbind("touchmove");
1160				break;
1161			
1162			default:
1163				$(window).unbind("touchmove");
1164				break;
1165		}
1166		$("#top_box").css("z-index", "9999");
1167		$("#topSearch").css("z-index", "9999");
1168	},
1169	
1170	menu_on: function(obj) {
1171		var arrPageSizes = ___getPageSize();
1172		$("body").append("<div id=\"overlay\"></div>");
1173		$("#overlay").css({"background-color":"#000", "opacity":"0.7", "width":arrPageSizes[0], "height":$(window).height()});
1174		$(obj).show();
1175		$(obj).animate({left: 0}, 200);
1176
1177		$("#top_box").css("z-index", "5");
1178	},
1179	
1180	menu_out: function(obj) {
1181		$(obj).animate({left:-246}, 200, function() {
1182			$(obj).hide();
1183		});		
1184		$("#overlay").remove();
1185		$(window).unbind("touchmove");
1186
1187		$("#top_box").css("z-index", "9999");
1188	},
1189	
1190	rmenu_on: function(obj) {
1191		var arrPageSizes = ___getPageSize();
1192		$("body").append("<div id=\"overlay\"></div>");
1193		$("#overlay").css({"background-color":"#000", "opacity":"0.7", "width":arrPageSizes[0], "height":$(window).height()});
1194
1195		$(obj).animate({right: 0, top: 0}, 200, function() {
1196			$(obj).show();
1197
1198			$("#wrapper").bind("touchmove", function(e) { e.preventDefault(); });
1199			myScroll2 = new IScroll('#menu_bg2 #mypage', { mouseWheel: true, click: true, bounce:false });
1200			$("#bottomMenu2").hide();
1201		});
1202		
1203		$("#top_box").css("z-index", "5");
1204	},
1205	
1206	rmenu_out: function(obj) {
1207		$(obj).animate({right:-246, top: 0}, 200, function() {
1208			$("#bottomMenu2").show();
1209			$(obj).hide();
1210		});
1211		navi.move_home();
1212		$("#overlay").remove();
1213		$("#wrapper").unbind("touchmove");
1214
1215		$("#top_box").css("z-index", "9999");
1216	},
1217	
1218	rmenu_out2: function(obj) {
1219		$(obj).animate({right:-246, top: 0}, 200, function() {
1220			var UserAgent = navigator.userAgent;
1221			if(UserAgent.match(/iPhone|iPod|iPad/i) != null) {
1222				if(set_ver != "high") {
1223					$("#bottomMenu2").show();
1224				}
1225			}
1226			$(obj).hide();
1227		});
1228		navi.move_home();
1229		$("#overlay").remove();
1230		$("#wrapper").unbind("touchmove");
1231
1232		$("#top_box").css("z-index", "9999");
1233	},
1234	
1235	
1236	basic_l_on: function(obj) {
1237		if($("#"+obj).hasClass("on") == true) {
1238			$("#"+obj).removeClass("on");
1239			$("#"+obj).hide();
1240
1241			$("#top_box").css("z-index", "9999");
1242		} else {
1243			$("#"+obj).addClass("on");
1244			$("#"+obj).show();
1245
1246			$("#top_box").css("z-index", "5");
1247		}
1248	},
1249	
1250	pop_open: function(url, name, option) {
1251		var ww = window.open(url, name, "toolbar=no,scrollbars=no,directories=no,status=no,menubar=no,width=700,height=300,resizable=yes, top=50, left="+((screen.width - 450)/2)+"");
1252		ww.focus();
1253	},
1254	
1255	inst_fchk: function(formname, submit_gubun, func) {
1256		//formname form 아이디값 입력
1257
1258		var valid = true;
1259		var form = $("#"+formname);
1260		
1261		//form 내에서 유효성 체크할것만  input이나 textarea, select에 validation = 'yes' 추가
1262		var mailchk		= ["email2"];		//이메일 뒷자리 형식 체크할 input 이름만 배열로 추가
1263		var chk_field	= ["uidchk", "OTP_chk"];
1264		form.find('input, textarea, select, checkbox').each(function(key) {
1265			var obj = $(this);
1266			if(obj.attr('validation') == 'yes') {
1267				
1268				if(util.is_empty(obj)) {
1269					if(obj.attr("type") == "checkbox") {
1270						alert(obj.prop('title') + '을(를) 확인하세요.');
1271					} else {
1272						alert(obj.prop('title') + '을(를) 입력하세요.');
1273					}
1274					obj.focus();
1275					valid = false;
1276					return false;
1277				} else {
1278					if($.inArray(obj.prop('name'), mailchk) >= 0) {
1279						if(utils.is_emailchk(obj.val())) {
1280							alert('형식에 맞게 입력하세요.');
1281							obj.focus();
1282							valid = false;
1283							return false;
1284						}
1285					} else if($.inArray(obj.prop('name'), chk_field) >= 0) {
1286						if(utils.is_chk(obj.val())) {
1287							alert(obj.prop('title')+' 확인을 해주세요.');
1288							obj.focus();
1289							valid = false;
1290							return false;
1291						}
1292					}
1293				}
1294			}
1295		});
1296
1297		if(valid == true) {
1298			switch(submit_gubun) {
1299				case "func":
1300					func();
1301					break;
1302
1303				case "submit":
1304					$("#"+formname).submit();
1305					break;
1306
1307				default:
1308					return true;
1309					break;
1310
1311			}
1312			// form 넘기기
1313			/*
1314			switch(formname) {
1315				case "id_form_hp":
1316				case "id_form_email":
1317				case "pw_form_email":
1318				case "pw_form_hp":
1319					mem.find_info_result(formname);
1320					break;
1321				
1322				case "mailing_sub_form":
1323				case "esset_form":
1324				case "esset_form1":
1325					mem.mailing_sub(formname);
1326					break;
1327				
1328				case "join":
1329				case "login":
1330				case "login2":
1331				case "login3":
1332				case "reset_form":
1333				case "cregedit_mobile":
1334				case "modify_profile":
1335					$("#"+formname).submit();
1336					break;
1337
1338				case "sns_mform":
1339					sns.email_chk();
1340					break;
1341
1342				default:
1343					return true;
1344					break;
1345			}
1346			*/
1347		} else {
1348			return false;
1349		}
1350	},
1351	
1352	//필수값 체크
1353	is_chk: function(val) {
1354		if(val == null || typeof val == 'undefined' || val == "N") {
1355			return true;
1356		} else if(val == "Y") {
1357			return false;
1358		} else {
1359			return true;
1360		}
1361	},
1362	
1363	//이메일 뒷자리 형식체크
1364	is_emailchk: function(val) {
1365		var email_host = /^((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/;
1366		if(email_host.test(val) == false) {
1367			return true;
1368		}
1369		return false;
1370	},
1371
1372	on_off_list: function(val) {
1373		var state = $("#"+val).css("display");
1374		$(".link_list").hide();	
1375		if(state == "none") {
1376			$("."+val).show();
1377		} else {
1378			$("."+val).hide();
1379		}
1380	},
1381	
1382	auto_hypen: function(str) {
1383		str = str.replace(/[^0-9]/g, '');
1384		var tmp = '';
1385		if( str.length < 4){
1386			return str;
1387		}else if(str.length < 7){
1388			tmp += str.substr(0, 3);
1389			tmp += '-';
1390			tmp += str.substr(3);
1391			return tmp;
1392		}else if(str.length < 11){
1393			tmp += str.substr(0, 3);
1394			tmp += '-';
1395			tmp += str.substr(3, 3);
1396			tmp += '-';
1397			tmp += str.substr(6);
1398			return tmp;
1399		}else{				
1400			tmp += str.substr(0, 3);
1401			tmp += '-';
1402			tmp += str.substr(3, 4);
1403			tmp += '-';
1404			tmp += str.substr(7);
1405			return tmp;
1406		}
1407		return str;
1408	},
1409	loca_auto_sel: function(str, gubun) {
1410		$.ajax({
1411			url : "/home/search/state.php",
1412			type: "post",
1413			data: "mode=loca_auto_sel&keyword="+str,
1414			success: function(e) {
1415				if(e != "") {
1416					var str = e.split("|");
1417					$("#city_1").val(str[0]);
1418					if(gubun == "web") {
1419						if(str[3] == "s") {
1420							searching.location_city_sub('city_2', str[0], str[2], 'city_2');
1421						} else {
1422							searching.location_city_sub('city_2', str[0], '', 'city_2');
1423						}
1424					} else {
1425						if(str[3] == "s") {
1426							$("#city_2").val(str[2]);
1427							$("#city_1_choice").text(str[1]+" "+str[2]);
1428						} else {
1429							$("#city_2").val('');
1430							$("#city_1_choice").text(str[1]);
1431						}
1432					}
1433				}
1434			}
1435		});
1436	},
1437	loca_auto_sel2: function(str, gubun, prev1, prev2, prev3) {
1438		
1439		$.ajax({
1440			url : "/home/search/state.php",
1441			type: "post",
1442			data: "mode=loca_auto_sel&keyword="+str,
1443			success: function(e) {
1444				if(e == "no") {
1445
1446					$("#city_1").val(prev1);
1447					$("#city_2").val(prev2);
1448					if(gubun == "mobile") {		$("#city_1_choice").text(prev3);	}
1449
1450					$("#local_change").val("N");
1451
1452					
1453
1454				} else if(e != "") {
1455					var str = e.split("|");
1456					$("#city_1").val(str[0]);
1457
1458					if(gubun == "web") {
1459						if(str[3] == "s") {
1460							searching.location_city_sub('city_2', str[0], str[2], 'city_2');
1461						} else {
1462							searching.location_city_sub('city_2', str[0], '', 'city_2');
1463						}
1464					} else {
1465						if(str[3] == "s") {
1466							$("#city_2").val(str[2]);
1467							$("#city_1_choice").text(str[1]+" "+str[2]);
1468
1469							
1470					
1471						} else {
1472							$("#city_2").val('');
1473							$("#city_1_choice").text(str[1]);
1474
1475					
1476						}
1477					}
1478
1479					$("#local_change").val("Y");
1480
1481					
1482				}
1483			}
1484		});
1485	},
1486	
1487	
1488	full_popon: function(obj, gubun) {
1489		$(window).scrollTop(0);
1490		if(gubun == "id") { var full_obj = $("#"+obj);	}
1491		else { var full_obj = $("."+obj); }
1492
1493		if(full_obj.hasClass("layer_on") == true) {
1494			full_obj.removeClass("layer_on");
1495			$("#top_box").show();
1496			$(".hide_div").show();
1497			full_obj.hide();
1498			if(layer_mode == "map") {
1499				$("#empty_bt").show();
1500			}
1501	
1502		} else {
1503			full_obj.addClass("layer_on");
1504			$("#top_box").hide();
1505			$(".hide_div").hide();
1506			full_obj.show();
1507
1508			switch(obj) {
1509				case "layer_local":	
1510					if($("#city_1").val() != "" && $("#city_1").val() != "all") {
1511						if($("#local_layer_gubun").val() == "inter_div") {
1512							searching.local_click_ver2("sloca_"+$("#city_1").val(), $("#city1_prev").val(), $("#local_layer_gubun").val());	
1513						} else {
1514							searching.local_click_ver2("sloca_abr_"+$("#city_1").val(), $("#city1_prev").val(), $("#local_layer_gubun").val());	
1515						}
1516					} else {
1517						if($("#local_layer_gubun").val() == "inter_div") {
1518							if($(".localBig li[class='on']").length == 0) {
1519								searching.local_click_ver2('sloca_all', '전국', 'inter_div');	
1520							}
1521						} else {
1522							if($(".localBig2 li[class='on']").length == 0) {
1523								searching.local_click_ver2('sloca_abr_all', '전체', 'global_div');	
1524							}
1525						}
1526					}
1527					
1528					$(".localBig_wrap").css("height", $(window).height() - 110);
1529					$(".localSmall_wrap").css("height", $(window).height() - 110);
1530					break;
1531				
1532				case "layer_calender":
1533					var layer_mode = $("#cal_layer_mode").val();
1534					if(layer_mode == "sub") {
1535						searching.new_cal('checkin', $("#chin_date").val(), $("#chin_date").val(), '');
1536						searching.new_cal('checkout', $("#chout_date").val(), $("#chout_date").val(), '');
1537					} else {
1538						searching.new_cal('checkin', $("#chin_date").val(), $("#chin_date").val(), '');
1539						searching.new_cal('checkout', $("#chout_date").val(), $("#chout_date").val(), '');
1540					}
1541
1542					if(layer_mode == "map") {
1543						$("#empty_bt").hide();
1544					}
1545					break;
1546				
1547				case "layer_keyword":
1548					$("#sub_keyword_prev").focus();
1549					break;
1550			}			
1551		}
1552	},
1553		
1554	select_display: function(sel_id) {
1555		$(".select ul").hide();
1556		if($("#"+sel_id).hasClass("on") == true) {
1557			$("#"+sel_id).hide();
1558			$("#"+sel_id).removeClass("on");
1559		} else {
1560			$("#"+sel_id).show();
1561			$("#"+sel_id).addClass("on");
1562		}
1563	},
1564	
1565	field_setting: function(id, val, sel_txt) {
1566
1567		$("#"+sel_txt).text(val);
1568		$("#"+id).val(val);
1569		if(id == "email2" && val == "직접입력") {
1570			$("#"+id).val("");
1571			$("#"+id).focus();
1572		}
1573	},
1574	
1575	toggle_layer: function(id) {
1576		$("#"+id).toggle();
1577	}
1578}
1579
1580/* 공통으로 쓰는 스크롤 이동함수 */
1581var navigate = {
1582	move_home: function() {
1583		var top_height=950;
1584		var fn=0;
1585		var s = jQuery('#wrapper').height() - top_height;
1586		if (fn==0){	
1587			fn=1;
1588			jQuery('html,body').animate({
1589				scrollTop: 0
1590			}, 250, function() {fn=0;});
1591		}
1592	},
1593	
1594	move: function(id, gubun) {
1595		if(gubun == "id") { var val = $("#"+id);	}
1596		else { var val = $("."+id);	}
1597		var num = val.offset().top;
1598		$(window).scrollTop(num);
1599	},
1600	
1601	move2: function(id, gubun) {
1602		if(gubun == "id") { var val = $("#"+id);	}
1603		else { var val = $("."+id);	}
1604		var num = val.offset().top;
1605		$(window).scrollTop(num - 50);
1606	},
1607
1608	move_h: function(id, gubun, hi) {
1609		if(gubun == "id") { var val = $("#"+id);	}
1610		else { var val = $("."+id);	}
1611		var num = val.offset().top;
1612		if(hi == "") {
1613			hi = 50;
1614		}
1615		$(window).scrollTop(num - hi);
1616	},
1617	
1618	move_slow: function(id, gubun) {
1619		var fn=0;
1620		if(gubun == "id") { var val = $("#"+id);	}
1621		else { var val = $("."+id);	}
1622		var num = val.offset().top;
1623
1624		if(id == "checkin_cal" || id == "checkout_cal") {
1625			num = num - 130;
1626		} else {
1627			num = num - 130;
1628		}
1629
1630		if (fn==0){	
1631			fn=1;
1632			jQuery('html,body').animate({
1633				
1634				scrollTop: num
1635			}, 250, function() {fn=0;});
1636		}
1637	},
1638	
1639	move_slow_h: function(id, gubun, h) {
1640		var fn=0;
1641		if(gubun == "id") { var val = $("#"+id);	}
1642		else { var val = $("."+id);	}
1643		var num = val.offset().top;
1644
1645		num = num - h;
1646		
1647		if (fn==0){	
1648			fn=1;
1649			jQuery('html,body').animate({
1650				
1651				scrollTop: num
1652			}, 250, function() {fn=0;});
1653		}
1654	},
1655	
1656	move_hid: function(id, gubun, hid) {
1657		if(gubun == "id") { var val = $("#"+id);	}
1658		else { var val = $("."+id);	}
1659		var num = val.offset().top;
1660
1661		num = parseInt(num);
1662		if(hid == "") {
1663			hid = 50;
1664		} else {
1665			hid_temp = $("#"+hid).height();
1666			var hid = hid_temp;
1667			hid = parseInt(hid+170);
1668			//170
1669		}
1670		var final_hid = parseInt(num-hid);
1671		$(window).scrollTop(final_hid);
1672	}
1673}
1674
1675/* 공유하기 */
1676var sharing = {
1677	share_sns: function(gubun, e, pno) {
1678		switch(gubun) {
1679			case "mobile_mail":
1680				utils.basic_l_on("email_pop");
1681				navigate.move("email_pop", "id");
1682
1683				break;
1684
1685			case "mail":
1686				if($("#share_pop").hasClass("pop_on") == false) {
1687					utils.on("#share_pop");
1688				}
1689				$("#email_box").show();
1690				$("#mobile_box").hide();
1691				$("#share_email").addClass("email_on");
1692				$("#share_mobile").removeClass("mobile_on");
1693				$("#share_pop").addClass("pop_on");
1694				break;
1695			
1696			case "mobile_share":
1697				if($("#share_pop").hasClass("pop_on") == false) {
1698					utils.on("#share_pop");
1699				}
1700				$("#email_box").hide();
1701				$("#mobile_box").show();
1702				$("#share_email").removeClass("email_on");
1703				$("#share_mobile").addClass("mobile_on");
1704				$("#share_pop").addClass("pop_on");
1705				break;
1706			
1707			case "twitter":
1708			case "facebook":
1709			case "kakao":
1710				if(user_flag == "ios") {
1711					location.href=do2_url+"/home/view/sns_click.php?p_no="+pno+"&sns_val="+gubun;
1712				} else { 
1713					utils.pop_open(do2_url+"/home/view/sns_click.php?p_no="+pno+"&sns_val="+gubun+"", "sns");
1714				}
1715				break;
1716		}
1717	},
1718	
1719	
1720	email_chk: function() {
1721		var data1 = $("#femail").val().split("@");
1722		var data2 = $("#semail").val().split("@");
1723		var email_host = /^((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/;
1724		if(email_host.test(data1[1]) == false){
1725			alert("이메일 형식에 맞게 입력해주세요.");
1726			$("#femail").focus();
1727			return;
1728		}
1729
1730		if(email_host.test(data2[1]) == false){
1731			alert("이메일 형식에 맞게 입력해주세요.");
1732			$("#semail").focus();
1733			return;
1734		}
1735		
1736		var uflag = $("input[name='uflag']").val();
1737		var string = $("#sns_mform").serialize();
1738		$.ajax({
1739			url: "/home/view/state.php",
1740			data: string,
1741			type: "post",
1742			success: function(data) {
1743				alert(data);
1744				$("#sns_mform")[0].reset();
1745				if(uflag == "W") {
1746					//$("#email_box").hide();
1747					utils.out("#share_pop");
1748					utils.out("#laypop-mail");
1749				} else {
1750					utils.basic_l_on("email_pop");
1751				}
1752			}
1753		});
1754	},
1755	
1756	copy_url: function(e) {
1757		var IE = (document.all) ? true : false;
1758		if (IE) {
1759			if(confirm("이 글의 URL 주소를 클립보드에 복사하시겠습니까?")) {
1760				window.clipboardData.setData("Text", window.location.href);
1761			}
1762		} else {
1763			temp = prompt("이 글의 URL 주소입니다. Ctrl+C를 눌러 클립보드로 복사하세요", window.location.href);
1764		}
1765	},
1766	
1767	hp_chk: function() {
1768		var uflag = $("input[name='uflag']").val();
1769		var string = $("#sns_mform2").serialize();
1770		$.ajax({
1771			url: "/home/view/state.php",
1772			data: string,
1773			type: "post",
1774			success: function(data) {
1775				alert(data);
1776				$("#sns_mform2")[0].reset();
1777				if(uflag == "W") {
1778					//$("#email_box").hide();
1779					utils.out("#share_pop");
1780					utils.out("#laypop-sms");
1781				} else {
1782					utils.basic_l_on("email_pop");
1783				}
1784			}
1785		});
1786	}, 
1787	
1788	link_change: function(gubun) {
1789		sharing.share_sns(gubun, $("#sns_company").val(), $("#sns_pno").val());
1790	},
1791	
1792	pop_sh: function(pno, id, comp, addr, img) {
1793		utils.on('#pop_snsShare');
1794
1795		$("#email_pop").css({"top":$(window).scrollTop(), "z-index":"9999"});
1796
1797		$("#pop_snsShare").css({"top":$("#"+id).offset().top - 100, "z-index":"9999"});
1798		$("#sns_pno").val(pno);
1799		$("input[name='sns_sang']").val(pno);
1800
1801		$("#sns_company").val(comp);
1802		$("#sns_addr").val(addr);
1803		$("#sns_main_img").val(img);
1804		
1805		Kakao.Link.createTalkLinkButton({
1806			container: '#send_kakao',
1807			label: "["+sitename+"]여기 어때?\r\n업체명 : "+comp+"\r\n주소 : "+addr,
1808			image: {
1809				src: img,
1810				width: '300',
1811				height: '200'
1812			},
1813			webButton: {
1814				text: sitename+" 바로가기",
1815				url: do2_url+"/_sns.php?p_no="+pno
1816			}
1817		});		
1818	}	
1819}
1820
1821/* 예약하기 */
1822var booking = {
1823	find_room: function() {
1824		if($("#sch_sdate").val() == "") {
1825			alert("날짜를 선택하세요.");
1826			$("#sch_sdate").focus();
1827			searching.dateshow('sch_sdate');
1828			return;
1829		}
1830
1831		if($("#room_cnt").val() == "") {
1832			alert("객실수를 선택하세요.");
1833			$("#room_cnt").focus();
1834			return;
1835		}
1836
1837		if($("#adult").val() == "") {
1838			alert("인원을 선택하세요");
1839			$("#adult").focus();
1840			return;
1841		}
1842
1843		if($("#child").val() == "") {
1844			alert("인원을 선택하세요.");
1845			$("#child").focus();
1846			return;
1847		}
1848		
1849		var string = $("#rsch_form").serialize();
1850		
1851		$.ajax({
1852			type: "post",
1853			url : "/home/reservation2/rnew_roomlist.php",
1854			data : string,
1855			success: function(data) {
1856				//console.log(data);
1857				$("#room_result").html(data);
1858				
1859				var sdate = $("#sch_sdate").val();
1860				var tmp_date1 = sdate.replace("년 ", "-");
1861				var tmp_date2 = tmp_date1.replace("월 ", "-");
1862				var tmp_date3 = tmp_date2.replace("일", "");
1863				$("#sub_sdate").val(tmp_date3);
1864				$.cookie("save_sdate", tmp_date3, {domain: base_cookie_c, path : '/', expires:date});
1865
1866
1867
1868			},
1869			
1870			beforeSend: function() {
1871				if($("#room_result").hasClass("r_on") == true) {
1872					$("#room_result").html("<div id=\"loading_div\" style=\"text-align:center;width:100%;margin-bottom:50px\"><p style=\"font-size:15px; line-height:3; color:#807f7f\"><span style=\"color:#ff610a\">"+$("#loading_txt").val()+"</span>을 불러오는 중입니다...</p><img src=\""+load_img+"\" alt=\"loading\" />");
1873				} else {
1874					$("#room_result").show();
1875					$("#room_result").addClass("r_on");
1876				}
1877			}
1878		});
1879	},
1880	
1881	find_room_f: function() {
1882		if($("#sch_sdate").val() == "") {
1883			alert("날짜를 선택하세요.");
1884			$("#sch_sdate").focus();
1885			searching.dateshow('sch_sdate');
1886			return;
1887		}
1888
1889		if($("#room_cnt").val() == "") {
1890			alert("객실수를 선택하세요.");
1891			$("#room_cnt").focus();
1892			return;
1893		}
1894
1895		if($("#adult").val() == "") {
1896			alert("인원을 선택하세요.");
1897			$("#adult").focus();
1898			return;
1899		}
1900
1901		if($("#child").val() == "") {
1902			alert("인원을 선택하세요.");
1903			$("#child").focus();
1904			return;
1905		}
1906		
1907		var string = $("#rsch_form").serialize();
1908		
1909		$.ajax({
1910			type: "post",
1911			url : "/home/reservation2/rnew_roomlist_fake.php",
1912			data : string,
1913			success: function(data) {
1914				$("#room_result").html(data);
1915			},
1916			
1917			beforeSend: function() {
1918				if($("#room_result").hasClass("r_on") == true) {
1919					$("#room_result").html("<div id=\"loading_div\" style=\"text-align:center;width:100%;margin-bottom:50px\"><p style=\"font-size:15px; line-height:3; color:#807f7f\"><span style=\"color:#ff610a\">"+$("#loading_txt").val()+"</span>을 불러오는 중입니다...</p><img src=\""+load_img+"\" alt=\"loading\" />");
1920				} else {
1921					$("#room_result").show();
1922					$("#room_result").addClass("r_on");
1923				}
1924			}
1925		});
1926	},
1927
1928	room_add: function(room_val) {
1929		if(room_val != "1") {
1930			$.ajax({
1931				type: "post",
1932				url : "/home/reservation2/state.php",
1933				data : "mode=room_add&rval="+room_val,
1934				success: function(data) {
1935					$("#add_room").show();
1936					$("#add_room").html(data);
1937				}
1938			});
1939		} else {
1940			$("#add_room").html("");
1941			$("#add_room").hide();
1942		}
1943
1944		//셀렉트 증가
1945		var pt = $(".sch_cbox:last");
1946		var pt2 = $(".sch_cbox2:last");
1947
1948		var pt_len = $(".sch_cbox").length;
1949		var cur = parseInt(pt_len)+1;
1950		var mi = room_val;
1951		
1952		if(cur < mi || cur == mi) { 
1953			var clo = "";
1954			for(i = cur; i <= mi; i++) {
1955				clo = pt.clone(true);
1956				clo.attr("id", "adult"+i);
1957				clo.find(".cnum_cla").remove();
1958				$(".sch_cbox:last").after(clo);
1959
1960				clo2 = pt2.clone(true);
1961				clo2.attr("id", "child"+i);
1962				$(".sch_cbox2:last").after(clo2);
1963			}
1964		} else if(cur > mi){
1965			for(i = cur; i > mi; i--) {
1966				$("#adult"+i).remove();				
1967				$("#child"+i).remove();				
1968			}
1969		}
1970	},
1971	
1972	sclick: function(r_no, val) {
1973		var cnt = $("#rsv_s_list").find(".tb_on").length;
1974
1975		if(cnt > 0) {
1976			var hdate	= $("#hseldate").val();
1977			var night	= $("#night").val();
1978			var person	= $("#person").val();
1979			var person_c = $("#person_c").val();
1980		}
1981
1982		var ridx = $("#" + r_no + "_tr").attr("data-idx");
1983
1984		$("#ridx").val(ridx);
1985		$("#rsv_s_list tr").removeClass("select");
1986		$("#rsv_s_list tr[id$='_detail']").css("display", "none");
1987		$("#rsv_s_list tr[id$='_detail'] #cal_box").html("");
1988
1989		$("#sang_"+r_no).prop("checked", true);
1990		$("#"+r_no+"_tr").addClass("select");
1991		
1992		if($("#res_type2").val() == "pinspot") {
1993			$(".hidden_info").attr("disabled", true);
1994		}
1995		$(".hidden_lowval").attr("disabled", true);
1996
1997		//이미 있을 때
1998		if($("#"+r_no+"_detail").hasClass("tb_on") == true) {
1999			$("#"+r_no+"_detail").removeClass("tb_on");
2000			$("#"+r_no+"_detail").removeClass("select");
2001			$("#"+r_no+"_detail #cal_box").html('');
2002		} else {
2003			$("#rsv_s_list tr[id$='_detail']").removeClass("tb_on");
2004			$("#"+r_no+"_detail").addClass("tb_on");
2005			$("#"+r_no+"_detail").css("display", "table-row");
2006
2007			if($("#channel_fake").val() == "on") {
2008				var target = "/home/reservation2/channel_fake_info.php";
2009			} else {
2010				$("#sang_"+r_no+"_lowval").attr("disabled", false);
2011				switch($("#res_type2").val()) {											
2012					case "yanolja":
2013						var target = "/home/reservation2/yeogiya_cal_info.php";
2014						break;
2015					case "yanolja2":
2016						var target = "/home/reservation2/yanolja_cal_info.php";
2017						break;					
2018					default:
2019						if($("#single").val() == "on") {
2020							var target = "/home/reservation2/cal_info_single.php";
2021						} else {
2022							var target = "/home/reservation2/cal_info.php";
2023						}
2024						break;						
2025				}
2026			}
2027
2028			var string1 = $("#rform").serialize();
2029			var string2 = $("#prev_form").serialize();
2030			
2031
2032			$.ajax({
2033				url : target,
2034				type : "post",
2035				data: string1+"&"+string2,
2036				success: function(data) {
2037					$("#"+r_no+"_detail #cal_box").html(data);
2038				},
2039			
2040				beforeSend: function() {
2041					$("#"+r_no+"_detail #cal_box").html("<div style=\"width:100%;text-align:center;margin:30px 0;height:300px;\"><p style=\"font-size:15px; line-height:3; color:#807f7f;padding-top:80px\">객실을 불러오고 있습니다...</p><img src=\""+load_img+"\" alt=\"loading\" /></div>");
2042				},
2043				
2044				complete: function() {
2045					if(cnt > 0) {
2046						$("#hseldate").val(hdate);
2047						$("#night").val(night);
2048					}
2049					
2050					booking.basedt_reset();
2051				}
2052			});	
2053		}
2054		
2055		if(val == 'y') {
2056			navigate.move_hid(r_no+"_tr", "id", "topSearch");
2057		}
2058	},
2059	
2060	basedt_reset: function() {
2061
2062		var p_no = $("#p_no").val();
2063		var r_no = $("input[name='sang']:checked").val();
2064		var hdate = $("#hseldate").val();
2065		
2066		if($("#channel_fake").val() == "on") {
2067			var target = "/home/reservation2/state_fake.php";
2068			var datas = "mode=basedt_reset&p_no="+p_no+"&r_no="+r_no+"&prev_date="+hdate+"&rcnt="+$("#room_cnt").val();
2069		} else {
2070			if($("#type_channel").val() == "Y") {
2071				var target = "/home/reservation2/exp_state.php";
2072				var datas = "mode=basedt_reset_abr&hotelid="+p_no+"&room_code="+r_no+"&prev_date="+hdate;
2073			} else {
2074				var target = "/home/reservation2/state.php";
2075				var datas = "mode=basedt_reset&p_no="+p_no+"&r_no="+r_no+"&prev_date="+hdate+"&rcnt="+$("#room_cnt").val();
2076			}
2077		}
2078		$.ajax({
2079			url : target,
2080			type: "post",
2081			data: datas,
2082			cache: false,
2083			success: function(data) {
2084				var sp = data.split("||");
2085				
2086				$("#base_ts").val(sp[0]);
2087				$("#hseldate").val(sp[1]);
2088				$("#nseldate").val(sp[2]);
2089
2090				booking.calender(sp[0], sp[1], sp[2]);
2091			}
2092		});
2093	},
2094	
2095	calender: function(ts, choice, nchoice) {
2096		var p_no	= $("#p_no").val();
2097		var r_no	= $("input[name='sang']:checked").val();
2098		var abr		= $("#abr_val").val();
2099		var res_type2 = $("#res_type2").val();
2100		
2101		if($("#channel_fake").val() == "on") {
2102			var target = "/home/reservation2/state_fake.php";
2103			var datas = "mode=calender&ts="+ts+"&p_no="+p_no+"&r_no="+r_no+"&prev_date="+choice+"&next_date="+nchoice+"&rcnt="+$("#room_cnt").val();
2104			var etc = "";
2105		} else {
2106			if($("#type_channel").val() == "Y") {
2107				var target = "/home/reservation2/exp_state.php";
2108				var datas = "mode=calender_abr&ts="+ts+"&p_no="+p_no+"&r_no="+r_no+"&abr_val="+abr+"&prev_date="+choice+"&next_date="+nchoice;
2109				var etc = "on";
2110			} else {
2111				var target = "/home/reservation2/state.php";
2112				var datas = "mode=calender&ts="+ts+"&p_no="+p_no+"&r_no="+r_no+"&prev_date="+choice+"&next_date="+nchoice+"&rcnt="+$("#room_cnt").val();
2113				var etc = "";
2114			}
2115		}
2116
2117		$.ajax({
2118			type: "post",
2119			url: target,
2120			data: datas,
2121			success: function(data) {
2122				if(etc == "on") {
2123					$(".cal_sel").html(data);
2124				} else {
2125					$(".cal_section").html(data);
2126				}				
2127			},
2128			
2129			beforeSend: function() {
2130				if(etc == "on") {
2131					$(".cal_sel").html("<div style=\"width:100%;height:100%;margin:30px 0;text-align:center\"><p style=\"font-size:15px; line-height:3; color:#807f7f\">잠시만 기다려주세요...</p><img src=\""+load_img+"\" alt=\"loading\" /></div>");
2132				} else {
2133					$(".cal_section").html("<div style=\"width:100%;height:100%;margin:30px 0;text-align:center\"><p style=\"font-size:15px; line-height:3; color:#807f7f\">잠시만 기다려주세요...</p><img src=\""+load_img+"\" alt=\"loading\" /></div>");
2134				}
2135			},
2136			
2137			complete: function() {
2138				if(choice != "") {
2139					booking.dchoice(choice);
2140				}
2141			}
2142		});
2143	},
2144	
2145	child_age: function(cnum, t, gubun) {
2146		if(gubun == "web") {
2147			var ids = t;
2148			var str = ids.split("person_c");
2149			var ids_new = "cbox_"+str[1];
2150				
2151			$.ajax({
2152				url : "/home/reservation2/exp_state.php",
2153				type: "post",
2154				data: "mode=child_age&cnum="+cnum+"&rtr="+ids_new,
2155				cache: false,
2156				success: function(data) {
2157					$("."+ids_new).remove();
2158					$("#"+ids_new+" tr:last").prev().after(data);
2159					abr.choice_check();
2160				}
2161			});
2162		} else {
2163			var ids = t;
2164			var str = ids.split("person_c");
2165			var ids_new = "cbox_"+str[1];
2166				
2167			$.ajax({
2168				url : "/home/reservation2/exp_state.php",
2169				type: "post",
2170				data: "mode=child_age&cnum="+cnum+"&rtr="+ids_new,
2171				cache: false,
2172				success: function(data) {
2173					$("."+ids_new).remove();
2174					$("#"+ids_new+" tr:last").after(data);
2175					abr.mchoice_check();
2176				}
2177			});
2178		}
2179	},
2180	
2181	child_age_new: function(cnum, t, gubun) {
2182		if(gubun == "web") {
2183			var ids = t;
2184			var str = ids.split("person_c");
2185			var ids_new = "cbox_"+str[1];
2186			var res_type2 = $("#res_type2").val();
2187
2188			switch(res_type2) {
2189				case "expedia":
2190				case "expedia_a":
2191					var target_link = "/home/reservation2/exp_state.php";
2192					break;
2193				default :
2194					var target_link = "/home/reservation2/state.php";
2195					break;
2196
2197			}
2198			$.ajax({
2199				url : target_link,
2200				type: "post",
2201				data: "mode=child_age&cnum="+cnum+"&rtr="+ids_new,
2202				cache: false,
2203				success: function(data) {
2204					$("."+ids_new).remove();
2205					$("#"+ids_new+" tr:last").prev().after(data);
2206					
2207				}, complete: function() {
2208					if(res_type2 == "expedia" || res_type2 == "expedia_a") {
2209						abr.choice_check();
2210					} else {
2211						booking.choice_check();
2212					}
2213				}
2214			});
2215		} else {
2216			var ids = t;
2217			var str = ids.split("person_c");
2218			var ids_new = "cbox_"+str[1];
2219				
2220			$.ajax({
2221				url : "/home/reservation2/exp_state.php",
2222				type: "post",
2223				data: "mode=child_age&cnum="+cnum+"&rtr="+ids_new,
2224				cache: false,
2225				success: function(data) {
2226					$("."+ids_new).remove();
2227					$("#"+ids_new+" tr:last").after(data);
2228					abr.mchoice_check();
2229				}
2230			});
2231		}
2232	},
2233	
2234	dchoice: function(sdate) {
2235		var res_type2 = $("#res_type2").val();
2236		if(res_type2 == "gpension" || res_type2 == "expedia" || res_type2 == "expedia_a") {
2237			var etc = "on";
2238		} else {
2239			var etc = "";
2240		}
2241
2242		if(etc == "") {
2243			//rsv.choice_over("date_"+sdate);
2244		}
2245
2246		$("#hseldate").val(sdate);
2247
2248		if($("#night").val() != "0") {
2249			booking.night_change($("#night").val());
2250		} else {
2251			$("#night").val(1);
2252			booking.night_change(1);
2253		}
2254	},
2255	
2256	night_change: function(nval) {
2257		var seld = $("#hseldate").val();
2258		var p_no = $("#p_no").val();
2259		var r_no = $("input[name='sang']:checked").val();
2260		var gubun = $("input[name='gubun']:checked").val();
2261		if(typeof gubun == 'undefined') {
2262			gubun =$("#gubun").val();
2263		}
2264
2265		var res_type2 = $("#res_type2").val();
2266		if($("#channel_fake").val() == "on") {
2267			var etc = "";
2268			var target = "/home/reservation2/state_fake.php";
2269		} else {
2270			if($("#type_channel").val() == "Y") {
2271				var etc = "on";
2272				var target = "/home/reservation2/exp_state.php";
2273			} else {
2274				var etc = "";
2275				var target = "/home/reservation2/state.php";
2276			}
2277		}
2278
2279		var md = "date_chk";
2280		var nval = parseInt(nval);
2281		if(nval == 0) {
2282			alert("이용박수를 선택하세요.");
2283			return;
2284		}
2285
2286		var t_channel = $("#type_channel").val();
2287
2288		$.ajax({
2289			url : target,
2290			type : "post",
2291			data : "mode="+md+"&sel="+seld+"&nval="+nval+"&p_no="+p_no+"&r_no="+r_no+"&rcnt="+$("#room_cnt").val()+"&hseldate="+$('#hseldate').val(),
2292			cache : false,
2293			success: function(data) {
2294				//console.log(data);
2295				
2296				var res = data.split("^^");
2297
2298				if(res[2] == "tt_wait2") {
2299					alert("해당상품은 이용가능 날짜가 없습니다. 고객센터에 문의하세요.");
2300					return;
2301				} else if(res[2] == "tt_wait") {
2302					console.log(res[2]);
2303					consoel.log(1);
2304					alert("숙박날짜중에 예약마감된 날짜가 포함되어 있습니다.");
2305					$("#night").val(1);
2306					booking.night_change(1);
2307					return;
2308				}  else if(res[2] == "tt_wait4") {
2309					alert("요금이 등록되어 있지 않은 날짜가 포함되어 있습니다.");
2310					$("#night").val(1);
2311					booking.night_change(1);
2312					return;
2313				} else if(res[2] == "tt_wait5") {
2314					alert(ad_day+"은 1박만 가능합니다.");
2315					$("#night").val(1);
2316					booking.night_change(1);
2317					return;
2318				} else {
2319					/* 여기다 스파 일수 추가*/
2320					if($("#pack_gubun").val() == "P") {
2321						booking.adddate_setting();
2322					}
2323					/* 여기다 스파 일수 추가*/	
2324					$("#nseldate").val(res[1]);
2325
2326					$.cookie("save_sdate", $("#hseldate").val(), {domain: base_url2, path : '/'});
2327					$.cookie("save_edate", $("#nseldate").val(), {domain: base_url2, path : '/'});
2328
2329					if($("#res_type2").val() == "pinspot") {
2330						booking.usetime_select();
2331					} else {
2332						if($("#single").val() == "on") {
2333							booking.ticket_reload();
2334						} else {
2335							if(t_channel != "Y") {
2336								booking.addsetting_change(p_no, $('#hseldate').val());
2337							}
2338							booking.choice_check();
2339						}
2340					}
2341
2342				}
2343				
2344				//테스트용 호텔만 선적용
2345				if(etc == "") {
2346					if(res[3] != "") {
2347						var selval = $("#rsv_s_list select[name='room_cnt']").val();
2348						$("#rsv_s_list select[name='room_cnt'] option").remove();
2349						for(mm = 1; mm <= res[3]; mm++) {
2350							$("#rsv_s_list select[name='room_cnt']").append("<option value='"+mm+"'>"+mm+"</option>");
2351						}
2352						if(parseInt(selval) <= parseInt(res[3])) {
2353							$("#rsv_s_list select[name='room_cnt']").val(selval);
2354						}
2355					}
2356				}
2357
2358			}
2359		});
2360	},
2361	
2362	adddate_setting: function() {
2363		var seld = $("#hseldate").val();
2364		var nval = $("#night").val();
2365		var sang = $("input[name='sang']:checked").val();
2366
2367		$.ajax({
2368			url : "/home/reservation2/state.php",
2369			type : "post",
2370			data : "mode=pack_adddate&sel="+seld+"&nval="+nval+"&sang="+sang,
2371			cache : false,
2372			success: function(data) {
2373				if(data == "") {
2374					alert("이용가능한 날짜가 없습니다. 다른 날짜를 선택하세요.");
2375					location.reload();
2376					return;
2377				} else {
2378					$(".pack_date").html(data);
2379					booking.choice_check();
2380				}
2381			}
2382		});
2383	},
2384	
2385	cal_over: function(id) {
2386		$("#"+id).addClass("pric_normal_ov");
2387	},
2388	
2389	cal_out: function(id) {
2390		$(".calendar td").removeClass("pric_normal_ov");
2391	},
2392	
2393	ticket_reload: function() {
2394		$.ajax({
2395			url : "/home/reservation2/state.php",
2396			type : "post",
2397			data : "mode=ticket_reload&p_no="+$("#p_no").val()+"&sang="+$("input[name='sang']:checked").val()+"&sel_date="+$("#hseldate").val(),
2398			cache: false, 
2399			success: function(e) {
2400				$(".ticket_table").find(".ticket_row").remove();
2401				$(".ticket_table").find("tr:last").after(e);
2402				booking.choice_check();
2403			}
2404		});
2405	},
2406	choice_check: function() {
2407		var res_type2 = $("#res_type2").val();
2408		if($("#channel_fake").val() == "on") {
2409			var etc = "";
2410			var target = "/home/reservation2/state_fake.php";
2411		} else {
2412			if($("#type_channel").val() == "Y") {
2413				var etc = "on";
2414				var target = "/home/reservation2/exp_state.php";
2415			} else {
2416				var etc = "";
2417				var target = "/home/reservation2/state.php";
2418			}
2419		}
2420
2421		var string = $("#rform").serialize();	
2422		$(".calendar td").removeClass("pric_normal_ov2");
2423
2424		booking.choice_over2('date_'+$("#hseldate").val());
2425		if($("#single").val() != "on") {
2426			booking.choice_over2('date_'+$("#nseldate").val());
2427
2428			var clas = $("#date_"+$("#hseldate").val()).attr("class");
2429			if(typeof clas != "undefined") { 
2430			var exple = clas.split("ov_");
2431			var exple2 = exple[1].split(" ");
2432			
2433			var ep = parseInt(exple2[0]);
2434			//exple2[0] 사용
2435			var nt = parseInt($("#night").val());
2436			var addstr = "";
2437			for(i = 1;i <= nt;i++) {
2438				var next = "ov_"+parseInt(ep+i);
2439				booking.choice_over3(next);	
2440			}
2441			}
2442		}
2443		
2444		$.ajax({
2445			url : target,
2446			type:"post",
2447			data: "mode=choice_check&"+string,
2448			cache: false,
2449			success: function(data) {
2450				$(".cal_result").html(data);				
2451			},
2452			
2453			beforeSend: function() {
2454				$(".cal_result").html("<div id='loding_img2' style='position:absolute;background:#ffffff;width:273px;min-height:200px;margin-left:1px;z-index:3;text-align:center;padding-top:150px'><p style=\"font-size:15px; line-height:3; color:#807f7f\">잠시만 기다려주세요...</p><img src=\""+load_img+"\" alt=\"loading\" /></div>");
2455			}
2456		});
2457	},
2458		
2459	choice_over2: function(id) {
2460		$("#"+id).addClass("pric_normal_ov2");
2461	},
2462	
2463	choice_over3: function(id) {
2464		$("."+id).addClass("pric_normal_ov2");
2465	},
2466	
2467	prev_login: function() {
2468		$("#rform").attr("action", do2_url+"/home/reservation2/preserve_login.php?md=WQwlVQ==");
2469		$("#rform").submit();
2470	},
2471	
2472	prev_nlogin: function() {
2473		$("#rform").attr("action", do2_url+"/home/reservation2/preserve_nlogin.php?md=WQwlVQ==");
2474		$("#rform").submit();
2475	},
2476
2477	prev_nlogin2: function(total_m, add_val) {
2478		if($("#night").val() == "" || $("#night").val() == 0) {
2479			alert("이용박수를 선택하세요.");
2480			$("#night").focus();
2481			return;
2482		}
2483
2484		if($("#person").val() == "선택") {
2485			alert("인원수를 선택하세요.");
2486			$("#person").focus();
2487			return;
2488		}
2489
2490		if($("#person_c").val() == "선택") {
2491			alert("인원수를 선택하세요.");
2492			$("#person_c").focus();
2493			return;
2494		}
2495		
2496		var person = parseInt($("select[name='person']").val());
2497		var person_c = parseInt($("select[name='person_c']").val());
2498		var total = parseInt(person + person_c);
2499		
2500		if(total_m != "") {
2501			if(total > parseInt(total_m)) {
2502				alert("최대인원은 "+total_m+"명 입니다.");
2503				return;
2504			} 
2505		}
2506
2507		$("#rform").attr("action", do2_url+"/home/reservation2/preserve_nlogin.php?md=WQwlVQ=="+add_val);
2508		$("#rform").submit();
2509	},
2510	
2511	pack_click: function(pack_no, gubunid, gubun) {
2512		var trid = $("#"+gubunid+"_"+pack_no+"_tr");
2513		var inputid = $("#"+gubunid+"_"+pack_no);
2514		
2515		if(trid.hasClass("tron") == true) {
2516			trid.removeClass("tron");
2517			trid.hide();
2518			inputid.prop("checked", false);
2519
2520			$("#"+gubunid+"_"+pack_no+"_tr select").attr("disabled", true);
2521		} else {
2522			trid.addClass("tron");	
2523			trid.show();
2524			inputid.prop("checked", true);
2525
2526			$("#"+gubunid+"_"+pack_no+"_tr select").attr("disabled", false);
2527		}
2528
2529		if(gubun == "mobile") {
2530			go_price_calc();
2531		} else {
2532			booking.choice_check();
2533		}
2534
2535
2536	},
2537	
2538	room_cnt: function(rnum, gubun) {
2539		
2540		if(gubun == 'web') {
2541			var pt = $(".cbox:last");
2542			var pt_len = $(".cbox").length;
2543
2544			var cur = parseInt(pt_len)+1;
2545			var mi = rnum;
2546			
2547			if(cur < mi || cur == mi) { 
2548				var clo = "";
2549				//$(".pb").remove();
2550				for(i = cur; i <= mi; i++) {
2551					clo = pt.clone(true);
2552					clo.attr("id", "cbox_"+i);
2553					clo.find(".pb").attr("id", "person_box_"+i);
2554					clo.find("select[name='person[]']").attr("id", "person"+i);
2555					clo.find("select[name='person_c[]']").attr("id", "person_c"+i);
2556					clo.find(".cnum_cla").remove();
2557					$(".cbox:last").after(clo);
2558				}
2559			} else if(cur > mi){
2560				for(i = cur; i > mi; i--) {
2561					$(".person_box"+i).remove();
2562					$("#cbox_"+i).remove();				
2563				}
2564			}
2565
2566			booking.choice_check();
2567		} else if(gubun == 'mobile') {
2568			var pt = $(".cbox:last");
2569			var pt_len = $(".cbox").length;
2570
2571			var cur = parseInt(pt_len)+1;
2572			var mi = rnum;
2573			
2574			if(cur < mi || cur == mi) { 
2575				var clo = "";
2576				//$(".pb").remove();
2577				for(i = cur; i <= mi; i++) {
2578					clo = pt.clone(true);
2579					clo.attr("id", "cbox_"+i);
2580					clo.find(".pb").attr("id", "person_box_"+i);
2581					clo.find("select[name='person[]']").attr("id", "person"+i);
2582					clo.find("select[name='person_c[]']").attr("id", "person_c"+i);
2583					clo.find(".cnum_cla").remove();
2584					$(".cbox:last").after(clo);
2585				}
2586			} else if(cur > mi){
2587				for(i = cur; i > mi; i--) {
2588					$(".person_box"+i).remove();
2589					$("#cbox_"+i).remove();				
2590				}
2591			}
2592
2593			booking.mchoice_check();
2594		}
2595	},
2596	
2597	closebt: function(id) {
2598		$("#"+id).css("display", "none");
2599	},
2600	
2601	choice_submit3: function(total_m) {
2602		if($("#night").val() == "" || $("#night").val() == 0) {
2603			alert("이용박수를 선택하세요.");
2604			$("#night").focus();
2605			return;
2606		}
2607
2608		if($("#person").val() == "선택") {
2609			alert("인원수를 선택하세요.");
2610			$("#person").focus();
2611			return;
2612		}
2613
2614		if($("#person_c").val() == "선택") {
2615			alert("인원수를 선택하세요.");
2616			$("#person_c").focus();
2617			return;
2618		}
2619		
2620		var person = parseInt($("select[name='person']").val());
2621		var person_c = parseInt($("select[name='person_c']").val());
2622		var total = parseInt(person + person_c);
2623		
2624		if(total_m != "") {
2625			if(total > parseInt(total_m)) {
2626				alert("최대인원은 "+total_m+"명 입니다.");
2627				rsv.prev_layeroff();
2628				return;
2629			} 
2630		}
2631
2632		$("form[name='rform']").submit();
2633	},
2634
2635	//모바일만
2636	mroom_add: function(room_val) {
2637		var pt = $(".cbox2:last");
2638		var pt_len = $(".cbox2").length;
2639
2640		var cur = parseInt(pt_len)+1;
2641		var mi = room_val;
2642		
2643		if(cur < mi || cur == mi) { 
2644			var clo = "";
2645			//$(".pb").remove();
2646			for(i = cur; i <= mi; i++) {
2647				clo = pt.clone(true);
2648				clo.attr("id", "cbox_"+i);
2649				clo.find(".pb").attr("id", "person_box_"+i);
2650				clo.find("select[name='adult[]']").attr("id", "adult"+i);
2651				clo.find("select[name='child[]']").attr("id", "child"+i);
2652				clo.find(".cnum_cla").remove();
2653				$(".cbox2:last").after(clo);
2654				$("#person_box_"+i).css({"float":"right", "margin-top":"10px"});
2655				$("#cbox_"+i).css({"float":"none", "clear":"both"});
2656			}
2657		} else if(cur > mi){
2658			for(i = cur; i > mi; i--) {
2659				$(".person_box"+i).remove();
2660				$("#cbox_"+i).remove();				
2661			}
2662		}
2663	},
2664	
2665	sch_calender: function(ts, val, mode) {
2666		if($("."+val+"_calender").hasClass("c_on") == true && mode == 'close') {
2667			//$("."+val+"_calender").slideUp('400');
2668			$("."+val+"_calender").html('');
2669			$("."+val+"_calender").removeClass("c_on");
2670			$("."+val+"_calender").css("border-bottom", "none");
2671			if(val == "hseldate") {
2672				$("#"+val+"_bt").attr("href", "javascript:booking.sch_calender('"+ts+"', '"+val+"', 'open');booking.sch_calender('"+$("input[name='nseldate']").val()+"', 'nseldate', 'open')");
2673			} else {
2674				$("#"+val+"_bt").attr("href", "javascript:booking.sch_calender('"+$("input[name='hseldate']").val()+"', 'hseldate', 'open');booking.sch_calender('"+ts+"', '"+val+"', 'open')");
2675			}
2676		} else {
2677			$("#addbox").hide();
2678			var _val = $("input[name='"+val+"']").val();
2679			var ex = _val.split(".");
2680			pts = ex[0]+"-"+ex[1]+"-"+ex[2];	
2681			
2682			var pno = $("#p_no").val();
2683			var sno = $("#sang").val();
2684			
2685			if(val == "nseldate") {
2686				var chin = $("input[name='hseldate']").val();
2687			} else {
2688				var chin = "";
2689			}
2690			$.ajax({
2691				url : "/home/reservation2/rnew_calender.php",
2692				data: "ts="+ts+"&val="+val+"&mode="+mode+"&pts="+pts+"&p_no="+pno+"&sang="+sno+"&chin="+chin+"&abr_val="+$("input[name='abr_val']").val(),
2693				type: "post",
2694				success: function(data) {
2695					$("."+val+"_calender").html(data);
2696					$("."+val+"_calender").slideDown('400');
2697					$("."+val+"_calender").addClass("c_on");
2698					$("."+val+"_calender").css("border-bottom", "1px solid #d2d2d2");
2699
2700					if(val == "hseldate") {
2701						$("#"+val+"_bt").attr("href", "javascript:booking.sch_calender('"+ts+"', '"+val+"', 'close');booking.sch_calender('"+$("input[name='nseldate']").val()+"', 'nseldate', 'close')");
2702						$("#"+val+"_bt2").attr("href", "javascript:booking.sch_calender('"+ts+"', '"+val+"', 'close');booking.sch_calender('"+$("input[name='nseldate']").val()+"', 'nseldate', 'close')");
2703					} else {
2704						$("#"+val+"_bt").attr("href", "javascript:booking.sch_calender('"+$("input[name='hseldate']").val()+"', 'hseldate', 'close');booking.sch_calender('"+ts+"', '"+val+"', 'close')");
2705						$("#"+val+"_bt2").attr("href", "javascript:booking.sch_calender('"+$("input[name='hseldate']").val()+"', 'hseldate', 'close');booking.sch_calender('"+ts+"', '"+val+"', 'close')");
2706					}
2707				}
2708			});
2709		}
2710	},
2711	
2712	sch_choice: function(val, sdate, ndate) {
2713		$("input[name='"+val+"']").val(sdate);
2714		$("."+val+"_cal_table .red_bg").removeClass("red_bg");
2715	
2716		var ex = sdate.split(".");
2717		var _ex = ex[0]+ex[1]+ex[2];
2718		var _ex2 = ex[0]+"-"+ex[1]+"-"+ex[2];
2719
2720		$("."+val+"_cal_table #date_"+_ex).addClass("red_bg");
2721		$("."+val+"_cal_table #date_"+_ex+" a").addClass("font_white");
2722		
2723		//체크아웃날짜를 자동세팅 
2724		if(val != "singledate") {
2725			if(val == "hseldate") {
2726				//booking.sch_calender(_ex2, 'hseldate', 'close');
2727				var ex2 = ndate.split("-");
2728				var _ex2 = ex2[0]+"."+ex2[1]+"."+ex2[2];
2729				$("input[name='nseldate']").val(_ex2);
2730				
2731				booking.sch_calender(ndate, 'nseldate', 'nset');
2732				navigate.move_slow_h('nseldate_calender', 'class', 100);
2733				
2734			} else {
2735				booking.sch_calender($("input[name='hseldate']").val(), 'hseldate', 'close');
2736				booking.sch_calender(_ex2, 'nseldate', 'close');
2737
2738				setTimeout("navigate.move2('pro_list_title2', 'id')", 800);				
2739			}
2740		} else {
2741			booking.sch_calender($("input[name='singledate']").val(), 'singledate', 'close');
2742		}
2743
2744		if(val == "singledate") {
2745			var dt1 = $("input[name='singledate']").val();
2746			var dt1_str = dt1;
2747
2748			$("#date_choide").text(dt1_str);
2749		} else {
2750			var dt1 = $("input[name='hseldate']").val();
2751			var dt1_str = dt1;
2752
2753			var dt2 = $("input[name='nseldate']").val().split(".");
2754			var dt2_str = dt2[1]+"."+dt2[2];
2755
2756			$("#date_choide").text(dt1_str+"~"+dt2_str);
2757		}
2758		
2759
2760		booking.find_room();
2761	},
2762	
2763	sch_child_age: function(cnum, t) {
2764		var ids = $(t).attr("id");
2765		var str = ids.split("child");
2766		var ids_new = "cbox_"+str[1];			
2767		$.ajax({
2768			url : "/home/reservation2/exp_state.php",
2769			type: "post",
2770			data: "mode=child_age&cnum="+cnum+"&rtr="+ids_new,
2771			cache: false,
2772			success: function(data) {
2773				$("."+ids_new).remove();
2774				$("#"+ids_new+" tr:last").after(data);
2775
2776				booking.find_room();
2777			}
2778		});		
2779	},
2780	
2781	rstep1: function() {
2782		var scont = $("input[name='sang']:checked").length;
2783		if(scont < 1) {
2784			alert("객실선택은 필수입니다.");
2785			return;
2786		}
2787
2788		$("#rform").submit();
2789	},
2790	
2791	pkg_click: function(p_no) {
2792		$.ajax({
2793			url : "/home/reservation2/state.php",
2794			type: "post",
2795			data: "mode=pkg_layer&facil_no="+p_no,
2796			success: function(data) {
2797				$("#pkg_pop").html(data);
2798				utils.basic_l_on('pkg_pop');
2799			}
2800		});
2801	},
2802	
2803	rcalender: function(ts, val, mode) {
2804		if($("."+val+"_calender").hasClass("c_on") == true && mode == 'close') {
2805			$("."+val+"_calender").slideUp('400');
2806			$("."+val+"_calender").html('');
2807			$("."+val+"_calender").removeClass("c_on");
2808			$("."+val+"_calender").css("border-bottom", "none");
2809			$("#"+val+"_bt").attr("href", "javascript:booking.rcalender('"+ts+"', '"+val+"', 'open')");
2810		} else {
2811			var _val = $("input[name='"+val+"']").val();
2812			var ex = _val.split(".");
2813			pts = ex[0]+"-"+ex[1]+"-"+ex[2];	
2814			
2815			var pno = $("#p_no").val();
2816			var sno = $("#sang").val();
2817			$.ajax({
2818				url : "/home/reservation2/rsv_calender.php",
2819				data: "ts="+ts+"&val="+val+"&mode="+mode+"&pts="+pts+"&p_no="+pno+"&sang="+sno,
2820				type: "post",
2821				success: function(data) {
2822					$("."+val+"_calender").html(data);
2823					$("."+val+"_calender").slideDown('400');
2824					$("."+val+"_calender").addClass("c_on");
2825					$("."+val+"_calender").css("border-bottom", "1px solid #d2d2d2");
2826					$("#"+val+"_bt").attr("href", "javascript:booking.rcalender('"+ts+"', '"+val+"', 'close')");
2827				}
2828			});
2829		}
2830	},
2831	
2832	rchoice: function(val, sdate, ndate) {
2833		$("input[name='"+val+"']").val(sdate);
2834		$("."+val+"_cal_table .red_bg").removeClass("red_bg");
2835	
2836		var ex = sdate.split(".");
2837		var _ex = ex[0]+ex[1]+ex[2];
2838		var _ex2 = ex[0]+"-"+ex[1]+"-"+ex[2];
2839
2840		$("."+val+"_cal_table #date_"+_ex).addClass("red_bg");
2841		$("."+val+"_cal_table #date_"+_ex+" a").addClass("font_white");
2842		
2843		//체크아웃날짜를 자동세팅 
2844		if(val == "hseldate") {
2845			booking.rcalender(_ex2, 'hseldate', 'close');
2846			var ex2 = ndate.split("-");
2847			var _ex2 = ex2[0]+"."+ex2[1]+"."+ex2[2];
2848			$("input[name='nseldate']").val(_ex2);
2849			booking.rcalender(ndate, 'nseldate', 'nset');
2850
2851			booking.mchoice_check();
2852		} else {
2853			var res = booking.mdate_chk();
2854			if(res == true) {
2855				booking.mchoice_check();
2856				booking.rcalender(_ex2, 'nseldate', 'close');
2857			} else if(res == false) {
2858				alert("fail");
2859			}
2860		}
2861	},
2862
2863	rcalender_new: function(ts, val, mode) {
2864		if($("."+val+"_calender").hasClass("c_on") == true && mode == 'close') {
2865			$("."+val+"_calender").slideUp('400');
2866			$("."+val+"_calender").html('');
2867			$("."+val+"_calender").removeClass("c_on");
2868			$("."+val+"_calender").css("border-bottom", "none");
2869			$("#"+val+"_bt").attr("href", "javascript:booking.rcalender_new('"+ts+"', '"+val+"', 'open')");
2870		} else {
2871			var _val = $("input[name='"+val+"']").val();
2872			var ex = _val.split(".");
2873			pts = ex[0]+"-"+ex[1]+"-"+ex[2];	
2874			
2875			var pno = $("#p_no").val();
2876			//var sno = $("#sang").val();
2877			var sno = $("input[name='sang']:checked").val();
2878			$.ajax({
2879				url : "/home/reservation2/rsv_calender_new.php",
2880				data: "ts="+ts+"&val="+val+"&mode="+mode+"&pts="+pts+"&p_no="+pno+"&sang="+sno+"&res_type2="+$("#res_type2").val(),
2881				type: "post",
2882				success: function(data) {
2883					$("."+val+"_calender").html(data);
2884					$("."+val+"_calender").slideDown('400');
2885					$("."+val+"_calender").addClass("c_on");
2886					$("."+val+"_calender").css("border-bottom", "1px solid #d2d2d2");
2887					$("#"+val+"_bt").attr("href", "javascript:booking.rcalender_new('"+ts+"', '"+val+"', 'close')");
2888				}
2889			});
2890		}
2891	},
2892
2893	rchoice_new: function(val, sdate, ndate) {
2894		$("input[name='hseldate_sub']").val(sdate);
2895
2896		$("input[name='hseldate']").val(sdate);
2897		$("input[name='nseldate']").val(sdate);
2898
2899		$("."+val+"_cal_table .red_bg").removeClass("red_bg");
2900	
2901		var ex = sdate.split(".");
2902		var _ex = ex[0]+ex[1]+ex[2];
2903		var _ex2 = ex[0]+"-"+ex[1]+"-"+ex[2];
2904
2905		$("."+val+"_cal_table #date_"+_ex).addClass("red_bg");
2906		$("."+val+"_cal_table #date_"+_ex+" a").addClass("font_white");
2907		
2908		booking.rcalender_new(_ex2, val, 'close');
2909		go_price_calc();
2910	},
2911	
2912	mchoice_check: function() {
2913		var string = $("#rform").serialize();
2914		$.ajax({
2915			url : "state.php",
2916			type: "post",
2917			data: "mode=mchoice_check&"+string,
2918			success: function(data) {
2919				$("#select_info").html(data);
2920			}
2921		});
2922	},
2923	
2924	mdate_chk: function() {
2925		var hsel = $("#hseldate").val();
2926		var nsel = $("#nseldate").val();
2927		var p_no = $("#p_no").val();
2928		var r_no = $("#sang").val();
2929
2930		var de_s = $("#default_sdate").val();
2931		var de_e = $("#default_edate").val();
2932		var de_s2 = $("#default_sdate2").val();
2933		var de_e2 = $("#default_edate2").val();
2934
2935		var abr = $("#abr").val();
2936		if(typeof abr == 'undefined') {
2937			abr = "";
2938			var md = "date_chk";
2939		} else {
2940			var md = "date_chk_abr";
2941		}
2942
2943		$.ajax({
2944			url : "/home/reservation2/state.php",
2945			type : "post",
2946			data : "mode="+md+"&hsel="+hsel+"&nsel="+nsel+"&p_no="+p_no+"&r_no="+r_no,
2947			cache : false,
2948			success: function(data) {
2949				
2950				var res = data.split("^^");
2951				if(res[2] == "ok") {
2952					booking.mchoice_check();	
2953
2954					var ex2 = nsel.split(".");
2955					var _ex2 = ex2[0]+"-"+ex2[1]+"-"+ex2[2];
2956
2957					booking.rcalender(_ex2, 'nseldate', 'close');
2958
2959					return true;
2960				} else {
2961					$("#hseldate").val(de_s);
2962					$("#nseldate").val(de_e);
2963					
2964
2965					booking.rcalender(de_e2, 'nseldate', 'close');
2966					booking.rcalender(de_s2, 'hseldate', 'open');
2967					
2968					booking.mchoice_check();
2969
2970					alert(res[2]);
2971					return false;
2972
2973					
2974
2975				}
2976			}
2977		});
2978	},
2979	
2980	choice_submit: function() {
2981		if(parseInt($("#night").val()) > 5) {
2982			alert("최대숙박일수는 5일입니다.");
2983			return;
2984		} 
2985		if(parseInt($("#night").val()) < 1) {
2986			alert("최소 1박이상은 선택해야 합니다.");
2987			return;
2988		}
2989		$("#rform").submit();
2990	},
2991	
2992	addsetting_change: function(p_no, hseldate) {
2993		var night = $("#night").val();
2994		$.ajax({
2995			url : "/home/reservation2/state.php",
2996			type : "post", 
2997			data: "mode=addsetting&p_no="+p_no+"&hseldate="+hseldate+"&night="+night+"&person="+$("#person").val()+"&r_no="+$("input[name='sang']:checked").val(),
2998			success: function(e) {
2999				$("#add_select").html(e);	
3000				booking.choice_check();
3001			}
3002		});
3003	},
3004	
3005	addbox_select: function() {
3006		var str = "성인 "+$("#adult1").val()+"인/소아 "+$("#child1").val()+"인";
3007		$("#addbox_text").text(str);
3008	},
3009
3010	final_chk: function(pno, login_chk) {
3011		$.ajax({
3012			url : "/home/reservation2/state.php",
3013			type : "post",
3014			data: "mode=final_chk&pno="+pno,
3015			success: function(data) {
3016				var res = data.split("||");
3017				if(res[0] == "no") {
3018					alert(res[1]);
3019					location.href=res[2];
3020					return;
3021				} else {
3022					switch(login_chk) {
3023						case "pay":		
3024							payments.payment_submit($("#_uflag").val(), $("#_res_type2").val());
3025							break;
3026						case "mobile_login":		
3027							booking.rstep1();
3028							break;
3029						case "mobile_no_login":		
3030							booking.prev_nlogin2('', '');
3031							break;
3032						case "login":		
3033							booking.choice_submit3('');	
3034							break;
3035						
3036						case "mobile_pay2":
3037							$("#payform").submit();
3038							break;
3039
3040						default:		
3041							booking.prev_nlogin2('', '');
3042							break;
3043
3044					}
3045				}
3046			}
3047		});
3048	},
3049
3050	usetime_sel: function(val) {
3051		var idx = $("#in_time option[value='"+val+"']").index();
3052
3053		$("#out_time option:eq("+idx+")").attr("selected", "selected");
3054	},
3055	
3056	usetime_select: function() {
3057		
3058		var seld = $("#hseldate").val();
3059		var p_no = $("#p_no").val();
3060		var sang = $("input[name='sang']:checked").val();
3061
3062		$.ajax({
3063			url : "/home/reservation2/state.php",
3064			data: "mode=usetime_select&date="+seld+"&pno="+p_no+"&rno="+sang,
3065			type : "post",
3066			success: function(e) {
3067				$("#time_td").html(e);
3068				
3069				booking.timelabel();
3070
3071				booking.choice_check();
3072			}
3073		});
3074	},
3075	
3076	timelabel: function() {
3077		var in_time		= $("#in_time").val();
3078		var out_time	= $("#out_time").val();
3079		
3080		if(typeof in_time != "undefined") {
3081			var in_time_str = $("#in_time option:selected").text();
3082		} else {
3083			var in_time_str = "";
3084		}
3085
3086		if(typeof out_time != "undefined") {
3087			var out_time_str = $("#out_time option:selected").text();
3088		} else {
3089			var out_time_str = "";
3090		}
3091
3092		if(in_time_str != "" && out_time_str == "") {
3093			var tmp = in_time.split("||");
3094			if(parseInt(tmp.length) > 1) {
3095				alert(tmp[1]);
3096			}
3097
3098			$("#time_label").val(in_time_str);
3099		} else {
3100			$("#time_label").val(in_time_str+"~"+out_time_str);
3101		}
3102	},
3103	
3104	up_num: function(max_num) {
3105		if(parseInt($("input[name=person]").val()) < max_num){
3106			var su2 = parseInt($("input[name=person]").val())+1;
3107			$("input[name=person]").val(su2);
3108
3109			rsv.choice_check();
3110			return;
3111		} else {
3112			alert("최대 "+max_num+"매까지 구매가능합니다.");
3113			return;
3114		}
3115	},
3116	
3117	down_num: function(min_num) {
3118		if(parseInt($("input[name=person]").val()) > min_num){
3119			var su2 = parseInt($("input[name=person]").val())-1;
3120			$("input[name=person]").val(su2);
3121
3122			rsv.choice_check();
3123			return;
3124		} else {
3125			alert("최소 "+min_num+"매 이상 구매해야합니다.");
3126			return;
3127		}
3128	}
3129}
3130
3131/* 결제하기 */
3132var payments = {
3133	use_point: function(fprice) {
3134		var imile = $("#use_mileage").val();
3135		$.ajax({
3136			type: "post",
3137			url : "/home/reservation2/state.php",
3138			data: "mode=mc_calc&imile="+imile+"&final_price="+fprice,
3139			cache: false,
3140			success: function(e) {
3141				var res = e.split("||");
3142				if(res[0] == "N") {
3143					alert(res[1]);
3144					$("#use_mileage").val("");
3145					//payment.mile_use_mob(fprice);
3146					return;
3147				} else {
3148
3149					//실제결제금액
3150					$("#final_price2").text(number_format(res[3])+"원");
3151
3152					$("#mcinfo").val(res[4]);
3153					$("#mc_price").val(res[3]);
3154					
3155					if(imile != "0" && imile != "") {
3156						$("#use_mile").val("Y");
3157					}
3158					if(imile == "0" || imile == "") {
3159						$("#final_mile").text("");	
3160					} else {
3161						$("#final_mile").text("-"+number_format(imile)+"원");	
3162					}
3163
3164					utils.out("#pop_point");
3165
3166				}
3167			}
3168		});
3169	},
3170	
3171	payment_submit : function(gubun, res_type) {
3172		if(gubun == "web") {
3173			if(!$("#reserve_name").val()){
3174				alert("예약자명을 입력해주세요.");
3175				$("#reserve_name").focus();
3176				return;
3177			}
3178
3179			if(!$("#stayname").val()){
3180				alert("투숙자명 입력해주세요.");
3181				$("#stayname").focus();
3182				return;
3183			}
3184		} else {
3185			if(!$("#reserve_name").val()){
3186				alert("투숙자명 입력해주세요.");
3187				$("#reserve_name").focus();
3188				return;
3189			}
3190			$("#stayname").val($("#reserve_name").val());
3191		}
3192		
3193		if(res_type == "expedia_a") {
3194			var j = 0;
3195			var j2 = 0;
3196			
3197			$("input[name='first[]']").each(function(i) {
3198				if($("input[name='first[]']").eq(i).val() != "") {
3199					j++;	
3200				}
3201			});
3202
3203			$("input[name='last[]']").each(function(i) {
3204				if($("input[name='last[]']").eq(i).val() != "") {
3205					j2++;
3206				}
3207			});
3208
3209			if(j == 0) {
3210				alert("투숙자명(영문)을 입력해주세요.");	
3211				$("input[name='first[]']").eq(0).focus();
3212				return;
3213			}
3214			
3215			if(j2 == 0) {
3216				alert("투숙자명(영문)을 입력해주세요.");	
3217				$("input[name='last[]']").eq(0).focus();
3218				return;
3219			}
3220		}
3221		
3222		//웹, 모바일 디자인 나뉘면서 분기
3223		if(gubun == "web") {
3224			if(!$("#tel1").val()){
3225				alert("연락처를 입력해주세요.");
3226				$("#tel1").focus();
3227				return;
3228			}
3229
3230			if(!$("#tel2").val()){
3231				alert("연락처를 입력해주세요.");
3232				$("#tel2").focus();
3233				return;
3234			}
3235
3236			if(!$("#tel3").val()){
3237				alert("연락처를 입력해주세요.");
3238				$("#tel3").focus();
3239				return;
3240			}
3241
3242			if(!$("#email1").val()){
3243				alert("이메일을 입력해주세요.");
3244				$("#email1").focus();
3245				return;
3246			}
3247
3248			if(!$("#email2").val()){
3249				alert("이메일을 입력해주세요.");
3250				$("#email2").focus();
3251				return;
3252			}
3253
3254			var email_host = /^((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/;
3255			if(email_host.test($("#email2").val()) == false){
3256				alert("이메일 형식에 맞게 입력해주세요.");
3257				$("#email2").focus();
3258				return;
3259			}
3260		} else {
3261			if(!$("#tel").val()){
3262				alert("연락처를 입력해주세요.");
3263				$("#tel").focus();
3264				return;
3265			}
3266
3267			if(!$("#email").val()){
3268				alert("이메일을 입력해주세요.");
3269				$("#email").focus();
3270				return;
3271			}
3272		}
3273
3274		var bank_on = "off";
3275		if($("input[name='pay_type']:checked").val() == 'va') {
3276			var bank_on = "on";
3277		}
3278
3279		if(bank_on == 'on') {
3280			if(!$("#refund_bank").val()){
3281				alert("은행명을 입력해주세요.");
3282				$("#refund_bank").focus();
3283				return;
3284			}
3285
3286			if(!$("#refund_name").val()){
3287				alert("예금주명을 입력해주세요.");
3288				$("#refund_name").focus();
3289				return;
3290			}
3291
3292			if(!$("#refund_number").val()){
3293				alert("계좌번호을 입력해주세요.");
3294				$("#refund_number").focus();
3295				return;
3296			}
3297		}
3298
3299		var mgubun = $("#_mgubun").val();
3300		if($("#_first").val() == "on") {
3301			if($("#cancel3").is(":checked") == false) {
3302				alert("이용약관에 동의해주세요.");
3303				$("#cancel3").focus();
3304				
3305				if($("#allchk").is(":checked") == false) {
3306					$("#allchk").prop("checked", true);
3307				}
3308				$("input[id^='cancel']").each(function(i) {
3309					if($("input[id^='cancel']").eq(i).is(":checked") == false) {
3310						$("input[id^='cancel']").eq(i).prop("checked", true);
3311					}
3312				});
3313			
3314				return;
3315			}
3316
3317			if($("#cancel4").is(":checked") == false) {
3318				alert("개인정보취급방침에 동의해주세요.");
3319				$("#cancel4").focus();
3320				
3321				if($("#allchk").is(":checked") == false) {
3322					$("#allchk").prop("checked", true);
3323				}
3324				$("input[id^='cancel']").each(function(i) {
3325					if($("input[id^='cancel']").eq(i).is(":checked") == false) {
3326						$("input[id^='cancel']").eq(i).prop("checked", true);
3327					}
3328				});
3329
3330				return;
3331			}
3332
3333			if($("#cancel1").is(":checked") == false) {
3334				alert("취소 및 환불규정에 동의해주세요.");
3335				$("#cancel1").focus();
3336				if($("#allchk").is(":checked") == false) {
3337					$("#allchk").prop("checked", true);
3338				}
3339				$("input[id^='cancel']").each(function(i) {
3340					if($("input[id^='cancel']").eq(i).is(":checked") == false) {
3341						$("input[id^='cancel']").eq(i).prop("checked", true);
3342					}
3343				});
3344				return;
3345			}
3346
3347			if($("#cancel2").is(":checked") == false) {
3348				alert("개인정보 제3자제공에 동의해주세요.");
3349				$("#cancel2").focus();
3350				if($("#allchk").is(":checked") == false) {
3351					$("#allchk").prop("checked", true);
3352				}
3353				$("input[id^='cancel']").each(function(i) {
3354					if($("input[id^='cancel']").eq(i).is(":checked") == false) {
3355						$("input[id^='cancel']").eq(i).prop("checked", true);
3356					}
3357				});
3358				return;
3359			}
3360		}
3361		
3362		if(gubun == "web") {
3363			if($("input[name='pay_type']:checked").val() == 'bank') {
3364				$("form[name='rent_fix']").attr("action", "/home/reservation2/state.php").submit();
3365			} else {
3366				//변경사유 ./state에
3367				$.ajax({
3368					type	:	"POST",
3369					data	:	$("form[name='rent_fix']").serialize(),
3370					url		:	"/state.php",
3371					success	:	function(e) {
3372						$("#script_div").html(e);
3373					}
3374				});
3375				ww = window.open("", "payment", "toolbar=no,scrollbars=yes,directories=no,status=no,menubar=no,width=400,height=650,resizable=yes, top=50, left="+((screen.width - 450)/2)+"");
3376				//$("form[name='rent_fix']").attr({"target": "payment", "action": "http://pay."+base_url+"/pay_total.php"}).submit();
3377				$("form[name='rent_fix']").attr({"target": "payment", "action": "/home/reservation2/pay_total.php"}).submit();
3378				ww.focus();
3379			}
3380		} else {
3381			$("form[name='rent_fix']").submit();
3382		}
3383	}
3384}
3385
3386
3387$(function() {
3388	$(window).scroll(function() {
3389		$(window).scrollTop() >= 700 ? $('.sideBanner-wrap').show() : $('.sideBanner-wrap').hide()
3390	})
3391})

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.