var loading_status = "<table width='100px' border='0' cellpadding='0' cellspacing='0'><tr><td align='center'><img src='tbrsys/images/loading.gif' /></td></tr><tr><td align='center'>Please wait...</td></tr></table>";

/* start *****************************************************************************************************/

function ajax_PreviewRoomType(serverPage,str) {	
	document.getElementById("divinfo").innerHTML = loading_status;
	document.getElementById("divinfo").style.visibility = "visible";
	
	xmlhttp.open("POST", serverPage, true);
	xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			document.getElementById("divinfo").style.visibility = "hidden";

			var array = xmlhttp.responseText.split("|dt*o*r|");				

			var str2;
			var str3;	
			
			str2 = '';
			str3 = '';			
			
			if(array[3]!=''){
				str2  = '<table cellpadding="0" cellspacing="0" border="0">';
				str2 += '<tr>';
				str2 += '<td><img width="365" src="tbrsys/roomphoto/'+array[0]+'/'+array[3]+'" /></td>';
				str2 += '</tr>';
				str2 += '</table>';	
			}else{
				str2  = '<table cellpadding="0" cellspacing="0" border="0">';
				str2 += '<tr>';
				str2 += "<td width='365' height='274'></td>";
				str2 += '</tr>';
				str2 += '</table>';		
			};
			
			str3  = "<table cellpadding='0' cellspacing='0' border='0'>";
			str3 += '<tr>';
			str3 += "<td class='field_label1'>Room Rate: RM " + array[1] + "</td>";
			str3 += '</tr>';
			str3 += "<tr height='20px'><td></td></tr>";
			str3 += '<tr>';
			str3 += "<td class='field_label1'>" + array[2] + "</td>";
			str3 += '</tr>';					
			str3 += '</table>';						
			
			document.getElementById("main_photo").innerHTML = str2;	
			document.getElementById("room_descr").innerHTML = str3;			
			
		};
	};
	xmlhttp.send(str);	
};

function ajax_GetThumbNailPhoto(serverPage,str) {	
	document.getElementById("divinfo").innerHTML = loading_status;
	document.getElementById("divinfo").style.visibility = "visible";
	
	xmlhttp2.open("POST", serverPage, true);
	xmlhttp2.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	xmlhttp2.onreadystatechange = function() {
		if (xmlhttp2.readyState == 4 && xmlhttp2.status == 200) {
			document.getElementById("divinfo").style.visibility = "hidden";

			var array = xmlhttp2.responseText.split("|dt*o*r|");		
			var roomid = array[0];						
			var arr_thumbnailphotolist = array[2].split("|");		
			var arr_photolist = array[3].split("|");
			
			var x;
			var str2;
			str2 = '';			

			for (x=0; x<arr_thumbnailphotolist.length; x++){
				if(arr_thumbnailphotolist[x]!="") {
					str2 += "<div class='thumbnail'>";
					str2 += "<table class='photoframe' cellpadding='0' cellspacing='0' border='0'>";
					str2 += "<tr>";
					str2 += "<td><a href='#'><img onclick=\"showPhoto('"+roomid+"','"+arr_photolist[x]+"')\" src='tbrsys/roomphoto/"+roomid+"/"+arr_thumbnailphotolist[x]+"' border='0' /></a></td>";
					str2 += "</tr>";
					str2 += "</table>";	
					str2 += "</div>";	
				};					
			};					
	
			document.getElementById("right_inner_2").innerHTML = str2;			
		};
	};
	xmlhttp2.send(str);	
};

function ajax_CheckAvailability(serverPage,str) {	
	document.getElementById("divinfo").innerHTML = loading_status;
	document.getElementById("divinfo").style.visibility = "visible";
	
	xmlhttp.open("POST", serverPage, true);
	xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			document.getElementById("divinfo").style.visibility = "hidden";
			
			var array = xmlhttp.responseText.split("|dt*o*r|");		
			//alert(xmlhttp.responseText)
			switch(array[0]){
			case "Y":					
				
				document.frmReservation.h_available_key.value = array[1];
				document.frmReservation.h_id.value = array[2];
				document.frmReservation.h_checkin.value = array[3];
				document.frmReservation.h_checkout.value = array[4];				
				document.frmReservation.h_quantity.value = array[5];
				document.frmReservation.h_adult.value = array[6];
				document.frmReservation.h_children.value = array[7];
				document.frmReservation.h_numofnights.value = array[8];
				document.frmReservation.h_amount.value = array[9];
				document.frmReservation.h_ratetouselist.value = array[10];
				document.frmReservation.h_remark.value = array[11];
				//document.frmReservation.promotion.value = array[12];
				//location.href = 'reservation.php?step=2';
				document.frmReservation.method = "post";	
				document.frmReservation.action = "reservation.php?step=2"; 
				document.frmReservation.target = "_self";
				document.getElementById("frmReservation").submit();
				
				
				break;				
			case "N":
				document.getElementById('msg').innerHTML = '- Your room is Unavailable -<br>- Please select another date -';
				break;
			};		
		};
	};
	xmlhttp.send(str);	
};

