function checkFields_book( ){
var hotelid = document.fm_booking.hotelid.value;
var datein = document.fm_booking.liveInDate.value;
var length = document.fm_booking.length1.selectedIndex+1;

var rooms = 1;//document.fm_booking.rooms.value;//selectedIndex+1;
var adults = document.fm_booking.adults.value;
var child = document.fm_booking.children.value;
var date = datein.split("/");
//===================
var month=date[0];
var in_month=date[0];
var in_date=date[1];
var in_year=date[2];
//==================
if (month == 1){
	month = "JAN";	
}
if (month == 2){
	month = "FEB";	
}
if (month == 3){
	month = "MAR";	
}
if (month == 4){
	month = "APR";	
}
if (month == 5){
	month = "MAY";	
}
if (month == 6){
	month = "JUN";	
}
if (month == 7){
	month = "JUL";	
}
if (month == 8){
	month = "AUG";	
}
if (month == 9){
	month = "SEP";	
}
if (month == 10){
	month = "OCT";	
}
if (month == 11){
	month = "NOV";	
}
if (month == 12){
	month = "DEC";	
}

var date_input = new Date(month + " " + date[1]+", "+date[2]);
date_input.setDate(date_input.getDate() + length);

var out_date = date_input.getDate();
var out_month = date_input.getMonth()+1;
var out_month1 = date_input.getMonth()+1;
var out_year = date_input.getFullYear();

if (out_month == 1){
	out_month = "JAN";	
}
if (out_month == 2){
	out_month = "FEB";	
}
if (out_month == 3){
	out_month = "MAR";	
}
if (out_month == 4){
	out_month = "APR";	
}
if (out_month == 5){
	out_month = "MAY";	
}
if (out_month == 6){
	out_month = "JUN";	
}
if (out_month == 7){
	out_month = "JUL";	
}
if (out_month == 8){
	out_month = "AUG";	
}
if (out_month == 9){
	out_month = "SEP";	
}
if (out_month == 10){
	out_month = "OCT";	
}
if (out_month == 11){
	out_month = "NOV";	
}
if (out_month == 12){
	out_month = "DEC";	
}

if (document.fm_booking.hotelid.value=="0"){
	alert("Please select a hotel");
	document.fm_booking.hotelid.focus();
	return false ;
}

else if (document.fm_booking.datein.value==""){
	alert("Please select a date");
	document.fm_booking.datein.focus();
	return false ;
}
if (hotelid == "mayfairshanghai"){
		
if(adults>4){
		adults=4;
	}
	
	if(adults<1){
		adults=1;
	}
	
	if(child>2){
		child=2;
	}
	
	
	guests = adults + child;
	if(guests>4){
		while(child>0 && guests>4 && adults>0){
			child--;
			guests = adults + child;
			if(guests>4){
				adults--;
			}
			guests = adults + child;
			if(guests<5){
				break;
			}
		}
		
	}

	guests = adults + child;
	window.open("https://www.yourreservation.net/ibe/HASHAMAY/main.html?language=CN&calArrivalDateField="+in_date+"-"+in_month+"-"+in_year+"&calDepartureDateField="+out_date+"-"+out_month1+"-"+out_year+"&occupancy="+guests+"&prsNumChildren="+child+"&prsRoomCount=1&prsRoomAge=0&prsRoomAge=0");
} else {
window.open("https://reservations.ihotelier.com/istay.cfm?hotelid="+hotelid+"&datein="+datein+"&length="+length+"&rooms="+rooms+"&adults="+adults+"&children="+child+"&languageid=1&x=6&y=6");
}
return false;
}