﻿/// <reference path="Justgo.js" />
/// <reference path="jquery-1.3.2-vsdoc.js" />
/// <reference path="miya_validator.js" />

function IsValidUserID(el, value) {
	var pattern = /^[a-zA-Z]{1}[a-zA-Z0-9\-_]+$/;
	return (pattern.test(el.value)) ? true : "\n첫글자는 영문으로 시작해야하고,\n 그 이후에는 영문,숫자, -, _ 문자만 사용할 수 있습니다.";
}
function IsValidOnlyEng(el, value) {
	var pattern = /^[a-zA-Z]+$/;
	return (pattern.test(el.value)) ? true : "반드시 영문자로만 입력해야 합니다.";
}
function IsValidOnlyEngNum(el, value) {
	var pattern = /^[a-zA-Z0-9]+$/;
	return (pattern.test(el.value)) ? true : "반드시 영문,숫자로만 입력해야 합니다.";
}
function IsValidOnlyHanEng(el, value) {
	var pattern = /^[가-힣a-zA-Z]+$/;
	return (pattern.test(el.value)) ? true : "반드시 한글,영문자로만 입력해야 합니다.";
}
function IsValidOnlyEngNum2(el, value) {
    var pattern = /^[a-zA-Z0-9\s]+$/;
    return (pattern.test(el.value)) ? true : "반드시 영문,숫자,공백으로만 입력해야 합니다.";
}
// 통합사이트 검색용(For UserControl)
function doOmniAirSearch(evt) {
	if ((evt && event.keyCode == 13) || !evt) {
		var v = document.all.pKEYWORD;
		if (!isNull(v)) {
			alert('검색어를 입력하세요!!');
			v.focus();
			return false;
		}
		if (!EjtctKeyword(v)) {
			return false;
		}
		location.href = "/Tour/chSearch/search_main.aspx?pSTYPE=main&pKEYWORD=" + v.value;
		return false;
	}
}

///플래쉬파일 
function Airflash(strCtlID, strPath, intWidth, intHeight, strFlashVars, strStyleText) {
	var strHTML = "";

	try {
		strHTML += "<object name='" + strCtlID + "' id='" + strCtlID + "' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0' width='" + intWidth + "' height='" + intHeight + "'>";
		strHTML += "<param name='WMode' value='' />";
		strHTML += "<param name='Movie' value='" + strPath + "' />";
		strHTML += "<param name='Src' value='" + strPath + "' />";
		if ((strFlashVars != undefined) && (strFlashVars != null) && (strFlashVars.trim().length > 0)) {
			strHTML += "<param name='FlashVars' value='" + strFlashVars + "'>";
		}
		strHTML += "<param name='Quality' value='High' />";
		strHTML += "<param name='AllowScriptAccess' value='sameDomain' />";
		strHTML += "<param name='BGColor' value='#ffffff' />";
		strHTML += "<embed id='" + strCtlID + "' src='" + strPath + "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" + intWidth + "' height='" + intHeight + "' flashvars='" + ((strFlashVars != undefined) && (strFlashVars != null) && (strFlashVars.trim().length > 0) ? strFlashVars : "") + "'></embed>";
		strHTML += "</object>";

		strHTML = "<div id='" + strCtlID + "_Container' style='" + strStyleText + ";'>" + strHTML + "</div>";
		echo(strHTML);
	} catch (e) {
		OnErrorHandler(e);
	}
}

function doToggleImg(obj) {
	if (obj == "divReserveRule") {
		document.getElementById("tab1").src = "/img/wholesale_air/air/mypage_tab_on_01.gif";
		document.getElementById("tab2").src = "/img/wholesale_air/air/mypage_tab_off_02.gif";
		document.getElementById("tab3").src = "/img/wholesale_air/air/mypage_tab_off_03.gif";
		document.getElementById("tab4").src = "/img/wholesale_air/air/mypage_tab_off_04.gif";

		document.getElementById("divReserveRule").style.display = "block";
		document.getElementById("divIssueRule").style.display = "none";
		document.getElementById("divRefundRule").style.display = "none";
		document.getElementById("divAgentRule").style.display = "none";
	} else if (obj == "divIssueRule") {
	    document.getElementById("tab1").src = "/img/wholesale_air/air/mypage_tab_off_01.gif";
	    document.getElementById("tab2").src = "/img/wholesale_air/air/mypage_tab_on_02.gif";
	    document.getElementById("tab3").src = "/img/wholesale_air/air/mypage_tab_off_03.gif";
	    document.getElementById("tab4").src = "/img/wholesale_air/air/mypage_tab_off_04.gif";

		document.getElementById("divReserveRule").style.display = "none";
		document.getElementById("divIssueRule").style.display = "block";
		document.getElementById("divRefundRule").style.display = "none";
		document.getElementById("divAgentRule").style.display = "none";
	} else if (obj == "divRefundRule") {
	    document.getElementById("tab1").src = "/img/wholesale_air/air/mypage_tab_off_01.gif";
	    document.getElementById("tab2").src = "/img/wholesale_air/air/mypage_tab_off_02.gif";
	    document.getElementById("tab3").src = "/img/wholesale_air/air/mypage_tab_on_03.gif";
	    document.getElementById("tab4").src = "/img/wholesale_air/air/mypage_tab_off_04.gif";

		document.getElementById("divReserveRule").style.display = "none";
		document.getElementById("divIssueRule").style.display = "none";
		document.getElementById("divRefundRule").style.display = "block";
		document.getElementById("divAgentRule").style.display = "none";
	} else if (obj == "divAgentRule") {
	    document.getElementById("tab1").src = "/img/wholesale_air/air/mypage_tab_off_01.gif";
	    document.getElementById("tab2").src = "/img/wholesale_air/air/mypage_tab_off_02.gif";
	    document.getElementById("tab3").src = "/img/wholesale_air/air/mypage_tab_off_03.gif";
	    document.getElementById("tab4").src = "/img/wholesale_air/air/mypage_tab_on_04.gif";

		document.getElementById("divReserveRule").style.display = "none";
		document.getElementById("divIssueRule").style.display = "none";
		document.getElementById("divRefundRule").style.display = "none";
		document.getElementById("divAgentRule").style.display = "block";
	}
}
function doToggleValidation(style, style1, style2, style3) {
	document.all.trValidation.style.display = style;
	document.all.tblValidation.style.display = style1;
	document.all.tblValidation2.style.display = style2;
	document.all.tblValidation3.style.display = style3;
}
function navi_flash(m, n) {
	navi_html = '';
	navi_html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" height="55" width="550">';
	navi_html += '<param name="movie" value="/OMNIAir/flash/navi.swf">';
	navi_html += '<param name="quality" value="high">';
	navi_html += '<param name="FlashVars" value="m=' + m + '&s=' + n + '">';
	navi_html += '<param name="wmode" value="transparent" />';
	navi_html += '<embed pluginspage="http://www.macromedia.com/go/getflashplayer" quality="high" src="/OMNIAir/flash/navi.swf" type="application/x-shockwave-flash" height="55" width="550"></embed>';
	navi_html += '<\/object>';
	echo(navi_html);
}
function navi_flash(m, n, SiteUrl) {
	navi_html = '';
	navi_html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" height="55" width="550">';
	navi_html += '<param name="movie" value="' + SiteUrl + 'OMNIAir/flash/navi.swf">';
	navi_html += '<param name="quality" value="high">';
	navi_html += '<param name="FlashVars" value="m=' + m + '&s=' + n + '">';
	navi_html += '<param name="wmode" value="transparent" />';
	navi_html += '<embed pluginspage="http://www.macromedia.com/go/getflashplayer" quality="high" src="' + SiteUrl + 'OMNIAir/flash/navi.swf" type="application/x-shockwave-flash" height="55" width="550"></embed>';
	navi_html += '<\/object>';
	echo(navi_html);
}
function OMNISearchResizeSWF(value) {
	var objCtl = document.getElementById("AirScheduleSearch");
	if (eval(objCtl)) {
		objCtl.height = parseInt(value);
	}
}
function OMNISearchScrollTopMove() {
	window.scrollTo(0, 0);
}
function OMNISearchSize(size) {
	var objCtl = document.getElementById("OMNISearchFlash");
	if (eval(objCtl)) {
		objCtl.style.width = size;
	}
}
function OMNISearchFocusIn() {
	if (window.ActiveXObject) {
		document.body.onmousewheel = OMNISearchDisableWheel;
	} else {
		document.addEventListener('DOMMouseScroll', OMNISearchDisableWheel, false);
	}
}
function OMNISearchDisableWheel(e) {
	if (!window.ActiveXObject) {
		e.preventDefault();
	}
	return false;
}
function OMNISearchFocusOut() {
	if (window.ActiveXObject) {
		document.body.onmousewheel = null;
	} else {
		document.removeEventListener('DOMMouseScroll', OMNISearchDisableWheel, false);
	}
}
/*| /chReserve/reserve_login.aspx |**************************************************************************/
function chReserve_reserve_login_onSubmit(objForm) {
	// 회원 로그인 여부, true면 회원 로그인, false면 비회원 로그인
	var isMemberLogin = ($('#LoginType').attr("value") == "1");
	// Valivator initialize
	var mv = new MiyaValidator(objForm);

	if (isMemberLogin) {
		mv.add("txtUsrID", { trim: true, required: true, option: "UserID", minbyte: 5, maxbyte: 20 }, "아이디");
		mv.add("txtUsrPW", { trim: true, required: true, minbyte: 4, maxbyte: 20 }, "비밀번호");

		if (mv.validate()) {
			CommonAjaxCallByForm(objForm, null, chReserve_reserve_login_onSubmitSuccess);
		} else {
			alert(mv.getErrorMessage());
			mv.getErrorElement().focus();
		}
	} else {
		mv.add("txtUsrName", { trim: true, required: true, option: "OnlyHanEng", minbyte: 4, maxbyte: 20 }, "이름");
		mv.add("txtUsrEMail", { trim: true, required: true, option: "email", minbyte: 4, maxbyte: 100 }, "이메일");
		mv.add("txtUsrPW2", { trim: true, required: true, minbyte: 4, maxbyte: 20 }, "비밀번호");

		if (eval(document.getElementById("txtUsrPW2"))) {
			if (mv.validate()) {
				CommonAjaxCallByForm(objForm, null, chReserve_reserve_login_onSubmitSuccess);
			} else {
				alert(mv.getErrorMessage());
				mv.getErrorElement().focus();
			}
		} else {
			if (eval(document.getElementById("RedirectURL"))) {
				document.location.replace(document.getElementById("RedirectURL").value);
			}
		}
	}

	return false;
}
function chReserve_reserve_login_onSubmitSuccess(transport) {
	SetDisableProgressBar();
	var res = transport.split('|');

	if ((res != undefined) && (res.length > 1) && (res[0] == "1")) {
		//alert(res[1]);
		if (eval(document.getElementById("RedirectURL"))) {
			document.location.replace(document.getElementById("RedirectURL").value);
		} else if (eval(document.getElementById("UsePageReload"))) {
			document.location.replace(document.location);
		}
	} else {
		alert(transport);
	}
}
function SetLoginType(iLoginType) {
	$('#LoginType').attr("value", iLoginType);
}
function openSearchID(strDomain) {
	SetCenterPopup(strDomain + "/Tour/chMember/popupSearchID.aspx", "popup_searchid", 500, 238, "no");
}
function openSearchPW(strDomain) {
	SetCenterPopup(strDomain + "/Tour/chMember/popupSearchPW.aspx", "popup_searchid", 500, 334, "no");
}

