function CheckAdult(bedtype_id, adult_id, child_id)
{
  if (bedtype_id.value == '1') {
    if (adult_id.value > '1') {
	  alert('If you select \"Single Bed\" with more then one adult, there is no aditional bed.\n Please select \"Doble Bed\" or \"Triple Bed\" ');
	  adult_id.value = '1';
	  child_id.value = '0';
	}  else {
	  if (adult_id.value == '1' && child_id.value == '1') {
	    alert('If you select \"Single Bed\" with one adult and one child, there is no aditional bed. The child need to share the exiting bedding. If you want to guarantee a separate bed, please click on \"Double/Twin Bed\"');
	  } else {
	    if (adult_id.value == '1' && child_id.value > '1') {
		  alert('If you select \"Single Bed\" with one adult and more then one child, there is no aditional bed. Please select \"Double Bed\" or \"Triple Bed\" for more the one child');
		  child_id.value = '0';
		} else {
		  if (adult_id.value < '1' || child_id.value < '0') {
		    adult_id.value = '1';
			child_id.value = '0';
		  } 
		}
	  }
	}
  } else {
    if (bedtype_id.value == '2') {
	  if (adult_id.value > '2') {
	    alert('If you select \"Double/Twin Bed\" with more then two adult, there is no aditional bed. Please select \"Triple Bed\" for more the two adult');
	    adult_id.value = '2';
	  } else {
	    if ((adult_id.value == '1' && child_id.value == '2') || (adult_id.value == '2' && child_id.value == '1')) {
	      alert('If you select \"Double/Twin Bed\" with one adult and two child, or two adult and one child, there is no aditional bed. The child need to share the exiting bedding. If you want to guarantee a separate bed, please click on \"Triple Bed\"');
		} else {
		  if ((adult_id.value == '1' && child_id.value > '2') || (adult_id.value =='2' && child_id.value > '1')) {
	        alert('If you select \"Double/Twin Bed\" with one adult and more then two adult, or two adult and more than one child, there is no aditional bed. The child need to share the exiting bedding. Please click on \"Triple Bed\"');
			adult_id.value = '2';
			child_id.value = '0';
		  } else {
		    if (adult_id.value < '1' || child_id.value < '0') {
			  adult_id.value = '2';
			  child_id.value = '0';
		    }
		  }
		}  
	  } 
	} else {
	  if (bedtype_id.value == '3') {
	    if (adult_id.value > '3') {
	      alert('If you select \"Triple Bed\" with more then three adult, there is no aditional bed. Please select more rooms');
	      adult_id.value = '3';
	    } else {
		  if ((adult_id.value == '1' && child_id.value == '3') || (adult_id.value == '2' && child_id.value == '2') || (adult_id.value == '3' && child_id.value == '1')) {
	        alert('There is no aditional bed. The child need to share the exiting bedding. If you want to guarantee a separate bed, please select more rooms');
	      } else {
		    if ((adult_id.value == '1' && child_id.value > '3') || (adult_id.value == '2' && child_id.value > '2') || (adult_id.value == '3' && child_id.value > '1')) {
	          alert('There is no aditional bed. The child need to share the exiting bedding. Please select more rooms');
			  adult_id.value = '3';
			  child_id.value = '0';
			} else {
			  if (adult_id.value < '1' || child_id.value < '0') {
			    adult_id.value = '3';
			    child_id.value = '0';
			  }
			}
		  }
		}
	  }
	} 
  }
}

function showRoom(the_id)
{
  for (var i=1; i<=10; i++) {
    document.getElementById('room'+i).style.display = 'none';
  }
  for (var x = 1; x <= the_id; x++) {
    document.getElementById('room'+x).style.display = '';
  }
}

function updateCheckOut(checkInD,checkInM,checkInY,nbNights,printD,printM,printY) {
todaydate = new Date();
checkindate = new Date(checkInY.value, checkInM.value - 1, checkInD.value, 23, 59, 59);
if ( todaydate > checkindate ) {
  alert('Check-in Date must greather than to day date... !');
  checkInD.value = todaydate.getDate();
  checkInM.value = todaydate.getMonth()+1;
  checkInY.value = todaydate.getYear(); 
  return 1;
} 
echoCheckOutD = document.getElementById(printD);
echoCheckOutM = document.getElementById(printM);
echoCheckOutY = document.getElementById(printY); 
ScheckOut = document.getElementById(print.value);  
if ((checkInD.value!=null) || (checkInM.value!=null) || (checkInY.value!=null)){
var thedate = new Date(2006,04-1,20);
thedate.setFullYear(checkInY.value, checkInM.value-1, checkInD.value);
if (thedate.getDate() != checkInD.value) {
checkInD.value=thedate.getDate();
checkInM.value=thedate.getMonth()+1;
checkInY.value=thedate.getFullYear();
}

thedate.setDate(thedate.getDate()+parseInt(nbNights.value));
months = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
echoCheckOutD.innerHTML = thedate.getDate();
echoCheckOutM.innerHTML = months[thedate.getMonth()];
echoCheckOutY.innerHTML = thedate.getFullYear();
return 1;
}
}
function ChangeAdultChild(bedtype_id, adult_id, child_id)
{
  if (bedtype_id.value == '1') {
    adult_id.value = '1';
	child_id.value = '0';
  } else {
    if (bedtype_id.value == '2') {
	  adult_id.value = '2';
	  child_id.value = '0';
	} else {
	  if (bedtype_id.value == '3') {
	    adult_id.value = '3';
	    child_id.value = '0';
	  }
	}
  }
}


