function offergettoday()
{
	var currentDate = new Date();
	var millisecs = currentDate.getTime()

	var dayinmillisecs = 24*60*60*1000;

	if (currentDate.getHours() > 12)
	{
	millisecs += dayinmillisecs;
	}

	var newDate = new Date(millisecs);

	var month = newDate.getMonth() + 1;
	var day = newDate.getDate();
	var year = newDate.getFullYear();

	return day + '%2f' + month + '%2f' + year;
}

function offergettomorrow(startDate)
{
	var currentDate = new Date();

	if (currentDate.getHours() > 12)
	{
	currentDate.setDate(currentDate.getDate() + 2);
	}
	else
	{
	currentDate.setDate(currentDate.getDate() + 1);
	}

	var month = currentDate.getMonth() + 1;
	var day = currentDate.getDate();
	var year = currentDate.getFullYear();

	return day + '%2f' + month + '%2f' + year;
}

function offergetbookinglink(hotelCode, refcode, startDate, endDate)
{
	var str = 'http://www.macdonaldhotels.co.uk/bookonline/availability.aspx?ACTION=availability&propertyCode='+hotelCode+'&availabilitySearchCode='+refcode+'&roomCount=1&adultCount1=2&childCount1=0&adultCount2=1&childCount2=0&adultCount3=1&childCount3=0&adultCount4=1&childCount4=0&adultCount5=1&childCount5=0';
	if(startDate == "today")
	{
		startDate = offergettoday();
		endDate = offergettomorrow();
	}
	str += '&arrDate=' + startDate;
	str += '&depDate=' + endDate;
	document.location.href=str;
}

function tempoffergetbookinglink(hotelCode, refcode)
{
	var str = 'http://www.macdonaldhotels.co.uk/bookonline/Availability.aspx?action=PROPERTYDETAIL&propertyCode='+hotelCode+'&availabilitySearchCode='+refcode;
	document.location.href = str;
}