/************************************************************************************************************/
/*| /chReserve/reserve_passenger.aspx |**********************************************************************/
/*addOnloadEvent(chreserve_reserve_passenger_Onload);
function chreserve_reserve_passenger_Onload() {
	var strCtlIdPrefix = "ctl00_ctl00_CPHBody02_CPHBody02_"; // 컨트롤 ID 접미사
	var iPCnt = jQuery("#PCnt").val();
	try {
		if (eval(document.getElementById("tblPassengerInfoInput"))) {
			for (var i = 0; i < iPCnt; i++) {
				$("#txtPassengerEnFstName" + i).change(function() { $(this).val(this.value.ToUpper().replaceAll(" ", "")); }).change();
				$("#txtPassengerEnLstName" + i).change(function() { $(this).val(this.value.ToUpper().replaceAll(" ", "")); }).change();
			}

		}
	} catch (e) {
		OnErrorHandler(e);
	}
}
function chReserve_reserve_passenger_onSubmit(objForm) {
	var strParam = "";
	var strCtlIdPrefix = "ctl00_ctl00_CPHBody02_CPHBody02_"; // 컨트롤 ID 접미사
	var cbAgreement = document.getElementById("cbAgreement");
	var iPCnt = $("#PCnt").val();
	var sTmpPType = "ADT";
	var sTmpPBirth = "";
	var sTmpPBirthLimit = "";
	var sTmpPBirthLimit2 = "";
	// Valivator initialize
	var mv = new MiyaValidator(objForm);

	// Cutomer infomation(예약자 정보)
	mv.add(strCtlIdPrefix + "txtCustomerName", { trim: true, required: true, option: "OnlyHanEng", minbyte: 2, maxbyte: 20 }, "예약자 성명 (Customer name)");
	mv.add(strCtlIdPrefix + "txtCustomerPhone21", { trim: true, required: true, option: "handphone", span: 3, glue: "-" }, "휴대전화 (Customer cell phone)");
	mv.add(strCtlIdPrefix + "txtCustomerEMail", { trim: true, required: true, option: "email", minbyte: 5, maxbyte: 100 }, "이메일 (Customer E-Mail address)");
	mv.add(strCtlIdPrefix + "txtCustomerPhone11", { trim: true, required: true, option: "homephone", span: 3, glue: "-" }, "일반전화 (Customer home or office phone)");

	if (eval(document.getElementById(strCtlIdPrefix + "txtCustomerPassword1"))) {
		mv.add(strCtlIdPrefix + "txtCustomerPassword1", { trim: true, required: true, minbyte: 4, maxbyte: 20 }, "비밀번호 (Customer password)");
		mv.add(strCtlIdPrefix + "txtCustomerPassword2", { trim: true, required: true, match: strCtlIdPrefix + "txtCustomerPassword2" }, "비밀번호확인 (Customer password confirm)");
	}

	// Passenger infomation(탑승자 정보)
	for (var i = 0; i < iPCnt; i++) {
		mv.add("txtPassengerEnLstName" + i, { trim: true, required: true, option: "engonly", minbyte: 2, maxbyte: 20 }, "탑승자 " + (i + 1) + "의 영문 성(Passenger " + (i + 1) + "'s English last name)");
		mv.add("txtPassengerEnFstName" + i, { trim: true, required: true, option: "engonly", minbyte: 2, maxbyte: 20 }, "탑승자 " + (i + 1) + "의 영문 이름(Passenger " + (i + 1) + "'s English first name)");
	}
	if (mv.validate()) {
		for (var i = 0; i < iPCnt; i++) {
			sTmpPType = $("#PassengerType" + i).val();
			sTmpPBirthLimit = $("#" + sTmpPType + "LimitDT").val();

			sTmpPBirth = $("#ddlPassengerBirthYear" + i).val();
			if ($("#ddlPassengerBirthMonth" + i).val() < 10) {
				sTmpPBirth += "0" + $("#ddlPassengerBirthMonth" + i).val();
			} else {
				sTmpPBirth += $("#ddlPassengerBirthMonth" + i).val();
			}
			if ($("#ddlPassengerBirthDay" + i).val() < 10) {
				sTmpPBirth += "0" + $("#ddlPassengerBirthDay" + i).val();
			} else {
				sTmpPBirth += $("#ddlPassengerBirthDay" + i).val();
			}

			if (sTmpPType == "ADT") { // 성인
				if (sTmpPBirth >= sTmpPBirthLimit) {
					alert("성인은 " + sTmpPBirthLimit.substr(0, 4) + "년 " + sTmpPBirthLimit.substr(4, 2) + "월 " + sTmpPBirthLimit.substr(6, 2) + "일 이전 출생자이어야 합니다.");
					$("#ddlPassengerBirthYear" + i).focus();
					return false;
				}
			} else if (sTmpPType == "CNN") { // 소아
				sTmpPBirthLimit2 = $("#INFLimitDT").val();
				if ((sTmpPBirth < sTmpPBirthLimit) || (sTmpPBirth >= sTmpPBirthLimit2)) {
					sTmpPBirth = "소아는 ";
					sTmpPBirth += sTmpPBirthLimit.substr(0, 4) + "년 ";
					sTmpPBirth += sTmpPBirthLimit.substr(4, 2) + "월 ";
					sTmpPBirth += sTmpPBirthLimit.substr(6, 2) + "일 ~ ";
					sTmpPBirth += sTmpPBirthLimit2.substr(0, 4) + "년 ";
					sTmpPBirth += sTmpPBirthLimit2.substr(4, 2) + "월 ";
					sTmpPBirth += (sTmpPBirthLimit2.substr(6, 2) - 1) + "일 사이 출생자이어야 합니다.";
					alert(sTmpPBirth);
					$("#ddlPassengerBirthYear" + i).focus();
					return false;
				}
			} else { // 유아
				if (sTmpPBirth <= sTmpPBirthLimit) {
					alert("유아는 " + sTmpPBirthLimit.substr(0, 4) + "년 " + sTmpPBirthLimit.substr(4, 2) + "월 " + sTmpPBirthLimit.substr(6, 2) + "일 이후 출생자이어야 합니다.");
					$("#ddlPassengerBirthYear" + i).focus();
					return false;
				}
			}
		}
		if (eval(cbAgreement)) {
			if (cbAgreement.checked) {
				$("#ProcessMode").val("s");
				CommonAjaxCallByForm(objForm, null, chReserve_reserve_passenger_onSubmitSuccess);
			} else {
				alert("이용 규정에 동의 하셔야 합니다.");
				cbAgreement.focus();
			}
		}
	} else {
		alert(mv.getErrorMessage());
		mv.getErrorElement().focus();
	}
	return false;
}
function chReserve_reserve_passenger_onSubmitSuccess(transport) {
	SetDisableProgressBar();
	var res = transport.split('|');
	
	if (transport == "1") { // 정상
		document.location.replace("reserve_finish.aspx");
		//alert("정상");
	} else if ((res != undefined) && (res.length > 1) && (res[0].indexOf("GDSERR")>-1)) {
		location.replace("../Inc/ErrPage/CrsErr.aspx?ec=" + escape(res[1]) + "&em=" + escape(res[2]));
	} else { // 오류
		alert(transport);
	}
}*/
/************************************************************************************************************/
/*| /chSearch/search_list.aspx |*****************************************************************************/
function SetSelectedSchedule(arg1, arg2, arg3, arg4) {
	if (IsDebugMode) {
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML = "arg1 is " + arg1;
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />arg2 is " + arg2;
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />arg3 is " + arg3;
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />arg4 is " + arg4;
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />";
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />$(arg1).attr('id') is " + $(arg1).attr('id');
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />$(arg1).attr('name') is " + $(arg1).attr('name');
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />$(arg1).attr('value') is " + $(arg1).attr('value');
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />$(arg1).val() is " + $(arg1).val();
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />$(`input[name='cb" + arg2 + "Routing']:checked`).val() is " + $("input[name='cb" + arg2 + "Routing']:checked").val();
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />$(`input[name='cbOutboundRouting']:checked`).val() is " + $("input[name='cbOutboundRouting']:checked").val();
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />$(`input[name='cbInboundRouting']:checked`).val() is " + $("input[name='cbInboundRouting']:checked").val();
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />";
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />$(arg1).parent().attr('id') is " + $(arg1).parent().attr('id');
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />$(arg1).parent().attr('class') is " + $(arg1).parent().attr('class');
	}
	var sOutboundServiceFareMstCD = $("input[name='cbOutboundRouting']:checked").val();
	var sInboundServiceFareMstCD = $("input[name='cbInboundRouting']:checked").val();

	try {
		sInboundServiceFareMstCD = (sInboundServiceFareMstCD == undefined) ? sOutboundServiceFareMstCD : sInboundServiceFareMstCD;

		if (sOutboundServiceFareMstCD == undefined) {
			alert("출국 여정을 먼저 선택 하세요");
			$("input[name='cbInboundRouting']:checked").attr("checked", function() { return false; });
		} else if (sInboundServiceFareMstCD != sOutboundServiceFareMstCD) {
			alert("같은 운임의 여정을 선택 하세요");
			$("input[name='cbInboundRouting']:checked").attr("checked", function() { return false; });
		} else {
			$("div[id^='pnlRoutingItem_" + arg2 + "']").css("background-color", "white");
			$(arg1).parent().css("background-color", "#ddd");
		}
	} catch (e) {
		OnErrorHandler(e);
	}
	if (IsDebugMode) {
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />";
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />sInboundServiceFareMstCD is " + sInboundServiceFareMstCD;
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />sOutboundServiceFareMstCD is " + sOutboundServiceFareMstCD;
	}
}
function chSearch_search_list_onSubmit(objForm) {
	if (IsDebugMode) {
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML = "<br />$(`input[name='cbOutboundRouting']:checked`).val() is " + $("input[name='cbOutboundRouting']:checked").val();
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />$(`input[name='cbInboundRouting']:checked`).val() is " + $("input[name='cbInboundRouting']:checked").val();
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />";
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />$(`input[name='cbInboundRouting']:checked`).attr('id') is " + $("input[name='cbInboundRouting']:checked").attr('id');
	}
	var sOutboundServiceFareMstCD = $("input[name='cbOutboundRouting']:checked").val();
	var sInboundServiceFareMstCD = $("input[name='cbInboundRouting']:checked").val();
	var sTmpSelectedCtlID = $("input[name='cbInboundRouting']:checked").attr('id').split("_");
	var sCtlIDSufix_Outbound = "_" + sOutboundServiceFareMstCD + "_Outbound_" + sTmpSelectedCtlID[1] + "_" + sTmpSelectedCtlID[2];
	var sCtlIDSufix_Inbound = "_" + sOutboundServiceFareMstCD + "_Inbound_" + sTmpSelectedCtlID[1] + "_" + sTmpSelectedCtlID[2];

	try {
		if (sOutboundServiceFareMstCD == undefined) {
			alert("출국 여정을 먼저 선택 하세요");
		} else if (sInboundServiceFareMstCD == undefined) {
			alert("귀국 여정을 먼저 선택 하세요");
		} else if (sInboundServiceFareMstCD != sOutboundServiceFareMstCD) {
			alert("같은 운임의 여정을 선택 하세요");
			$("input[name='cbInboundRouting']:checked").attr("checked", function() { return false; });
		} else if ((sTmpSelectedCtlID[1] == undefined) || (sTmpSelectedCtlID[2] == undefined)) {
			alert("잘못된 접근 입니다.");
		} else {
			$("#SFCD").val(sOutboundServiceFareMstCD);
			$("#DepCD").val($("#DepCD" + sCtlIDSufix_Outbound).val() + $("#DepCD" + sCtlIDSufix_Inbound).val());
			$("#DepDT").val($("#DepDT" + sCtlIDSufix_Outbound).val() + $("#DepDT" + sCtlIDSufix_Inbound).val());
			$("#ArrCD").val($("#ArrCD" + sCtlIDSufix_Outbound).val() + $("#ArrCD" + sCtlIDSufix_Inbound).val());
			$("#ArrDT").val($("#ArrDT" + sCtlIDSufix_Outbound).val() + $("#ArrDT" + sCtlIDSufix_Inbound).val());
			$("#ACD").val($("#ACD" + sCtlIDSufix_Outbound).val() + $("#ACD" + sCtlIDSufix_Inbound).val());
			$("#FN").val($("#FN" + sCtlIDSufix_Outbound).val() + $("#FN" + sCtlIDSufix_Inbound).val());
			$("#FC").val($("#FC" + sCtlIDSufix_Outbound).val() + $("#FC" + sCtlIDSufix_Inbound).val());
			$("#MCD").val($("#MCD_" + sOutboundServiceFareMstCD).val());
			$("#GDS").val($("#GDS_" + sOutboundServiceFareMstCD).val());
			$("#RSCD").val($("#RSCD" + sCtlIDSufix_Outbound).val() + $("#RSCD" + sCtlIDSufix_Inbound).val());
			$("input[name='cbOutboundRouting']:checked").attr("checked", function() { return false; });
			$("input[name='cbInboundRouting']:checked").attr("checked", function() { return false; });

			//location.replace('../chReserve/reserve_passenger.aspx?'+$("#" + objForm.getAttribute("id")).find("input,textarea,select,hidden").not("[type=hidden][name^=__]").serialize());
			DeleteASPNETViewState(objForm);
			objForm.action = "../chReserve/reserve_passenger.aspx";
			return true;
		}
	} catch (e) {
		OnErrorHandler(e);
	}

	if (IsDebugMode) {
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />";
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />sCtlIDSufix_Outbound is " + sCtlIDSufix_Outbound;
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />sCtlIDSufix_Inbound is " + sCtlIDSufix_Inbound;
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />$('#DepDT' + sCtlIDSufix_Outbound).val() is " + $("#DepDT" + sCtlIDSufix_Outbound).val();
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />$('#DepDT' + sCtlIDSufix_Inbound).val() is " + $("#DepDT" + sCtlIDSufix_Inbound).val();
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />'MCD_' + sOutboundServiceFareMstCD is " + "MCD_" + sOutboundServiceFareMstCD;
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />$('#MCD_' + sOutboundServiceFareMstCD).val() is " + $('#MCD_' + sOutboundServiceFareMstCD).val();
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />";
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />sTmpSelectedCtlID[0] is " + sTmpSelectedCtlID[0];
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />sTmpSelectedCtlID[1] is " + sTmpSelectedCtlID[1];
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />sTmpSelectedCtlID[2] is " + sTmpSelectedCtlID[2];
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />sTmpSelectedCtlID[3] is " + sTmpSelectedCtlID[3];
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />sTmpSelectedCtlID[4] is " + sTmpSelectedCtlID[4];
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />sTmpSelectedCtlID[5] is " + sTmpSelectedCtlID[5];
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />";
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />$('#SFCD').val() = " + $("#SFCD").val();
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />$('#DepCD').val() = " + $("#DepCD").val();
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />$('#DepDT').val() = " + $("#DepDT").val();
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />$('#ArrCD').val() = " + $("#ArrCD").val();
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />$('#ArrDT').val() = " + $("#ArrDT").val();
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />$('#ACD').val() = " + $("#ACD").val();
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />$('#FN').val() = " + $("#FN").val();
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />$('#FC').val() = " + $("#FC").val();
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />$('#MCD').val() = " + $("#MCD").val();
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />$('#GDS').val() = " + $("#GDS").val();
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />$('#RSCD').val() = " + $("#RSCD").val();
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />";
		document.getElementById("ctl00_ctl00_lblErrMsg").innerHTML += "<br />objForm.serialize() = " + $("#" + objForm.getAttribute("id")).find("input,textarea,select,hidden").not("[type=hidden][name^=__]").serialize();
	}

	return false;
}
/************************************************************************************************************/
/*| /chMyJustgo/my_reserve_detail.aspx |*********************************************************************/
function chMyJustgo_my_reserve_detail_btnPnrCancel_onClick(sFormID) {
	var strParam = "";
	var objFormCtl = document.getElementById(sFormID);
	var objPSCtl = document.getElementById("ProcessMode");

	if (eval(objFormCtl) && eval(objPSCtl)) {
		if (confirm("선택하신 예약을 정말 취소 하시겠습니까?")) {
		    jQuery(objPSCtl).val("PnrCancel");
			//alert($("#" + objFormCtl.getAttribute("id")).find("input,textarea,select,hidden").not("[type=hidden][name^=__]").serialize());
			CommonAjaxCallByForm(objFormCtl, null, chMyJustgo_my_reserve_detail_btnPnrCancel_onClickSuccess);
		}
	}
}
function chMyJustgo_my_reserve_detail_btnPnrCancel_onClickSuccess(transport) {
	SetDisableProgressBar();
	var res = transport.split('|');

	if ((res != undefined) && (res.length > 1)) {
		if ((res[0] == "1") || (res[0] == "-11") || (res[0] == "-12")) {
			alert(res[1]);
			//alert(res[1] + "\n\nStatus Code: " + res[0]);
			document.location.replace(document.location);
		} else {
			alert(res[1]);
		}
	} else if (transport.indexOf("GDSERR") > -1) {
	    var sRtn = "../Inc/ErrPage/CrsErr.aspx?ec=" + escape(res[1]) + "&em=" + escape(res[2]);
	    if (document.getElementById("cp_channel") != null) {
	        sRtn += "&cp_channel=" + document.getElementById("cp_channel").value;
	    }
	    location.replace(sRtn);
	} else {
	}
}
function chMyJustgo_my_reserve_detail_btnETicket_onClick(sRevMstCD, sPassengerNo) {
	SetCenterPopup('my_reserve_eticket_bridge.aspx?RevMstCD='+sRevMstCD+"&PN="+sPassengerNo, 'ETicket', 850, 600, 'yes');
}
/************************************************************************************************************/
/*| /chReserve/reserve_apis.aspx |*********************************************************************/
function chReserve_reserve_apis_onSubmit(objFormCtl) {
    var strCtlIdPrefix = ""; // 컨트롤 ID 접미사
    var objPSCtl = document.getElementById("ProcessMode");
    var iPCnt = jQuery("#PCnt").val();
    var sToday = jQuery("#Today").val();
    var sPassportAvailableDate = "";

    // Valivator initialize
    var mv = new MiyaValidator(objFormCtl);

    if (jQuery("#txtStayContact").val() != null) {
        mv.add("txtStayContact", { trim: true, required: true, option: "OnlyEngNum", minbyte: 2, maxbyte: 50 }, "탑승자의 체류지 연락처");
    }

    // Passenger infomation(탑승자 정보)
    for (var i = 0; i < iPCnt; i++) {
        mv.add("txtPassportNo" + i, { trim: true, required: true, option: "OnlyEngNum", minbyte: 7, maxbyte: 14 }, "탑승자 " + (i + 1) + "의 여권번호(Passenger " + (i + 1) + "'s Passport number)");
        //mv.add("txtAirRequestMiles" + i, { trim: true, required: false, option: "OnlyEngNum", minbyte: 0, maxbyte: 20 }, "탑승자 " + (i + 1) + "의 마일리지 번호(Passenger " + (i + 1) + "'s number of miles)");
        if (jQuery("#txtStayState" + i).val() != null) {
            mv.add("txtStayState" + i, { trim: true, required: true, option: "OnlyEngNum2", minbyte: 2, maxbyte: 50 }, "탑승자 " + (i + 1) + "의 체류지 주");
        }
        if (jQuery("#txtStayCity" + i).val() != null) {
            mv.add("txtStayCity" + i, { trim: true, required: true, option: "OnlyEngNum2", minbyte: 2, maxbyte: 50 }, "탑승자 " + (i + 1) + "의 체류지 도시");
        }
        if (jQuery("#txtStayZipCode" + i).val() != null) {
            mv.add("txtStayZipCode" + i, { trim: true, required: true, option: "OnlyEngNum2", minbyte: 2, maxbyte: 20 }, "탑승자 " + (i + 1) + "의 체류지 우편번호");
        }
        if (jQuery("#txtStayAddress" + i).val() != null) {
            mv.add("txtStayAddress" + i, { trim: true, required: true, option: "OnlyEngNum2", minbyte: 2, maxbyte: 100 }, "탑승자 " + (i + 1) + "의 체류지 주소");
        }
    }

    if (mv.validate()) {
        for (var i = 0; i < iPCnt; i++) {
            sTmpPType = jQuery("#PassengerType" + i).val();
            sTmpPBirthLimit = jQuery("#" + sTmpPType + "LimitDT").val();

            sPassportAvailableDate = jQuery("#ddlPassportAvailableYear" + i).val();
            sPassportAvailableDate += ((jQuery("#ddlPassengerBirthMonth" + i).val() < 10) ? "0" : "") + jQuery("#ddlPassengerBirthMonth" + i).val();
            sPassportAvailableDate += ((jQuery("#ddlPassportAvailableDay" + i).val() < 10) ? "0" : "") + jQuery("#ddlPassportAvailableDay" + i).val();

            if (sToday >= sPassportAvailableDate) {
                sPassportAvailableDate = "여권 만료일은 ";
                sPassportAvailableDate += sToday.substr(0, 4) + "년 ";
                sPassportAvailableDate += sToday.substr(4, 2) + "월 ";
                sPassportAvailableDate += sToday.substr(6, 2) + "일 이후 이어야 합니다.";
                alert(sPassportAvailableDate);
                jQuery("#ddlPassportAvailableYear" + i).focus();
            } else if (eval(objFormCtl)) {
                if (eval(objPSCtl)) {
                    jQuery(objPSCtl).val("s");
                    CommonAjaxCallByForm(objFormCtl, null, chReserve_reserve_apis_onSubmitSuccess);
                }
            }
        }
    } else {
        alert(mv.getErrorMessage());
        mv.getErrorElement().focus();
    }
    return false;
}
function chReserve_reserve_apis_onSubmitSuccess(transport) {
    SetDisableProgressBar();
    var res = transport.split('|');
    if ((res != undefined) && (res.length > 1)) {
        if ((res[0] == "1") || (res[0] == "-11") || (res[0] == "-12")) {
            alert(res[1]);
            //alert(res[1] + "\n\nStatus Code: " + res[0]);
            var sRtn = document.getElementById("rtnURL").value + "?RevMstCD=" + document.getElementById("RevMstCD").value;
            if (document.getElementById("cp_channel") != null) {
                sRtn += "&cp_channel=" + document.getElementById("cp_channel").value;
            }
            if (document.getElementById("member") != null) {
                sRtn += "&member=" + document.getElementById("member").value;
            }
            document.location.replace(sRtn);
        } else {
            alert(res[1]);
        }
    } else if (transport.indexOf("GDSERR") > -1) {
        var sRtn = "../Inc/ErrPage/CrsErr.aspx?ec=" + escape(res[1]) + "&em=" + escape(res[2]);
        if (document.getElementById("cp_channel") != null) {
            sRtn += "&cp_channel=" + document.getElementById("cp_channel").value;
        }
        location.replace(sRtn);
    } else {
        alert(transport);
    }
}
/************************************************************************************************************/