function ajax_ShowGetGuestInfo(serverPage,str) {	
	document.getElementById("divinfo").innerHTML = loading_status;
	document.getElementById("divinfo").style.visibility = "visible";
	
	xmlhttp.open("POST", serverPage, true);
	xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			document.getElementById("divinfo").style.visibility = "hidden";
			
			document.getElementById("right2").innerHTML = xmlhttp.responseText;
					
		};
	};
	xmlhttp.send(str);	
};

function ajax_ProceedToPayment(serverPage,str) {	
	document.getElementById("divinfo").innerHTML = loading_status;
	document.getElementById("divinfo").style.visibility = "visible";
	
	xmlhttp.open("POST", serverPage, true);
	xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			document.getElementById("divinfo").style.visibility = "hidden";
			
			var array = xmlhttp.responseText.split("|");		
			//alert(xmlhttp.responseText)
			switch(array[0]){
			case "Y":						
				document.frmReservation.h_available_key.value = array[2];
				document.frmReservation.h_chdt.value = array[2];
				document.frmReservation.h_seqno.value = array[3];
				
				document.frmReservation.method = "post";	
				document.frmReservation.action = "reservation.php?step=3"; 
				document.frmReservation.target = "_self";
				document.getElementById("frmReservation").submit();
				
				break;				
			case "N":
				alert("Error: insert into guest");					
				break;
			case "X":
				alert("Error: insert into booking");	
				break;
			case "XD":
				alert("Error: insert into booking detail");		
				break;	
			case "NA":
				alert("Sorry, your room has been taken just now.\nPlease check another date again.");
				location.href = 'reservation.php';
				break;	
			case "UE":
				alert("Error: update room balance");	
				break;
			
			};		
		};
	};
	xmlhttp.send(str);	
};
/* end *****************************************************************************************************/

function previewRoomType(){
	var str = "";
			
	var roomtype    = document.frmReservation.cboRoomType.value;

	str  = "id=" + roomtype + "&";	

	ajax_PreviewRoomType("engine_previewroomtype.php", str);	
	ajax_GetThumbNailPhoto("engine_getthumbnailphoto.php", str);	
};

function showPhoto(id,photoname){
	var str2;
	
	str2  = '<table cellpadding="0" cellspacing="0" border="0">';
	str2 += '<tr>';
	str2 += '<td><img width="365" src="tbrsys/roomphoto/'+id+'/'+photoname+'" /></td>';
	str2 += '</tr>';
	str2 += '</table>';	
			
	document.getElementById("main_photo").innerHTML = str2;		
};

