// Booking Form
function CheckWrongFareRouting() {
	/*if(document.pg_booking_form.Direction_rt.checked == true) { 
		if ( ((document.pg_booking_form.departCity.value=='BKK') && (document.pg_booking_form.returnCity.value=='PNH')) || ((document.pg_booking_form.departCity.value=='PNH') && (document.pg_booking_form.returnCity.value=='BKK')) || 
			 ((document.pg_booking_form.departCity.value=='BKK') && (document.pg_booking_form.returnCity.value=='RGN')) || ((document.pg_booking_form.departCity.value=='RGN') && (document.pg_booking_form.returnCity.value=='BKK')) ||
			 ((document.pg_booking_form.departCity.value=='BKK') && (document.pg_booking_form.returnCity.value=='MLE')) || ((document.pg_booking_form.departCity.value=='MLE') && (document.pg_booking_form.returnCity.value=='BKK')) ) {
			
			document.getElementById('actionType_0').disabled = true;
			document.getElementById('actionType_1').checked = true;
		} else {
			document.getElementById('actionType_0').disabled = false;
			document.getElementById('actionType_0').checked = true;
		}
	}
	
	if(document.pg_booking_form.Direction_ow.checked == true) { 
		if ( ((document.pg_booking_form.departCity.value=='RGN') && (document.pg_booking_form.returnCity.value=='BKK')) || 
			 ((document.pg_booking_form.departCity.value=='LPQ') && (document.pg_booking_form.returnCity.value=='BKK')) || 
			 ((document.pg_booking_form.departCity.value=='REP') && (document.pg_booking_form.returnCity.value=='BKK')) ) {
			
			document.getElementById('actionType_0').disabled = true;
			document.getElementById('actionType_1').checked = true;
		} else {
			document.getElementById('actionType_0').disabled = false;
			document.getElementById('actionType_0').checked = true;
		}
	}*/
}

function CheckOneWay(d) {
	if(d == true) {
		document.pg_booking_form.return_date.style.display="none";
		document.pg_booking_form.return_cal_img.style.display="none";
		document.pg_booking_form.retDate_label.style.display="none";
		document.pg_booking_form.Direction_ow.checked=true;
		document.pg_booking_form.Direction_rt.checked=false;
	} else {
		document.pg_booking_form.return_date.style.display="";
		document.pg_booking_form.return_cal_img.style.display="";
		document.pg_booking_form.retDate_label.style.display="";
		document.pg_booking_form.Direction_ow.checked=false;
		document.pg_booking_form.Direction_rt.checked=true;
	}
}

function CheckPassenger() {
	var a = parseInt(document.pg_booking_form.ADT.value);
	var b = parseInt(document.pg_booking_form.CHD.value);
	//var c = parseInt(document.pg_booking_form.INF.value)
	//var d = parseInt(document.pg_booking_form.IFS.value);
	
	if(b != null) {
		if (a == 6) {
			document.pg_booking_form.CHD.selectedIndex = 0;
			//document.pg_booking_form.INF.selectedIndex = 0;
		}
	
		a = 6 - a;
		var box = document.pg_booking_form.CHD;
		box.options.length = 0;
		
		for (i = 0; i <= a; i++) {
			box.options[i] = new Option(''+i,i);
		}
	
	/*if(document.getElementById("cboInfant") != null) {
		var c = (7-(a+b));
		var box2 = document.getElementById("cboInfant");
		box2.options.length = 0;
		for (j=0;j<c;j++) {
			box2.options[j] = new Option(''+j,j);
		}
	}*/
	}
}

function checkCouponNumber() {
	var adtNum = parseInt(document.pg_booking_form.ADT.value);
	var chdNum = parseInt(document.pg_booking_form.CHD.value);
	//var infNum = parseInt(document.pg_booking_form.INF.value);
	//var ifsNum = parseInt(document.pg_booking_form.IFS.value);
	
	var total_pax_num = adtNum + chdNum; // + infNum + ifsNum
	
	// Add more pax //
	for (i = 2; i <= total_pax_num; i++) {
		document.getElementById('coupon_'+i).disabled = false;
		document.getElementById('coupon_'+i).style.display = "";
	}
	
	// Remove pax //
	for (j = total_pax_num + 1; j <= 6; j++) {
		document.getElementById('coupon_'+j).disabled = true;
		document.getElementById('coupon_'+j).style.display = "none";
	}
	
}