/*| /Air/reserve_document.aspx |**********************************************************************/
function chReserve_reserve_document_onSubmit() {
    var strCtlIdPrefix = "ctl00_ctl00_ctl00_ctl00_CPHBody_CPHBody_CPHBodyCenter_CPHContent_"; // 컨트롤 ID 접미사
    var strCtlNmPrefix = "ctl00$ctl00$ctl00$ctl00$CPHBody$CPHBody$CPHBodyCenter$CPHContent$"; // 컨트롤 네임 접미사
    
    if (document.getElementById(strCtlIdPrefix + "paxDocType").value == '1') {
        if (document.getElementsByName(strCtlNmPrefix + "paxDocFile").length > 1) {
            for (var i = 0; i < document.getElementsByName(strCtlNmPrefix + "paxDocFile").length; i++) {
                if (document.getElementsByName(strCtlNmPrefix + "paxDocFile")[i].value == "") {
                    alert("증빙서류를 첨부해주세요.");
                    return false;
                }
            }
        } else if (document.getElementsByName(strCtlNmPrefix + "paxDocFile").length == 1) {
            if (document.getElementsByName(strCtlNmPrefix + "paxDocFile").value == "") {
                alert("증빙서류를 첨부해주세요.");
                return false;
            }
        }
    }
}
/************************************************************************************************************/