function checkAvailability(){
	
	if(document.frmReservation.txtremark.value.length>100){
		alert("Remark only allowed 100 characters");	
		return false;
	};
	
	if(document.frmReservation.txtremark.value.indexOf("@")>-1 ||
	   document.frmReservation.txtremark.value.indexOf("#")>-1 ||
	   document.frmReservation.txtremark.value.indexOf("$")>-1 ||
	   document.frmReservation.txtremark.value.indexOf("%")>-1 ||
	   document.frmReservation.txtremark.value.indexOf("&")>-1 ||
	   document.frmReservation.txtremark.value.indexOf("|")>-1){
		
		alert("Remark should not have special characters");	
		return false;
	};
	
	var id = document.frmReservation.cboRoomType.value;
	var quantity = document.frmReservation.cboQuantity.value;
	var adult = document.frmReservation.cboAdult.value;
	var children = document.frmReservation.cboChildren.value;
	var remark = document.frmReservation.txtremark.value;

	var todaydt = new Date();
	var todayday = todaydt.getDate();
	var todaymth = todaydt.getMonth()+1;
	var todayyr  = todaydt.getYear();	
	
	var minutes = 1000*60;
	var hours = minutes*60;
	var days = hours*24;
	var years = days*365;
	
	//var h = todaydt.getHours()
    //var m = todaydt.getMinutes()
	
	/**************************************************/
	var checkindt = new Date();		
	var checkin = document.frmReservation.checkin.value;
	var checkin_day = checkin.substr(8,3);
	var checkin_mth = checkin.substr(5,2);
	var checkin_yr  = checkin.substr(0,4);
	checkindt.setMonth(checkin_mth-1);
	checkindt.setDate(checkin_day);
	checkindt.setFullYear(checkin_yr);
	
	if(todayday==checkin_day&&todaymth==checkin_mth&&todayyr==checkin_yr){
		alert("Reservation cannot be same as today date");
		document.getElementById('msg').innerHTML = '';
		return false;
	};		
	/**************************************************/	
	
	var checkoutdt = new Date();	
	var checkout = document.frmReservation.checkout.value;
	var checkout_day = checkout.substr(8,3);
	var checkout_mth = checkout.substr(5,2);
	var checkout_yr  = checkout.substr(0,4);		
    checkoutdt.setMonth(checkout_mth-1);
	checkoutdt.setDate(checkout_day);
    checkoutdt.setFullYear(checkout_yr);
		
	if(checkindt > checkoutdt){
		alert("Check-out date must be greater than Check-in date");
		document.getElementById('msg').innerHTML = '';
		return false;
	};
	
	if(checkin_day==checkout_day&&checkin_mth==checkout_mth&&checkin_yr==checkout_yr){
		alert("Check-in date and check-out date must not be the same");
		document.getElementById('msg').innerHTML = '';
		return false;
	};
	
	var numofbookdays = (checkoutdt - checkindt)/days;
	
	checkindt.setHours(15);
	checkindt.setMinutes(0);
	
	//bookdt.setTime(bookdt.getTime())
	//bookdt.setDate(bookdt.getDate()+4)
	//alert(bookdt)
	//alert((bookdt - todaydt)/hours)
	
	if((checkindt - todaydt)/hours < 24){
		alert("Reservation has to made 24 hours before\ncheck-in. Please try again.");
		document.getElementById('msg').innerHTML = '';
		return false;
	};

	

	//document.frmReservation.method = "post"	
	//document.frmReservation.action = "reservation.php?step=2" 	
	//document.frmReservation.target = "_self"
	//document.getElementById("frmReservation").submit()	
	
	str  = "id=" + id + "&"	;
	str += "checkin=" + checkin + "&";
	str += "checkout=" + checkout + "&";
	str += "quantity=" + quantity + "&";
	str += "adult=" + adult + "&";
	str += "children=" + children + "&";
	str += "numofnights=" + numofbookdays + "&";
	str += "remark=" + remark + "&";

	ajax_CheckAvailability("engine_checkavailability.php", str);	
};

function showAddOns(obj){
	var cnt = obj.value;
	if(obj.checked){
		document.getElementById("cboQty_"+cnt).disabled = false;
		document.getElementById("cboNight_"+cnt).disabled = false;
	}else{
		document.getElementById("cboQty_"+cnt).disabled = true;
		document.getElementById("cboNight_"+cnt).disabled = true;
		document.getElementById("cboQty_"+cnt).value = 0;
		document.getElementById("cboNight_"+cnt).value = 0;
	};
	
	getAddOns(obj);
};

