//================================================================================//
//	check form befor submit it to step1.asp
//================================================================================//

function check_quicksearch_form(obj_Form){
	if (obj_Form){
		var d_Today        = get_today_date('.');
		var d_CheckInDate  = obj_Form.checkin.value.Trim();
		var d_CheckOutDate = obj_Form.checkout.value.Trim();
		var n_Rooms        = obj_Form.rooms.options[obj_Form.rooms.options.selectedIndex].value.Trim();
		var str_ErrorMsg   = '';

		if (d_CheckInDate.Trim().length < 10){
			str_ErrorMsg += '\n   - Please check your \'Check in date\'.';
		}else{
			if (check_date(d_CheckInDate, '.') != 1){
				str_ErrorMsg += '\n   - Please check your \'Check in date\'.';
			}
		}

		if (d_CheckOutDate.Trim().length < 10){
			str_ErrorMsg += '\n   - Please check your \'Check out date\'.';
		}else{
			if (check_date(d_CheckOutDate, '.') != 1){
				str_ErrorMsg += '\n   - Please check your \'Check out date\'.';
			}
		}

		if (str_ErrorMsg.Trim().length == 0){
			if (check_date(d_CheckInDate, '.') == 1 && check_date(d_CheckOutDate, '.') == 1){
				if (date_ms(d_CheckInDate, '.') <= date_ms(get_today_date('.'), '.')){
					str_ErrorMsg += '\n   - \'Check in date\' must be after today.\t';
				}

				if (date_ms(d_CheckInDate, '.') >= date_ms(d_CheckOutDate, '.')){
					str_ErrorMsg += '\n   - \'Check out date\' must be after \'Check in date\'.\t';
				}
			}
		}

			
		if (n_Rooms == 0){
			str_ErrorMsg += '\n   - Please select \'Number of rooms\'.\t';
		}

		if (str_ErrorMsg.Trim().length > 0){
			str_ErrorMsg = '------------------------------------------------------------\t' + str_ErrorMsg;
			str_ErrorMsg = 'Please correct or provide the required information:\t\n' + str_ErrorMsg;
			alert(str_ErrorMsg);
		}else{
			obj_Form.submit();
		}
	}
}