/*| /Air/reserve_passenger.aspx |**********************************************************************/
addOnloadEvent(chreserve_reserve_passenger_Onload);
function chreserve_reserve_passenger_Onload() {
    var strCtlIdPrefix = "ctl00_ctl00_ctl00_ctl00_CPHBody_CPHBody_CPHBodyCenter_CPHContent_"; // 컨트롤 ID 접미사
    var iPCnt = jQuery("#PCnt").val();
    try {
        if (eval(document.getElementById("tblPassengerInfoInput"))) {
            for (var i = 0; i < iPCnt; i++) {
                jQuery("#txtPassengerEnFstName" + i).change(function() { jQuery(this).val(this.value.ToUpper().replaceAll(" ", "")); }).change();
                jQuery("#txtPassengerEnLstName" + i).change(function() { jQuery(this).val(this.value.ToUpper().replaceAll(" ", "")); }).change();
            }

        }
    } catch (e) {
        OnErrorHandler(e);
    }
}
function chReserve_reserve_passenger_onSubmit(objForm) {
    var strParam = "";
    var strCtlIdPrefix = "ctl00_ctl00_ctl00_ctl00_CPHBody_CPHBody_CPHBodyCenter_CPHContent_"; // 컨트롤 ID 접미사
    var cbAgreement = document.getElementById("cbAgreement");
    var iPCnt = jQuery("#PCnt").val();
    var sTmpPType = "ADT";
    var sTmpPBirth = "";
    var sTmpPBirthLimit = "";
    var sTmpPBirthLimit2 = "";
    // Valivator initialize
    var mv = new MiyaValidator(objForm);

    // Cutomer infomation(예약자 정보)
    mv.add(strCtlIdPrefix + "txtCustomerName", { trim: true, required: true, option: "OnlyHanEng", minbyte: 2, maxbyte: 20 }, "예약자 성명 (Customer name)");
    mv.add(strCtlIdPrefix + "txtCustomerPhone21", { trim: true, required: true, option: "handphone", span: 3, glue: "-" }, "휴대전화 (Customer cell phone)");
    mv.add(strCtlIdPrefix + "txtCustomerEMail", { trim: true, required: true, option: "email", minbyte: 5, maxbyte: 100 }, "이메일 (Customer E-Mail address)");
    mv.add(strCtlIdPrefix + "txtCustomerPhone11", { trim: true, required: true, option: "homephone", span: 3, glue: "-" }, "일반전화 (Customer home or office phone)");

    if (eval(document.getElementById(strCtlIdPrefix + "txtCustomerPassword1"))) {
        mv.add(strCtlIdPrefix + "txtCustomerPassword1", { trim: true, required: true, minbyte: 4, maxbyte: 20 }, "비밀번호 (Customer password)");
        mv.add(strCtlIdPrefix + "txtCustomerPassword2", { trim: true, required: true, match: strCtlIdPrefix + "txtCustomerPassword2" }, "비밀번호확인 (Customer password confirm)");
    }

    // Passenger infomation(탑승자 정보)
    for (var i = 0; i < iPCnt; i++) {
        mv.add("txtPassengerEnLstName" + i, { trim: true, required: true, option: "engonly", minbyte: 2, maxbyte: 20 }, "탑승자 " + (i + 1) + "의 영문 성(Passenger " + (i + 1) + "'s English last name)");
        mv.add("txtPassengerEnFstName" + i, { trim: true, required: true, option: "engonly", minbyte: 2, maxbyte: 20 }, "탑승자 " + (i + 1) + "의 영문 이름(Passenger " + (i + 1) + "'s English first name)");
    }
    if (mv.validate()) {
        for (var i = 0; i < iPCnt; i++) {
            sTmpPType = jQuery("#PassengerType" + i).val();
            sTmpPBirthLimit = jQuery("#" + sTmpPType + "LimitDT").val();

            sTmpPBirth = jQuery("#ddlPassengerBirthYear" + i).val();
            if (jQuery("#ddlPassengerBirthMonth" + i).val() < 10) {
                sTmpPBirth += "0" + jQuery("#ddlPassengerBirthMonth" + i).val();
            } else {
                sTmpPBirth += jQuery("#ddlPassengerBirthMonth" + i).val();
            }
            if (jQuery("#ddlPassengerBirthDay" + i).val() < 10) {
                sTmpPBirth += "0" + jQuery("#ddlPassengerBirthDay" + i).val();
            } else {
                sTmpPBirth += jQuery("#ddlPassengerBirthDay" + i).val();
            }

            if (sTmpPType == "ADT") { // 성인
                if (sTmpPBirth >= sTmpPBirthLimit) {
                    alert("성인은 " + sTmpPBirthLimit.substr(0, 4) + "년 " + sTmpPBirthLimit.substr(4, 2) + "월 " + sTmpPBirthLimit.substr(6, 2) + "일 이전 출생자이어야 합니다.");
                    jQuery("#ddlPassengerBirthYear" + i).focus();
                    return false;
                }
            } else if (sTmpPType == "CNN") { // 소아
                sTmpPBirthLimit2 = jQuery("#INFLimitDT").val();
                if ((sTmpPBirth < sTmpPBirthLimit) || (sTmpPBirth >= sTmpPBirthLimit2)) {
                    sTmpPBirth = "소아는 ";
                    sTmpPBirth += sTmpPBirthLimit.substr(0, 4) + "년 ";
                    sTmpPBirth += sTmpPBirthLimit.substr(4, 2) + "월 ";
                    sTmpPBirth += sTmpPBirthLimit.substr(6, 2) + "일 ~ ";
                    sTmpPBirth += sTmpPBirthLimit2.substr(0, 4) + "년 ";
                    sTmpPBirth += sTmpPBirthLimit2.substr(4, 2) + "월 ";
                    sTmpPBirth += (sTmpPBirthLimit2.substr(6, 2) - 1) + "일 사이 출생자이어야 합니다.";
                    alert(sTmpPBirth);
                    jQuery("#ddlPassengerBirthYear" + i).focus();
                    return false;
                }
            } else { // 유아
                if (sTmpPBirth <= sTmpPBirthLimit) {
                    alert("유아는 " + sTmpPBirthLimit.substr(0, 4) + "년 " + sTmpPBirthLimit.substr(4, 2) + "월 " + sTmpPBirthLimit.substr(6, 2) + "일 이후 출생자이어야 합니다.");
                    jQuery("#ddlPassengerBirthYear" + i).focus();
                    return false;
                }
            }
        }
        if (eval(cbAgreement)) {
            if (cbAgreement.checked) {
                jQuery("#ProcessMode").val("s");
                document.getElementById('content').style.display = 'none';
                document.getElementById('loading').style.display = 'block';
                CommonAjaxCallByForm2(objForm, null, chReserve_reserve_passenger_onSubmitSuccess);
            } else {
                alert("이용 규정에 동의 하셔야 합니다.");
                cbAgreement.focus();
            }
        }
    } else {
        alert(mv.getErrorMessage());
        mv.getErrorElement().focus();
    }
    return false;
}
function chReserve_reserve_passenger_onSubmitSuccess(transport) {
    SetDisableProgressBar();
    document.getElementById('content').style.display = 'block';
    document.getElementById('loading').style.display = 'none';
    var res = transport.split('|');

    if (transport == "1") { // 정상
        var cp_channel = ''
        if( document.getElementById("cp_channel") != null) {
            cp_channel = document.getElementById("cp_channel").value;
        }
        if (cp_channel != "") {
            var f = document.forms[0];
            var submit_form = document.createElement("<form name=\"\" method=\"post\">");
            document.body.insertAdjacentElement("afterBegin", submit_form);
            submit_form.action = "reserve_finish.aspx";
            input_item = document.createElement("<input type=\"hidden\" name=\"cp_channel\" value=\"" + cp_channel + "\">");
            submit_form.insertAdjacentElement("afterBegin", input_item);
            submit_form.submit();
        } else {
            document.location.replace("reserve_finish.aspx");
        }
    } else if ((res != undefined) && (res.length > 1) && (res[0].indexOf("GDSERR") > -1)) {
        var sRtn = "../Inc/ErrPage/CrsErr.aspx?ec=" + escape(res[1]) + "&em=" + escape(res[2]);
        if (document.getElementById("cp_channel") != null) {
            sRtn += "&cp_channel=" + document.getElementById("cp_channel").value;
        }
        location.replace(sRtn);
    } else { // 오류
        alert(transport);
    }
}
/************************************************************************************************************/