function getAddOns(obj){
	var amount = document.frmReservation.h_amount.value;
	var discount = document.frmReservation.discountvalue.value;
	amount = amount * 1;
	var beforediscount;
	var price;
	var firsttime;
	var amount1;
	firsttime = 'Y';
     var discount1 = 0;
	var numofaddons = document.getElementById("h_numof_addons").value;
	var str, addon_str;
	str  = '<table width="100%" cellpadding="0" cellspacing="0" border="0">';
	
	for(x=1;x<=numofaddons;x++){
		if(document.getElementById("chkaddons_"+x).checked){			
			
			addon_str = document.getElementById("h_descr_"+x).value + ' (' + 
					    document.getElementById("cboQty_"+x).value + ' x ' + 
						document.getElementById("h_currency_"+x).value + ' ' +
						document.getElementById("h_price_"+x).value + ' for ' +
						document.getElementById("cboNight_"+x).value + ' night(s))';			
			

			price = Number(document.getElementById("cboQty_"+x).value) * Number(document.getElementById("h_price_"+x).value) * Number(document.getElementById("cboNight_"+x).value);
			//price = price.toFixed(2)			
			
			if(firsttime=='Y'){
				str += '<tr class="field_label1">';
				str += '<td colspan="4" class="field_label1_bold_underline">Add-ons</td>';	
				str += '</tr>';
				str += '<tr height="5px"><td></td></tr>';		
				firsttime = 'N';
			};
	
	
			str += '<tr class="field_label1">';
			str += '<td colspan="2">'+addon_str+'</td>';		
			str += '<td>:</td>';
			str += '<td class="field_label1_bold">'+price.toFixed(2)  +'</td>';
			str += '</tr>';
			str += '<tr height="5px"><td></td></tr>';			
		
			//alert(amount)
			//alert(price)
			//amount = Number(amount) + Number(price)-(Number(price)*discount);//close it for normal no addon discount
			amount = Number(amount) + Number(price);//for normal no addon discount
			//discount1=discount1+ Number(price)*discount;//close it for normal no addon discount
		//amount = Number(amount) + Number(price);
			//amount = amount.toFixed(2) 
			
		};
	};
	var amount1;
	beforediscount = amount;
	amount1=price*discount;
    //amount=amount-amount1;
    //document.frmReservation.discount1.value = discount1;//close it for normal no addon discount
	document.frmReservation.h_calamount.value = amount;
	//var afteraddon = amount;
	document.getElementById('afteraddon').value=amount;
	/*str += '<tr class="field_label1">';
	str += '<td width="47%">Discount is</td>';
	str += '<td width="6%"></td>';
	str += '<td width="3%">:</td>';
	str += '<td width="44%" class="field_label1_bold">'+discount1.toFixed(2)+'</td>';
	str += '</tr>';*///open it for addon discount
	str += '<tr class="field_label1">';
	str += '<td width="47%">Super Saver Total</td>';
	str += '<td width="6%">(RM)</td>';
	str += '<td width="3%">:</td>';
	str += '<td width="44%" class="field_label1_bold">'+amount.toFixed(2)+'</td>';
	str += '</tr>';
	str += '</table>';
	
	document.getElementById('addons').innerHTML = str;
	
};

