//room number - room types

function roomTypes(objNumRooms) {
	var nSelectedIndex = objNumRooms.selectedIndex;
//alert ('nSelectedIndex = '+nSelectedIndex);
	var numRooms = document.getElementById('num_rooms').options[nSelectedIndex].value;
//alert ('num Rooms = '+numRooms);
	
	if (numRooms<1) {
		numRooms = 1;
	}
	for (i=2;i<=3;i++) {
		RoomTypeId = 'RoomType'+i;
		NumGuests = 'NumGuests'+i;
		GuestRoomTypeId = 'RoomType1'+i;
		RoomIDType = 'Room'+i+'Type';
//alert ('Room type = '+RoomTypeId);
		if (i<=numRooms) {
			document.getElementById(RoomTypeId).style.display="block";
			document.getElementById(NumGuests).disabled=false;
			document.getElementById(GuestRoomTypeId).style.display="block";
			document.getElementById(RoomIDType).disabled=false;
		} else {
			document.getElementById(RoomTypeId).style.display="none";
			document.getElementById(NumGuests).disabled=true;
			document.getElementById(GuestRoomTypeId).style.display="none";
			document.getElementById(RoomIDType).disabled=true;
		}
		
	}
}

// function for validate form
function validateForm() {
	FirstName = document.getElementById('first_name');
	LastName = document.getElementById('last_name');
	Email = document.getElementById('email');
	if (FirstName.value.length<1) {
		alert ("Please fill the First Name field");
		FirstName.focus();
		return false;
	}
	if (LastName.value.length<1) {
		alert ("Please fill the Last Name field");
		FirstName.focus();
		return false;
	}
	if (Email.value.length<1) {
		alert ("Please fill the Email");
		FirstName.focus();
		return false;
	}

	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(Email.value)) {
		alert("Please provide a valid email address");
		Email.focus
		return false;
	}

	return true;
}