/*| /Air/search_list.aspx |*********************************************************************/
function chSearch_search_list_btnSearch_onClick(sFormID) {
    var strParam = "";

    var objFormCtl = document.getElementById(sFormID);
    var objPSCtl = document.getElementById("ProcessMode");

    if (eval(objFormCtl) && eval(objPSCtl)) {
        jQuery(objPSCtl).val("FareSchedule");
        CommonAjaxCallByForm(objFormCtl, "/Air/Ajax/SearchListAjaxCall.ashx", chSearch_search_list_btnSearch_onClickSuccess);
    }
}
function chSearch_search_list_btnSearch_onClickSuccess(transport) {
    SetDisableProgressBar();
    var res = transport.split('|');

    if ((res != undefined) && (res.length > 1)) {
        if ((res[0] == "1") || (res[0] == "-11") || (res[0] == "-12")) {
            document.getElementById("listtb").innerHTML = res[1];
            jQuery("#FareScheduleXML").val(res[2]);

            var tempTotalCnt = res[3];
            var ListCnt = 10;

            var ListTotalCnt = parseInt(tempTotalCnt / ListCnt) + 1;

            jQuery("#ListTotalCnt").val(parseInt(ListTotalCnt));

            //상단 리스트
            chSearch_createPagingTable(ListTotalCnt, "TOP");

            //하단 리스트
            chSearch_createPagingTable(ListTotalCnt, "BOT");
        } else {
            alert(res[1]);
        }
    } else if (transport.indexOf("GDSERR") > -1) {
        var sRtn = "../Inc/ErrPage/CrsErr.aspx?ec=" + escape(res[1]) + "&em=" + escape(res[2]);
        if (document.getElementById("cp_channel") != null) {
            sRtn += "&cp_channel=" + document.getElementById("cp_channel").value;
        }
        location.replace(sRtn);
    } else {
    }
}

function SelectPageList(SelectPageNum, SearchYN) {
    document.getElementById("SelectedNum").value = SelectPageNum;
    
    var FareScheduleXML = '';
    if (SearchYN == "Y") {
        FareScheduleXML = document.getElementById("FareScheduleXML").value;
    }
    var DepartureCity = document.getElementById("DepartureCity").value;
    var ArrivalCity = document.getElementById("ArrivalCity").value;
    var DepartureDate = document.getElementById("DepartureDate").value;
    var ArrivalDate = document.getElementById("ArrivalDate").value;
    var Compartment = document.getElementById("Compartment").value;
    var AdultCount = document.getElementById("AdultCount").value;
    var ChildCount = document.getElementById("ChildCount").value;
    var InfantCount = document.getElementById("InfantCount").value;
    var TripType = document.getElementById("TripType").value;
    var CpMstCD = document.getElementById("CpMstCD").value;
    var Open = document.getElementById("Open").value;
    var SeatOK = document.getElementById("SeatOK").value;

    TotalParam = "ProcessMode=FareSchedule";
    TotalParam += "&FareScheduleXML=" + FareScheduleXML;
    TotalParam += "&SelectPageNum=" + SelectPageNum;
    TotalParam += "&DepartureCity=" + DepartureCity;
    TotalParam += "&ArrivalCity=" + ArrivalCity;
    TotalParam += "&DepartureDate=" + DepartureDate;
    TotalParam += "&ArrivalDate=" + ArrivalDate;
    TotalParam += "&Compartment=" + Compartment;
    TotalParam += "&AdultCount=" + AdultCount;
    TotalParam += "&ChildCount=" + ChildCount;
    TotalParam += "&InfantCount=" + InfantCount;
    TotalParam += "&TripType=" + TripType;
    TotalParam += "&CpMstCD=" + CpMstCD;
    TotalParam += "&Open=" + Open;
    TotalParam += "&SeatOK=" + SeatOK;

    if (SearchYN == "Y") {
        var search_price_s = document.getElementById("search_price_s").value;
        var search_price_e = document.getElementById("search_price_e").value;
        var search_timeRangeType = document.getElementById("search_timeRangeType").value;
        var search_depTime_s = document.getElementById("search_depTime_s").value;
        var search_depTime_e = document.getElementById("search_depTime_e").value;
        var search_arrTime_s = document.getElementById("search_arrTime_s").value;
        var search_arrTime_e = document.getElementById("search_arrTime_e").value;
        var search_flightTimeRangeType = document.getElementById("search_flightTimeRangeType").value;
        var search_flightTime_s = document.getElementById("search_flightTime_s").value;
        var search_flightTime_e = document.getElementById("search_flightTime_e").value;
        var search_seatIndex = $("input[name=search_seatIndex]").filter(function() { if (this.checked) return this; }).val();
        var search_viaIndex = "";
        $("input:checkbox[name=search_viaIndex]:checked").each(function() { search_viaIndex += $(this).val() + "," }).val();
        var search_airline = $("#search_airline > option:selected").val();
        var search_period = $("#search_period > option:selected").val();
        var search_fareType = $("#search_fareType > option:selected").val();
        if (search_seatIndex == undefined) {
            search_seatIndex = "";
        }
        if (search_airline == undefined) {
            search_airline = "";
        }
        if (search_period == undefined) {
            search_period = "";
        }
        if (search_fareType == undefined) {
            search_fareType = "";
        }
        
        TotalParam += "&searchYN=" + SearchYN;
        TotalParam += "&search_price_s=" + search_price_s;
        TotalParam += "&search_price_e=" + search_price_e;
        TotalParam += "&search_depTime_s=" + search_depTime_s;
        TotalParam += "&search_depTime_e=" + search_depTime_e;
        TotalParam += "&search_arrTime_s=" + search_arrTime_s;
        TotalParam += "&search_arrTime_e=" + search_arrTime_e;
        TotalParam += "&search_flightTime_s=" + search_flightTime_s;
        TotalParam += "&search_flightTime_e=" + search_flightTime_e;
        TotalParam += "&search_seatIndex=" + search_seatIndex;
        TotalParam += "&search_viaIndex=" + search_viaIndex;
        TotalParam += "&search_airline=" + search_airline;
        TotalParam += "&search_period=" + search_period;
        TotalParam += "&search_fareType=" + search_fareType;
        TotalParam += "&search_timeRangeType=" + search_timeRangeType;
        TotalParam += "&search_flightTimeRangeType=" + search_flightTimeRangeType;
    } else {
        $("#listtit_city").html($("#DepartureCityKRNM").val() + "-" + $("#ArrivalCityKRNM").val() + " <font color='#4f4f4f'>" + ($("#TripType").val() == "RRT" ? "왕복" : "편도") + "</font>");
        $("#loading_DepCityKRNM").text($("#DepartureCityKRNM").val());
        $("#loading_ArrCityKRNM").text($("#ArrivalCityKRNM").val());
        $("#loading_DepDate").text("출국일 : " + DepartureDate);
        if (TripType == "RRT" && Open == "N") {
            $("#loading_ArrDate").text("귀국일 : " + ArrivalDate);
            $("#timeRange_span").html("<input name=\"timeRange\" type=\"radio\" value=\"out\" checked=\"checked\" onclick=\"change_timeRange(this.value);\">출국 <input name=\"timeRange\" type=\"radio\" value=\"in\" onclick=\"change_timeRange(this.value);\">귀국");
            $("#flightTimeRange_span").html("<input name=\"flightTimeRange\" type=\"radio\" value=\"out\" checked=\"checked\" onclick=\"change_flightTimeRange(this.value);\">출국 <input name=\"flightTimeRange\" type=\"radio\" value=\"in\" onclick=\"change_flightTimeRange(this.value);\">귀국");
        } else {
            $("#timeRange_span").html("<input name=\"timeRange\" type=\"radio\" value=\"out\" checked=\"checked\" onclick=\"change_timeRange(this.value);\">출국");
            $("#flightTimeRange_span").html("<input name=\"flightTimeRange\" type=\"radio\" value=\"out\" checked=\"checked\" onclick=\"change_flightTimeRange(this.value);\">출국");
        }
        document.getElementById('content').style.display = 'none';
        document.getElementById('loading').style.display = 'block';
    }

    jQuery.ajax
	(
		{
		    type: "POST",
		    url: "/Air/Ajax/SearchListAjaxCall.ashx",
		    data: TotalParam,
		    success: function(returnValue) {
		        document.getElementById('content').style.display = 'block';
		        document.getElementById('loading').style.display = 'none';
		        
		        var tmp = returnValue.split('<!--Search-->');
		        var res = tmp[0].split('|');

		        if ((res != undefined) && (res.length > 1)) {
		            // 오류
		            if (res[0] == "-1") {
		                $("#FareTotalCnt").text("0");
		                var tmpHTML = "<table border=\"0\" width=\"100%\" class=\"listformtable3\"><tr><td align=\"center\" height=\"50\"><b>고객님이 선택하신 검색조건에 맞는 결과가 없습니다.<b></td></tr></table>"
		                document.getElementById("listtb").innerHTML = tmpHTML;
		            // 정상
		            } else if ((res[0] == "1") || (res[0] == "-11") || (res[0] == "-12")) {
		                document.getElementById("listtb").innerHTML = res[1];
		                jQuery("#FareScheduleXML").val(res[2]);

		                var tempTotalCnt = res[3];
		                var ListCnt = 10;

		                var ListTotalCnt = parseInt(tempTotalCnt / ListCnt) + 1;

		                $("#ListTotalCnt").val(parseInt(ListTotalCnt));
		                $("#FareTotalCnt").text(parseInt(tempTotalCnt));

		                //상단 리스트
		                chSearch_createPagingTable(ListTotalCnt, "TOP");

		                //하단 리스트
		                chSearch_createPagingTable(ListTotalCnt, "BOT");

		                // 첫조회시 초기화
		                if (SearchYN == '' && tmp[1].split('|')[0]) {
		                    res = tmp[1].split('|');
		                    $("#SeatIndex").html(res[0]);
		                    $("#ViaIndex").html(res[1]);
		                    $("#AirlineIndex").html(res[2]);
		                    $("#PeriodlineIndex").html(res[3]);
		                    $("#FareTypeIndex").html(res[4]);
		                    $("#Param").html(res[5]);
		                    $("#listtab").html(res[6]);
		                    init();
		                }
		            }
		        }
		    }
		}
	);
}

