// 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("If you wish to book more than one room, please book each room as a separate booking");
	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 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();
}