function prepareBookingForm()
{
	var hotel = document.forms['frmBooking'].elements['hid'].value;
	
	var currentTime = new Date();
	
	var rYear =		2010;
	var rMonth = 	9; // 0-indexed monthsÊÐ June is actually 5, July is actually 6.Ê
	var rDate =		27;
	var rHour = 	4;
	
	var redirectTime =	new Date(rYear, rMonth, rDate, rHour, 0, 0);
	
	//var redirect = (currentTime.valueOf() > redirectTime.valueOf());
	var redirect = false;
	switch (hotel)
	{
		case 'COTS':
			formAction = (redirect) 
							? "http://www.cotswoldwaterparkhotel.co.uk/booking-_200/"
							: "https://webbookings.four-pillars.co.uk/waterpark";
		break;	

		case 'ABIN':
			formAction = (redirect)
							? "http://abingdon-hotel.four-pillars.co.uk/booking-_47"
							: "https://webbookings.four-pillars.co.uk/abingdon";
		break;	
		case 'OXFS':
			formAction = (redirect)
							? "http://oxford-spires-hotel.four-pillars.co.uk/booking-_74"
							: "https://webbookings.four-pillars.co.uk/oxspires";
		break;	
		case 'OXFT':
			formAction = (redirect)
							? "http://oxford-thames-hotel.four-pillars.co.uk/booking-_78"
							: "https://webbookings.four-pillars.co.uk/OxThames";
		break;	
		case 'TORT':
			formAction = (redirect) 
							? "http://tortworth-court-hotel.four-pillars.co.uk/booking-_103"
							: "https://webbookings.four-pillars.co.uk/tortworth";
		break;	
		case 'WITN':
			formAction = (redirect) 
							? "http://witney-hotel.four-pillars.co.uk/booking-_84"
							: "https://webbookings.four-pillars.co.uk/witney";
		break;
		default:
			return;
		break;
	}
	window.location = formAction;
}

function updateDepartureDate()
{
	
	if (document.forms['frmBooking'].noAutoDate == null)
	{
	
		var arrivalDate = document.forms['frmBooking'].elements['arrive'].value;
		var Now = new Date(arrivalDate.substring(3,5)+"/"+arrivalDate.substring(0,2)+"/"+arrivalDate.substring(6,10));
		//alert(Now.valueOf());
		milliseconds = Now.valueOf() + 1000*60*60*24;
		var Tomorrow = new Date(milliseconds);
		//alert(Tomorrow.getDate()+"/"+(Tomorrow.getMonth()+1)+"/"+Tomorrow.getFullYear());
		
		var tomozDate = Tomorrow.getDate();
		var tomozMonth = Tomorrow.getMonth()+1;
		
		var strTomozDate = tomozDate.toString();
		var strTomozMonth = tomozMonth.toString();
		
		if (strTomozDate.length == 1) tomozDate = "0"+strTomozDate;
		if (strTomozMonth.length == 1) tomozMonth = "0"+strTomozMonth;
		
		
		document.forms['frmBooking'].elements['depart'].value = tomozDate+"/"+tomozMonth+"/"+Tomorrow.getFullYear();	

 }
}

function focusDepart()
{
	document.forms['frmBooking'].noAutoDate = true;
}
