// JavaScript Document

function groups()
{
var box = document.DateForm.iAdults;
var number;
	number = box.options[box.selectedIndex].value;
if (number==4)
{
	alert("For group bookings, please contact: 01480 212625 or email: reservations@wybostonlakes.co.uk");
	var DateForm = document.DateForm;
	DateForm.iAdults.selectedIndex = 0 ;
	}
}

function rooms()
{
var box = document.DateForm.iRooms;
var number;
	number = box.options[box.selectedIndex].value;
if (number==2)
{
	alert("Multiple room booking is currently only available for corporate clients, to access this feature please enter your Corporate ID and click Go.");
	var DateForm = document.DateForm;
	DateForm.iRooms.selectedIndex = 0 ;
	}
}

function setDates()
	{
	
	var d = new Date();
		var DateForm = document.DateForm;
		DateForm.ArvMM.selectedIndex = d.getMonth();
		DateForm.ArvDD.selectedIndex = d.getDate()-1;
		DateForm.iNgts.selectedIndex =0;
		DateForm.iAdults.selectedIndex =0;
		DateForm.iRooms.selectedIndex =0;
		DateForm.ArvYY.selectedIndex=0;
	}
	
function checkthis()
{

String.prototype.trim = function () {
    return this.replace(/^\s*/, "").replace(/\s*$/, "");
}



if (document.DateForm.CorpID.value.trim()=='')
{
document.DateForm.submit();
}
else
{
var day = document.DateForm.ArvDD.value;
var month = document.DateForm.ArvMM.value;
var year = document.DateForm.ArvYY.value;
var nights = document.DateForm.iNgts.value;
var corporateid = document.DateForm.CorpID.value;

var append = "day=" + day + "&month=" + month + "&year=" + year + "&nights=" + nights + "&corporateid=" + corporateid;

window.location='https://www.wybostonlakesbookings.co.uk/v1web/multibooking.aspx?' + append;
}

}

function setDates2()
	{
	
	var d = new Date();
		var DateForm2 = document.DateForm2;
		DateForm2.month1.selectedIndex = d.getMonth();
		DateForm2.day.selectedIndex = d.getDate()+1;
	returnCorrectDate();
	}

function returnCorrectDate()
{

var d = new Date();

var noOfDays = daysInMonth(d.getMonth(),d.getYear());

	if (d.getDate() > (noOfDays-2))
	{
	
		DateForm2.month1.selectedIndex = d.getMonth()+1;
		DateForm2.day.selectedIndex = d.getDate()-(noOfDays-1);
	
	}

}


function daysInMonth(iMonth, iYear)
{
	return 32 - new Date(iYear, iMonth, 32).getDate();
}