function ChangeFareSchedule(serviceFareMstCD, departureCity2) {
    var DepartureDate = document.getElementById("DepartureDate").value;
    var ArrivalDate = document.getElementById("ArrivalDate").value;
    var AdultCount = document.getElementById("AdultCount").value;
    var ChildCount = document.getElementById("ChildCount").value;
    var InfantCount = document.getElementById("InfantCount").value;
    var TripType = document.getElementById("TripType").value;
    var CpMstCD = document.getElementById("CpMstCD").value;

    TotalParam = "ProcessMode=ChangeFareSchedule";
    TotalParam += "&ServiceFareMstCD=" + serviceFareMstCD;
    TotalParam += "&DepartureDate=" + DepartureDate;
    TotalParam += "&ArrivalDate=" + ArrivalDate;
    TotalParam += "&AdultCount=" + AdultCount;
    TotalParam += "&ChildCount=" + ChildCount;
    TotalParam += "&InfantCount=" + InfantCount;
    TotalParam += "&TripType=" + TripType;
    TotalParam += "&CpMstCD=" + CpMstCD;
    TotalParam += "&DepartureCity2=" + departureCity2;

    SetEnableProgressBar()

    jQuery.ajax
	(
		{
		    type: "POST",
		    url: "/Air/Ajax/SearchListAjaxCall.ashx",
		    data: TotalParam,
		    success: function(returnValue) {
		        SetDisableProgressBar()

		        var tmp = returnValue.split('<!--Search-->');
		        var res = tmp[0].split('|');

		        if ((res != undefined) && (res.length > 1)) {
		            // 오류
		            if (res[0] == "-1") {
		                $("#div_dep" + serviceFareMstCD).html('');
		                $("#div_arr" + serviceFareMstCD).html('');
		                $("#hdOutSelectedSeatStatus_" + serviceFareMstCD).val('');
		                $("#hdInSelectedSeatStatus_" + serviceFareMstCD).val('');
		                $("#div_reserve" + serviceFareMstCD).html('');
		                $("#div_inBound_" + serviceFareMstCD).html(res[1]);
		                // 정상
		            } else if ((res[0] == "1") || (res[0] == "-11") || (res[0] == "-12")) {
		                $("#div_fareSchedule_" + serviceFareMstCD).html(res[1]);
		                $("#hdChangeFareScheduleXML_" + serviceFareMstCD).val(res[2]);
		            }
		        }
		    }
		}
	);
}

function chSearch_createPagingTable(ListTotalCnt, Where) {
    var ListCnt = parseInt(document.getElementById("NowListCnt").value) * 10;
    var ListStartCnt = ListCnt - 10;
    if (ListCnt > ListTotalCnt) {
        ListCnt = ListTotalCnt;
    }

    var SelectedNum = parseInt(document.getElementById("SelectedNum").value);

    var ListTable = "<table border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\"  class=\"notable1\">";
    ListTable += "<tr>";
    ListTable += "<td width=\"30\" height=\"22\">";
    //ListTable += "<a href='javascript:PreView();'><img src=\"../img/wholesale_air/arrow_pre2.png\" width=\"12\" height=\"9\" class=\"middle\" /></a> ";
    if (SelectedNum - 1 > 0) {
        ListTable += "<a href='javascript:SelectPageList(\"" + (SelectedNum - 1) + "\",\"Y\");'>";
    } else {
        ListTable += "<a href='javascript:alert(\"이전 항목이 없습니다.\");'>";
    }
    ListTable += "<img src=\"../img/wholesale_air/arrow_pre1_new.png\" width=\"17\" height=\"17\" border=\"0\" /></a> ";
    ListTable += "</td>";
    if (ListTotalCnt == 0) {
        ListTable += "<td width=\"24\" height=\"22\" class=\"select\">1</td>";
    }
    else {
        for (var i = 1; i <= ListCnt; i++) {
            if (i == 1) {
                i = i + ListStartCnt;
            }

            //alert(i + "    " + SelectedNum);
            if (i == SelectedNum) {
                ListTable += "<td width=\"24\" height=\"22\" class=\"select\">" + i + "</td> ";
            }
            else {
                ListTable += "<td width=\"24\" height=\"22\" class=\"no\"><a href='javascript:SelectPageList(\"" + i + "\",\"Y\");'>" + i + "</a></td>";
            }
        }
    }
    ListTable += "<td width=\"30\" height=\"22\">";
    if (SelectedNum + 1 > ListCnt) {
        ListTable += "<a href='javascript:alert(\"다음 항목이 없습니다.\");'>";
    } else {
        ListTable += "<a href='javascript:SelectPageList(\"" + (SelectedNum + 1) + "\",\"Y\");'>";
    }
    ListTable += "<img src=\"../img/wholesale_air/arrow_next1_new.png\" width=\"17\" height=\"17\" border=\"0\" /></a> ";
    //ListTable += "<a href='javascript:NextView();'><img src=\"../img/wholesale_air/arrow_next2.png\" width=\"12\" height=\"9\" /></a>";
    ListTable += "</td>";

    if (Where == "TOP") {
        document.getElementById("TopPagingTable").innerHTML = ListTable;
    } else {
        document.getElementById("BotPagingTable").innerHTML = ListTable;
    }
}

//이전
function PreView() {
    var ListTotalCnt = document.getElementById("ListTotalCnt").value;
    if (parseInt(document.getElementById("NowListCnt").value) > 1) {
        document.getElementById("NowListCnt").value = parseInt(document.getElementById("NowListCnt").value) - 1;
        //상단 리스트
        chSearch_createPagingTable(ListTotalCnt, "TOP");

        //하단 리스트
        chSearch_createPagingTable(ListTotalCnt, "BOT");
    }
    else {
        alert("이전 항목이 없습니다.");
    }
}