function Proceed(opt){
switch(opt){
	case '1':
	    //var membernum1=document.frmReservation.membernum.value;
		ajax_ShowGetGuestInfo("engine_showgetguestinfo.php", str);			
		break;
	case '2':
		if(validateguest()){		
			var conf = confirm("Proceed to Payment?");
			
			if(conf==true){
		
				var todaydt = new Date();
				var todayday = todaydt.getDate();
				var todaymth = todaydt.getMonth()+1;
				var todayyr  = todaydt.getYear();					
				var strdate;
				strdate = todayyr.toString() + pad(todaymth,2,'0',1) + pad(todayday,2,'0',1);
					
				var str = "";
		
				var title  = document.frmReservation.cboTitle.value;
				var fname  = document.frmReservation.txtfname.value;
				var lname  = document.frmReservation.txtlname.value;				
				var nric  = document.frmReservation.txtnric.value;
				var passport  = document.frmReservation.txtpassport.value;
				var add  = document.frmReservation.txtadd.value;
				var postcode  = document.frmReservation.txtpostcode.value;
				var city  = document.frmReservation.txtcity.value;
				var state  = document.frmReservation.cboState.value;
				var country  = document.frmReservation.cboCountry.value;
				var phone  = document.frmReservation.txtphone.value;
				var mobile  = document.frmReservation.txtmobile.value;
				var fax  = document.frmReservation.txtfax.value;
				var email  = document.frmReservation.txtemail.value;
				
				str  = "title=" + title + "&";	
				str += "fname=" + fname + "&";		
				str += "lname=" + lname + "&";				
				str += "nric=" + nric + "&";
				str += "passport=" + passport + "&";
				str += "add=" + add + "&";
				str += "postcode=" + postcode + "&";
				str += "city=" + city + "&";
				str += "state=" + state + "&";
				str += "country=" + country + "&";
				str += "phone=" + phone + "&";
				str += "mobile=" + mobile + "&";
				str += "fax=" + fax + "&";
				str += "email=" + email + "&";				
				
				var id  = document.frmReservation.h_id.value;
				var checkin  = document.frmReservation.h_checkin.value;
				var checkout = document.frmReservation.h_checkout.value;
				var quantity = document.frmReservation.h_quantity.value;
				var adult = document.frmReservation.h_adult.value;
				var children = document.frmReservation.h_children.value;
				var numofnights = document.frmReservation.h_numofnights.value;
				var totalamt = document.frmReservation.h_calamount.value;
				var ratetouselist = document.frmReservation.h_ratetouselist.value;
				var remark = document.frmReservation.h_remark.value;
				var promotion = document.frmReservation.promotion.value;
				var discount = document.frmReservation.discount.value;
				var discount1 = document.frmReservation.discount1.value;
				var discountvalue = document.frmReservation.discountvalue.value;
				var membercode = document.frmReservation.membercode.value;
				
				str += "id=" + id + "&";
				str += "checkin=" + checkin + "&";
				str += "checkout=" + checkout + "&";
				str += "quantity=" + quantity + "&";
				str += "adult=" + adult + "&";	
				str += "children=" + children + "&";	
				str += "numofnights=" + numofnights + "&";	
				str += "totalamt=" + totalamt + "&";	
				str += "chdt=" + strdate + "&";	
				str += "ratetouselist=" + ratetouselist + "&";
				str += "remark=" + remark + "&";
				str += "promotion=" + promotion + "&";
				str += "discount=" + discount + "&";
				str += "discount1=" + discount1 + "&";
				str += "discountvalue=" + discountvalue + "&";
				str += "membercode=" + membercode + "&";
				getAddOnsData();				
				
				var addlist_addon = document.frmReservation.h_addlist_addon.value;
				var addlist_pax = document.frmReservation.h_addlist_pax.value;
				var addlist_nights = document.frmReservation.h_addlist_nights.value;
				var addlist_addonprice = document.frmReservation.h_addlist_addonprice.value;
		
				str += "addlist_addon=" + addlist_addon + "&";
				str += "addlist_pax=" + addlist_pax + "&";
				str += "addlist_nights=" + addlist_nights + "&";
				str += "addlist_addonprice=" + addlist_addonprice + "&";
							
				ajax_ProceedToPayment("engine_proceedtopayment.php", str);			
			};
		};
			
		break;
	};
};

