function Load()
{

{
f1 = document.form1;
}

if (document.getElementById("CDR2").checked)
{
ShowReturnFromDiv('ReturnFrom', true);
}
if (document.getElementById("CAR2").checked)
{
ShowReturnFromDiv('ReturnTo',true);
}

}

function ShowReturnFromDiv(elementname,truefalse)
{
if (!truefalse)
{
document.getElementById(elementname).style.visibility='hidden';
document.getElementById(elementname).style.display='none';
}
else
{
document.getElementById(elementname).style.visibility='visible';
if (document.all)
{
document.getElementById(elementname).style.display='inline';
}
else
{
document.getElementById(elementname).style.display='table-row';
}
}
}

function checkForm()
{
if (f1.NSI[f1.NSI.selectedIndex].value > f1.NSA[f1.NSA.selectedIndex].value)
{
alert("Airline regulations stipulate that you must travel with one adult per infant.\nIf you are travelling with " + f1.NSI[f1.NSI.selectedIndex].value + " infants, then you must take " + f1.NSI[f1.NSI.selectedIndex].value + " adults.");
f1.NSA.focus();
return false
}

if (f1.CD1.value == "")
{
alert("Please specify departure city or airport");
f1.CD1.focus();
return false
}
			
else if (f1.CA1.value.length<3)
{
alert("Please specify destination city or airport");
f1.CA1.focus();
return false
}

//Variables for today's date
var today  = new Date();

//Variables for Depart date
var depDay = f1.DD1[f1.DD1.selectedIndex].text;
var depMonth = f1.MD1[f1.MD1.selectedIndex].value.substr(0,2);
var depYear = f1.MD1[f1.MD1.selectedIndex].value.substr(2,6);
var depDate = new Date(depYear, (depMonth-1), depDay);

//Variables for Arrive date
var ArrDay = f1.DD2[f1.DD2.selectedIndex].text;
var ArrMonth = f1.MD2[f1.MD2.selectedIndex].value.substr(0,2);
var ArrYear = f1.MD2[f1.MD2.selectedIndex].value.substr(2,6);
var ArrDate = new Date(ArrYear, (ArrMonth-1), ArrDay);

//Figure out number of days
DayCalc = 24*60*60*1000;
DepDayDiff = depDate.getTime() - today.getTime();
ArrDayDiff = ArrDate.getTime() - today.getTime();
var DepdaysLeft = DepDayDiff / DayCalc;
var ArrdaysLeft = ArrDayDiff / DayCalc;

//Round number of days to an integer
DepdaysLeft = Math.floor(DepdaysLeft) + 1;
ArrdaysLeft = Math.floor(ArrdaysLeft) + 1;

//Check to see if depDate is within 2 and 330 days of today
if (DepdaysLeft <0)
{alert("Please select a departure date that is in the future. Please note that this error may sometimes be displayed if the year is set incorrectly in your computer's Date/Time system settings.");
return false;}

//Check to see if ArrDate is within 2 and 330 days of today

if (ArrdaysLeft <0)
{alert("Please select a return date that is in the future.  Please note that this error may sometimes be displayed if the year is set incorrectly in your computer's Date/Time system settings.");
return false;}

//Check to see if trying to fly out after coming back!
if (ArrdaysLeft <DepdaysLeft)
{alert("Return date MUST BE AFTER Departure Date");
return false;}

f1.action="http://manx.ticketwindow.co.uk/tc.dll?ac=search&st=fares&tid=flybeli2";
f1.method="post";
f1.submit();

//document.getElementById("button").style.display = "none";
//document.getElementById("searching").style.display = "block";

return true;
}