//다음
function NextView() {
    var ListTotalCnt = document.getElementById("ListTotalCnt").value;
    if (parseInt(document.getElementById("NowListCnt").value) * 10 < parseInt(document.getElementById("ListTotalCnt").value)) {
        document.getElementById("NowListCnt").value = parseInt(document.getElementById("NowListCnt").value) + 1;
        //상단 리스트
        chSearch_createPagingTable(ListTotalCnt, "TOP");

        //하단 리스트
        chSearch_createPagingTable(ListTotalCnt, "BOT");
    }
    else {
        alert("다음 항목이 없습니다.");
    }
}

function makeList(ServiceFareMstCD, RoutingNo, RoutingType) {
    if (RoutingType == "OUT") {
        imgStr = "List_bt_out.gif";
        routingInfoKor = document.getElementById("hdOutRoutingInfoKor_" + ServiceFareMstCD + "_" + RoutingNo).value;
        departureDateTime = document.getElementById("hdOutDepartureDateTime_" + ServiceFareMstCD + "_" + RoutingNo).value;
        arrivalDateTime = document.getElementById("hdOutArrivalDateTime_" + ServiceFareMstCD + "_" + RoutingNo).value;
        flightTime = document.getElementById("hdOutFlightTime_" + ServiceFareMstCD + "_" + RoutingNo).value;
        seatStatus = document.getElementById("hdOutSeatStatus_" + ServiceFareMstCD + "_" + RoutingNo).value == "ok" ? "가능" : "대기";
        document.getElementById("hdOutSelectedRouting_" + ServiceFareMstCD).value = RoutingNo;
        document.getElementById("hdOutSelectedSeatStatus_" + ServiceFareMstCD).value = document.getElementById("hdOutSeatStatus_" + ServiceFareMstCD + "_" + RoutingNo).value;
        var routingCnt = parseInt(document.getElementById("hdOutRoutingCnt_" + ServiceFareMstCD).value);
        for (i = 0; i < routingCnt; i++) {
            if (document.getElementById("selectedOutTr_" + ServiceFareMstCD + "_" + i) != null) {
                if (RoutingNo == i) {
                    document.getElementById("selectedOutTr_" + ServiceFareMstCD + "_" + i).className = "bg2";
                } else {
                document.getElementById("selectedOutTr_" + ServiceFareMstCD + "_" + i).className = "";
                }
            }
        }
        document.getElementById("div_dep" + ServiceFareMstCD).innerHTML = selectedRoutingHTML(imgStr, routingInfoKor, departureDateTime, arrivalDateTime, flightTime, seatStatus);
    } else if (RoutingType == "IN") {
        imgStr = "List_bt_in.gif";
        routingInfoKor = document.getElementById("hdInRoutingInfoKor_" + ServiceFareMstCD + "_" + RoutingNo).value;
        departureDateTime = document.getElementById("hdInDepartureDateTime_" + ServiceFareMstCD + "_" + RoutingNo).value;
        arrivalDateTime = document.getElementById("hdInArrivalDateTime_" + ServiceFareMstCD + "_" + RoutingNo).value;
        flightTime = document.getElementById("hdInFlightTime_" + ServiceFareMstCD + "_" + RoutingNo).value;
        seatStatus = document.getElementById("hdInSeatStatus_" + ServiceFareMstCD + "_" + RoutingNo).value == "ok" ? "가능" : "대기";
        document.getElementById("hdInSelectedRouting_" + ServiceFareMstCD).value = RoutingNo;
        document.getElementById("hdInSelectedSeatStatus_" + ServiceFareMstCD).value = document.getElementById("hdInSeatStatus_" + ServiceFareMstCD + "_" + RoutingNo).value;
        var routingCnt = parseInt(document.getElementById("hdInRoutingCnt_" + ServiceFareMstCD).value);
        for (i = 0; i < routingCnt; i++) {
            if (document.getElementById("selectedInTr_" + ServiceFareMstCD + "_" + i) != null) {
                if (RoutingNo == i) {
                    document.getElementById("selectedInTr_" + ServiceFareMstCD + "_" + i).className = "bg2";
                } else {
                document.getElementById("selectedInTr_" + ServiceFareMstCD + "_" + i).className = "";
                }
            }
        }
        document.getElementById("div_arr" + ServiceFareMstCD).innerHTML = selectedRoutingHTML(imgStr, routingInfoKor, departureDateTime, arrivalDateTime, flightTime, seatStatus);
    }

    var outSelectedSeatStatus = document.getElementById("hdOutSelectedSeatStatus_" + ServiceFareMstCD).value;
    var inSelectedSeatStatus = document.getElementById("hdInSelectedSeatStatus_" + ServiceFareMstCD).value;

    var tripType = document.getElementById("TripType").value;
    var open = document.getElementById("Open").value;
    var selectedOutRouting = document.getElementById("hdOutSelectedRouting_" + ServiceFareMstCD).value;
    var selectedInRouting = document.getElementById("hdInSelectedRouting_" + ServiceFareMstCD).value
    if (tripType == "RRT" && open == "N") {
        if (outSelectedSeatStatus != "" && inSelectedSeatStatus != "") {
            if (outSelectedSeatStatus == "ok" && inSelectedSeatStatus == "ok") {
                document.getElementById("div_reserve" + ServiceFareMstCD).innerHTML = "<a href=\"javascript:setReserveParam('" + ServiceFareMstCD + "', '" + selectedOutRouting + "', '" + selectedInRouting + "');\"><img src=\"../img/wholesale_air/List_bt_ok.gif\" alt=\"좌석ok예약하기\" width=\"58\" height=\"47\"></a>";
            } else {
            document.getElementById("div_reserve" + ServiceFareMstCD).innerHTML = "<a href=\"javascript:setReserveParam('" + ServiceFareMstCD + "', '" + selectedOutRouting + "', '" + selectedInRouting + "');\"><img src=\"../img/wholesale_air/List_bt_wait.gif\" alt=\"좌석대기예약하기\" width=\"58\" height=\"47\"></a>";
            }
        }
    } else {
        if (outSelectedSeatStatus == "ok") {
            document.getElementById("div_reserve" + ServiceFareMstCD).innerHTML = "<a href=\"javascript:setReserveParam('" + ServiceFareMstCD + "', '" + selectedOutRouting + "', '" + selectedInRouting + "');\"><img src=\"../img/wholesale_air/List_bt_ok.gif\" alt=\"좌석ok예약하기\" width=\"58\" height=\"47\">";
        } else {
            document.getElementById("div_reserve" + ServiceFareMstCD).innerHTML = "<a href=\"javascript:setReserveParam('" + ServiceFareMstCD + "', '" + selectedOutRouting + "', '" + selectedInRouting + "');\"><img src=\"../img/wholesale_air/List_bt_wait.gif\" alt=\"좌석대기예약하기\" width=\"58\" height=\"47\">";
        }
    }
}

function flightDetailURL(ServiceFareMstCD) {

    var ProcessMode = "FlightDetailParam";
    var FareScheduleXML = '';
    if ($("#hdChangeFareScheduleXML_" + ServiceFareMstCD).val() == "") {
        FareScheduleXML = $("#FareScheduleXML").val();
    } else {
        FareScheduleXML = $("#hdChangeFareScheduleXML_" + ServiceFareMstCD).val();
    }
    var TripType = document.getElementById("TripType").value;
    var Open = document.getElementById("Open").value;
    var RoutingOutNo = document.getElementById("hdOutSelectedRouting_" + ServiceFareMstCD).value;
    var RoutingInNo = document.getElementById("hdInSelectedRouting_" + ServiceFareMstCD).value

    if (TripType == "RRT" && Open == "N") {
        if (RoutingOutNo == "") {
            alert("가는편을 선택해주세요.");
            return;
        }
        if (RoutingInNo == "") {
            alert("오는편을 선택해주세요.");
            return;
        }
    } else {
        if (RoutingOutNo == "") {
            alert("가는편을 선택해주세요.");
            return;
        }
    }

    jQuery.ajax({
        type: 'post',
        data: {
            'ProcessMode': ProcessMode,
            'FareScheduleXML': FareScheduleXML,
            'ServiceFareMstCD': ServiceFareMstCD,
            'RoutingOutNo': RoutingOutNo,
            'RoutingInNo': RoutingInNo,
            'TripType': TripType,
            'Open': Open
        },
        url: '/Air/Ajax/SearchListAjaxCall.ashx',
        success: function(returnValue) {
            var res = returnValue.split('|');
            if (res != undefined && res[0] == "1") {
                SetCenterPopup('/Air/RecommendFare/City_AirSale_Result_Layer_Pop.aspx' + res[1], 'popup', 632, 350, 'no');
            }
            else alert("데이터를 처리 도중 에러가 발생하였습니다.\r\n다시 한번 시도해주십시요.");
        },
        error: function() {
            alert("데이터를 처리 도중 에러가 발생하였습니다.");
        }
    });
}

function getHotelInfo(arrivalCity) {
    var ProcessMode = "GetHotelInfo";
    jQuery.ajax({
        type: 'post',
        data: {
            'ProcessMode': ProcessMode,
            'ArrivalCity': arrivalCity
        },
        url: '/Air/Ajax/SearchListAjaxCall.ashx',
        success: function(returnValue) {
            var res = returnValue.split('|');
            if (res != undefined && res[0] == "1") {
                jQuery("#div_hotelInfo").html(res[1]);
            }
        },
        error: function() {
        }
    });
}

function selectedRoutingHTML(imgStr, routingInfoKor, departureDateTime, arrivalDateTime, flightTime, seatStatus) {
    var routingHTML = "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
    routingHTML += "  <tr>";
    routingHTML += "    <td width=\"40\" height=\"30\"><img src=\"../img/wholesale_air/" + imgStr + "\" width=\"25\" height=\"14\"></td>";
    routingHTML += "    <td width=\"145\">" + routingInfoKor + "</td>";
    routingHTML += "    <td width=\"90\">" + departureDateTime + "</td>";
    routingHTML += "    <td width=\"90\">" + arrivalDateTime + "</td>";
    routingHTML += "    <td width=\"50\">" + flightTime + "</td>";
    routingHTML += "    <td width=\"20\" class=\"font11_price\">" + seatStatus + "</td>";
    routingHTML += "  </tr>";
    routingHTML += "</table>";

    return routingHTML;
}

