
<!--
function DateAdd(startDate, numDays, numMonths, numYears)
{
	var returnDate = new Date(startDate.getTime());
	var yearsToAdd = numYears;

	var month = returnDate.getMonth()	+ numMonths;
	if (month > 11)
	{
		yearsToAdd = Math.floor((month+1)/12);
		month -= 12*yearsToAdd;
		yearsToAdd += numYears;
	}
	returnDate.setMonth(month);
	returnDate.setFullYear(returnDate.getFullYear()	+ yearsToAdd);

	returnDate.setTime(returnDate.getTime()+60000*60*24*numDays);

	return returnDate;

}

function checkformhotel() {
var thefrm = document.hxhotelform;

arrivalday = thefrm.day.options[thefrm.day.selectedIndex].value;
arrivalyear = thefrm.my.options[thefrm.my.selectedIndex].value.substr(3,4);
arrivalmonth = thefrm.my.options[thefrm.my.selectedIndex].value.substr(0,3);

if(arrivalday.length < 2) {
arrivalday = "0"+arrivalday;
}

thefrm.ArrivalDate.value = arrivalday+thefrm.my.options[thefrm.my.options.selectedIndex].value;



if(arrivalmonth == "JAN") {
arrivalmonth = 1;
}

if(arrivalmonth == "FEB") {
arrivalmonth = 2;
}

if(arrivalmonth == "MAR") {
arrivalmonth = 3;
}

if(arrivalmonth == "APR") {
arrivalmonth = 4;
}

if(arrivalmonth == "MAY") {
arrivalmonth = 5;
}

if(arrivalmonth == "JUN") {
arrivalmonth = 6;
}

if(arrivalmonth == "JUL") {
arrivalmonth = 7;
}

if(arrivalmonth == "AUG") {
arrivalmonth = 8;
}

if(arrivalmonth == "SEP") {
arrivalmonth = 9;
}

if(arrivalmonth == "OCT") {
arrivalmonth = 10;
}

if(arrivalmonth == "NOV") {
arrivalmonth = 11;
}

if(arrivalmonth == "DEC") {
arrivalmonth = 12;
}


arrivaldate = new Date(arrivalyear,arrivalmonth-1,arrivalday,23,59);
thedate = new Date();
jsdate = DateAdd(thedate, 320, 0, 0);

//alert(jsdate+"\n"+arrivaldate);

theday = new Date();

if (arrivaldate < theday){
     	alert('Your arrival date cannot be BEFORE today');
	thefrm.day.focus();
        return false;
    	}


if(arrivaldate > jsdate) {
thefrm.outday.value = arrivalday;
thefrm.outdate.value = thefrm.my.options[thefrm.my.selectedIndex].value;
thefrm.profile.value = "abcins";
thefrm.airport.value = thefrm.Location.value;
thefrm.method = "get";
thefrm.action = "http://www.holidayextras.co.uk/email/bookingengine/redirect_hotel.asp";
} else {
thefrm.action = "http://secure.holidayextras.co.uk/hotels/?agent=wv604";
thefrm.method = "post";
}
thefrm.submit();


}

// bit that sorts out the date
document.write('<select class="form" name="day">') ;
thedate = new Date();

for(i=1;i<32;i++) {
if(thedate.getDate() == i) {
var selected = "selected";
} else {
selected = "";
}

if(i<10){
leadzero = "0";
} else {
leadzero = "";
}
document.write('<option '+selected+' value="'+leadzero+i+'">'+leadzero+i+'</option>')
}
document.write('</select><select class="form" name="my">') ;

var longmonth = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
var shortmonth = new Array("JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC");
thedate = new Date();
themonth = thedate.getMonth();
theyear = thedate.getFullYear();



// always set current month to 1st of the month
newdate = new Date(theyear, themonth, 1);

for(i=0; i < 13; i++)
{
	thedate = DateAdd(newdate,0,i,0);
	themonth = thedate.getMonth();
	theyear = thedate.getFullYear();
	theyear = theyear.toString();
	document.write('<option value="'+shortmonth[themonth]+theyear+'">'+longmonth[themonth]+' '+theyear+'</option>');
}
document.write('</select>') ;

// -->