function validateguest(){
	if(document.frmReservation.cboTitle.value==""){
		alert("Please select title");
		document.frmReservation.cboTitle.focus();
		return false;
	};
	
	if(document.frmReservation.txtfname.value==""||document.frmReservation.txtfname.value.replace(/^\s+|\s+$/g, '')==""){
		alert("Please key in your first name");
		document.frmReservation.txtfname.focus();
		return false;
	};
	
	if(document.frmReservation.txtlname.value==""||document.frmReservation.txtlname.value.replace(/^\s+|\s+$/g, '')==""){
		alert("Please key in your last name");
		document.frmReservation.txtlname.focus();
		return false;
	};
	
	/*if(document.frmReservation.txtnric.value==""||document.frmReservation.txtnric.value.replace(/^\s+|\s+$/g, '')==""){
		alert("Please key in NRIC")
		document.frmReservation.txtnric.focus()
		return false
	}*/
	
	if((document.frmReservation.txtnric.value==""||document.frmReservation.txtnric.value.replace(/^\s+|\s+$/g, '')=="")
	   &&(document.frmReservation.txtpassport.value==""||document.frmReservation.txtpassport.value.replace(/^\s+|\s+$/g, '')=="")){
		
		alert("Please key in either NRIC or Passport No.");
		
		if(document.frmReservation.txtnric.value==""||document.frmReservation.txtnric.value.replace(/^\s+|\s+$/g, '')==""){
			document.frmReservation.txtnric.focus();
		}else{
			if(document.frmReservation.txtpassport.value==""||document.frmReservation.txtpassport.value.replace(/^\s+|\s+$/g, '')==""){
				document.frmReservation.txtpassport.focus();
			};
		};
		
		return false;	
	};
	
	if(document.frmReservation.cboCountry.value==""){
		alert("Please select country");
		document.frmReservation.cboCountry.focus();
		return false;
	};
	
	if((document.frmReservation.txtphone.value==""||document.frmReservation.txtphone.value.replace(/^\s+|\s+$/g, '')=="")
	   &&(document.frmReservation.txtmobile.value==""||document.frmReservation.txtmobile.value.replace(/^\s+|\s+$/g, '')=="")){
		
		alert("Please key in either Phone or Mobile phone");
		
		if(document.frmReservation.txtphone.value==""||document.frmReservation.txtphone.value.replace(/^\s+|\s+$/g, '')==""){
			document.frmReservation.txtphone.focus();
		}else{
			if(document.frmReservation.txtmobile.value==""||document.frmReservation.txtmobile.value.replace(/^\s+|\s+$/g, '')==""){
				document.frmReservation.txtmobile.focus();
			};
		};
		
		return false;	
	};
	
	if(document.frmReservation.txtmobile.value!=""){
		if(document.frmReservation.txtmobile.value.length<10){
			alert("Invalid mobile number");
			document.frmReservation.txtmobile.focus();
			return false;
		};
	};
	
	/*if(document.frmReservation.txtphone.value==""||document.frmReservation.txtphone.value.replace(/^\s+|\s+$/g, '')==""){
		alert("Please key in Phone")
		document.frmReservation.txtphone.focus()
		return false
	}
	
	if(document.frmReservation.txtmobile.value==""||document.frmReservation.txtmobile.value.replace(/^\s+|\s+$/g, '')==""){
		alert("Please key in Mobile")
		document.frmReservation.txtmobile.focus()
		return false
	}*/
	
	if(document.frmReservation.txtemail.value==""||document.frmReservation.txtemail.value.replace(/^\s+|\s+$/g, '')==""){
		alert("Please key in email");
		document.frmReservation.txtemail.focus();
		return false;
	};
	
	if(!validateemail(document.frmReservation.txtemail.value)){
    	return false;
  	};

	return true;
};

function validateemail(email){
	if(email.indexOf("@")==-1){
    	alert("You have entered an invalid email. Please enter again.");	
		document.frmReservation.txtemail.focus();
		return false;
  	}else{  
    	if(email.indexOf(".")==-1){
	 		alert("Your email is not complete.");
	  		document.frmReservation.txtemail.focus();
	  		return false;
		}else{
	  		if(email.substr(email.lastIndexOf("."),3).length<3){
	    		alert("Your email is not yet complete.");
	    		document.frmReservation.txtemail.focus();
	    		return false;
      		};  		
		};
  	};
 	return true;
};

function getAddOnsData(){

	var numofaddons = document.frmReservation.h_numof_addons.value;

	document.frmReservation.h_addlist_addon.value = "";
	document.frmReservation.h_addlist_pax.value = "";
	document.frmReservation.h_addlist_nights.value = "";
	document.frmReservation.h_addlist_addonprice.value = "";

	for(x=1;x<=numofaddons;x++){	
		if(eval("document.frmReservation.chkaddons_"+x).checked){			
			document.frmReservation.h_addlist_addon.value = document.frmReservation.h_addlist_addon.value + eval("document.frmReservation.h_addoncode_"+x).value + "|";						
			document.frmReservation.h_addlist_pax.value = document.frmReservation.h_addlist_pax.value + eval("document.frmReservation.cboQty_"+x).value + "|";						
			document.frmReservation.h_addlist_nights.value = document.frmReservation.h_addlist_nights.value + eval("document.frmReservation.cboNight_"+x).value + "|";
			document.frmReservation.h_addlist_addonprice.value = document.frmReservation.h_addlist_addonprice.value + eval("document.frmReservation.h_price_"+x).value + "|";
		};
	};
};

function enableSubmitButton(){
	if(document.getElementById("chkTAC").checked){
		document.getElementById("bttnSubmit").disabled = false;	
	}else{
		document.getElementById("bttnSubmit").disabled = true;
	};
};

function gotoiPay88(){
	document.frmReservation.method = "post"	
	document.frmReservation.action = "https://www.mobile88.com/ePayment/entry.asp" 
	document.frmReservation.target = "_self"
	document.getElementById("frmReservation").submit()
	
//	document.frmReservation.method = "post";	
//	document.frmReservation.action = "reservation.php?step=4"; 
//	document.frmReservation.target = "_self";
//	document.getElementById("frmReservation").submit();
};