function setReserveParam(ServiceFareMstCD, RoutingOutNo, RoutingInNo) {
    var ProcessMode = "ReserveParam";
    var FareScheduleXML = '';
    if ($("#hdChangeFareScheduleXML_" + ServiceFareMstCD).val() == "") {
        FareScheduleXML = $("#FareScheduleXML").val();
    } else {
        FareScheduleXML = $("#hdChangeFareScheduleXML_" + ServiceFareMstCD).val();
    }
    var TripType = document.getElementById("TripType").value;
    var Open = document.getElementById("Open").value;
    var AdultCount = document.getElementById("AdultCount").value;
    var ChildCount = document.getElementById("ChildCount").value;
    var InfantCount = document.getElementById("InfantCount").value;
    var CPMstCD = '';
    if (document.getElementById("CPMstCD") != null) {
        CPMstCD = document.getElementById("CPMstCD").value;
    }
    var cp_channel = '';
    if (document.getElementById("cp_channel") != null) {
        cp_channel = document.getElementById("cp_channel").value;
    }
    jQuery.ajax({
        type: 'post',
        data: {
            'ProcessMode': ProcessMode,
            'FareScheduleXML': FareScheduleXML,
            'ServiceFareMstCD': ServiceFareMstCD,
            'RoutingOutNo': RoutingOutNo,
            'RoutingInNo': RoutingInNo,
            'TripType': TripType,
            'Open': Open,
            'AdultCount': AdultCount,
            'ChildCount': ChildCount,
            'InfantCount': InfantCount,
            'CPMstCD': CPMstCD,
            'cp_channel': cp_channel
        },
        url: '/Air/Ajax/SearchListAjaxCall.ashx',
        success: function(returnValue) {
            var res = returnValue.split('|');
            if (res != undefined && res[0] == "1") {
                document.location.href = "search_bridge.aspx" + res[1];
            }
            else alert("데이터를 처리 도중 에러가 발생하였습니다.\r\n다시 한번 시도해주십시요.");
        },
        error: function() {
            alert("데이터를 처리 도중 에러가 발생하였습니다.");
        }
    });
}

function getWeekDay(date, addDay) {
    var datePattern = /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/;
    var day = "";

    if (datePattern.test(date)) {
        var tmpDate = date.toString().split("-");

        tmpDate = new Date(tmpDate[0], tmpDate[1] - 1, tmpDate[2]);
        tmpDate.setDate(tmpDate.getDate() + addDay);
        tmpDate = tmpDate.getDay();

        switch (tmpDate) {
            case 0: day = "일"; break;
            case 1: day = "월"; break;
            case 2: day = "화"; break;
            case 3: day = "수"; break;
            case 4: day = "목"; break;
            case 5: day = "금"; break;
            case 6: day = "토"; break;
        }
    }
    return day;
}
/************************************************************************************************************/

/*| /Air/my_reserve_list.aspx |******************************************************************************/
function chMyJustgo_my_searchList_onClick(objFormCtl) {
    CommonAjaxCallByForm(objFormCtl, null, chMyJustgo_my_searchList_onClickSuccess);
}

function chMyJustgo_my_searchList_onClickSuccess(transport) {
    SetDisableProgressBar();
}
/************************************************************************************************************/









//Step Carousel Viewer: By Dynamic Drive, at http://www.dynamicdrive.com
//Created: March 19th, 08'

jQuery.noConflict()

var stepcarousel = {
	ajaxloadingmsg: '<div style="margin: 1em; font-weight: bold"><img src="ajaxloadr.gif" style="vertical-align: middle" /> Fetching Content. Please wait...</div>', //customize HTML to show while fetching Ajax content
	configholder: {},

	getCSSValue: function(val) { //Returns either 0 (if val contains 'auto') or val as an integer
		return (val == "auto") ? 0 : parseInt(val)
	},

	getremotepanels: function($, config) { //function to fetch external page containing the panel DIVs
		config.$belt.html(this.ajaxloadingmsg)
		$.ajax({
			url: config.contenttype[1], //path to external content
			async: true,
			error: function(ajaxrequest) {
				config.$belt.html('Error fetching content.<br />Server Response: ' + ajaxrequest.responseText)
			},
			success: function(content) {
				config.$belt.html(content)
				config.$panels = config.$gallery.find('.' + config.panelclass)
				stepcarousel.alignpanels($, config)
			}
		})
	},

	alignpanels: function($, config) {
		var paneloffset = 0
		config.paneloffsets = [paneloffset] //array to store upper left offset of each panel (1st element=0)
		config.panelwidths = [] //array to store widths of each panel
		config.$panels.each(function(index) { //loop through panels
			var $currentpanel = $(this)
			$currentpanel.css({ float: 'none', position: 'absolute', left: paneloffset + 'px' }) //position panel
			$currentpanel.bind('click', function(e) { return config.onpanelclick(e.target) }) //bind onpanelclick() to onclick event
			paneloffset += stepcarousel.getCSSValue($currentpanel.css('marginRight')) + parseInt($currentpanel.get(0).offsetWidth) //calculate next panel offset
			config.paneloffsets.push(paneloffset) //remember this offset
			config.panelwidths.push(paneloffset - config.paneloffsets[config.paneloffsets.length - 2]) //remember panel width
		})
		config.paneloffsets.pop() //delete last offset (redundant)
		config.$belt.css({ width: paneloffset + 'px' }) //Set Belt DIV to total panels' widths
		this.statusreport(config.galleryid)
		config.oninit()
		config.onslideaction(this)
	},

	stepTo: function(galleryid, pindex) { /*User entered pindex starts at 1 for intuitiveness. Internally pindex still starts at 0 */
		var config = stepcarousel.configholder[galleryid]
		if (typeof config == "undefined") {
			alert("There's an error with your set up of Carousel Viewer \"" + galleryid + "\"!")
			return
		}
		var pindex = Math.min(pindex - 1, config.paneloffsets.length - 1)
		var endpoint = config.paneloffsets[pindex] + (pindex == 0 ? 0 : config.beltoffset)
		
		config.$belt.animate({ left: -endpoint + 'px' }, 'slow', function() { config.onslideaction(this) })
		config.currentpanel = pindex
		this.statusreport(galleryid)
	},

	stepBy: function(galleryid, steps) {
		var config = stepcarousel.configholder[galleryid]
		if (typeof config == "undefined") {
			alert("There's an error with your set up of Carousel Viewer \"" + galleryid + "\"!")
			return
		}
		var direction = (steps > 0) ? 'forward' : 'back' //If "steps" is negative, that means backwards
		var pindex = config.currentpanel + steps //index of panel to stop at

		pindex = (pindex > config.paneloffsets.length - 1 || pindex < 0 && pindex - steps > 0) ? 0 : (pindex < 0) ? config.paneloffsets.length + steps : pindex //take into account end or starting panel and step direction

		var endpoint = config.paneloffsets[pindex] + (pindex == 0 ? 0 : config.beltoffset) //left distance for Belt DIV to travel to

		if (pindex > 0 && direction == 'forward' || config.currentpanel > 0 && direction == 'back') { //decide whether to apply "push pull" effect
			
			config.$belt.animate({ left: -endpoint + 'px' }, 'slow', function() { config.onslideaction(this) })

			config.currentpanel = pindex
		}

		this.statusreport(galleryid)
	},

	statusreport: function(galleryid) {
		var config = stepcarousel.configholder[galleryid]
		var startpoint = config.currentpanel //index of first visible panel 
		var visiblewidth = 0
		for (var endpoint = startpoint; endpoint < config.paneloffsets.length; endpoint++) { //index (endpoint) of last visible panel
			visiblewidth += config.panelwidths[endpoint]
			if (visiblewidth > config.gallerywidth) {
				break
			}
		}
		startpoint += 1 //format startpoint for user friendiness
		endpoint = (endpoint + 1 == startpoint) ? startpoint : endpoint //If only one image visible on the screen and partially hidden, set endpoint to startpoint
		var valuearray = [startpoint, endpoint, config.panelwidths.length]
		for (var i = 0; i < config.statusvars.length; i++) {
			window[config.statusvars[i]] = valuearray[i] //Define variable (with user specified name) and set to one of the status values
			config.$statusobjs[i].html(valuearray[i]) //Populate element on page with ID="user specified name" with one of the status values
		}
	},

	setup: function(config) {
		//Disable Step Gallery scrollbars ASAP dynamically (enabled for sake of users with JS disabled)
		document.write('<style type="text/css">\n#' + config.galleryid + '{overflow: hidden;}\n</style>')
		jQuery(document).ready(function($) {
			config.$gallery = $('#' + config.galleryid)
			config.gallerywidth = config.$gallery.width()
			config.$belt = config.$gallery.find('.' + config.beltclass) //Find Belt DIV that contains all the panels
			config.$panels = config.$gallery.find('.' + config.panelclass) //Find Panel DIVs that each contain a slide
			config.onpanelclick = (typeof config.onpanelclick == "undefined") ? function(target) { } : config.onpanelclick //attach custom "onpanelclick" event handler
			config.onslideaction = (typeof config.onslide == "undefined") ? function() { } : function(beltobj) { $(beltobj).stop(); config.onslide() } //attach custom "onslide" event handler
			config.oninit = (typeof config.oninit == "undefined") ? function() { } : config.oninit //attach custom "oninit" event handler
			config.beltoffset = stepcarousel.getCSSValue(config.$belt.css('marginLeft')) //Find length of Belt DIV's left margin
			config.statusvars = config.statusvars || []  //get variable names that will hold "start", "end", and "total" slides info
			config.$statusobjs = [$('#' + config.statusvars[0]), $('#' + config.statusvars[1]), $('#' + config.statusvars[2])]
			config.currentpanel = 0
			stepcarousel.configholder[config.galleryid] = config //store config parameter as a variable
			if (config.contenttype[0] == "ajax" && typeof config.contenttype[1] != "undefined") //fetch ajax content?
				stepcarousel.getremotepanels($, config)
			else
				stepcarousel.alignpanels($, config) //align panels and initialize gallery
		}) //end document.ready
		jQuery(window).bind('unload', function() { //clean up
			jQuery.each(config, function(ai, oi) {
				oi = null
			})
			config = null
		})
	}
}




