 function dateswitch(item,item2,item3,item4,item5)
  {
 day31 = new Array('Dt','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31');
  day30 = new Array('Dt','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30');
  day28 = new Array('Dt','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28');
  day29 = new Array('Dt','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29');
 var months = new Array('Month','January','February','March','April','May','June','July','August','September','October','November','December');
 var years= new Array(11);
 years[0]="Year";
 var d = new Date();
 var dyfI = parseInt(d.getFullYear());
 for (i = 1; i < years.length; i++)
 {
  years[i]=dyfI;
  dyfI=dyfI+1;
 }
  var data=new String(item2);
  var ddday=new String(item3);
  var ddmon=new String(item4);
  var ddyear=new String(item5);
 rege =/\./i;
  var pos=data.match(rege);
  var thedate=new String(item);

  var posd=thedate.match("-","i");
  var day=thedate.slice(0,posd.index);
  var last=posd.index+1;
     thedate=thedate.slice(last);

  var posd=thedate.match("-","i");
  var mon=thedate.slice(0,posd.index);
  var last=posd.index+1;
     year=thedate.slice(last);

  var form=data.slice(0,pos.index);
  var last=pos.index+1;
  var field=data.slice(last);
  var DaysIMon=DaysInMonth(mon, year);
  calc = parseInt(DaysIMon);
  calc1=calc+1
  DaysObject=document.forms[form].elements[ddday];
  MonthsObject=document.forms[form].elements[ddmon];
  YearsObject=document.forms[form].elements[ddyear];
 DaysObject.options.length=0;
  DaysObject.options.length=calc1;
  for (i=0; i< calc1 ; i++)
    {

   if (calc == 31)DaysObject.options[i].text=day31[i];
   if (calc == 30)DaysObject.options[i].text=day30[i];
   if (calc == 28)DaysObject.options[i].text=day28[i];
   if (calc == 29)DaysObject.options[i].text=day29[i];
 }

  DaysObject.selectedIndex = 0;
   if (parseInt(day) < 10 && parseInt(day) > 0 ){
   day2="0"+day;
   day=day2;
   }
   for (i=0; i< calc1 ; i++)
   {

   if ( day == DaysObject.options[i].text)DaysObject.selectedIndex = i;

   }


    MonthsObject.length=0;
 MonthsObject.length=months.length;
 for (i=0; i< months.length ; i++)
 {
 MonthsObject.options[i].text=months[i];
 }
 if (ddmon=="stmonth"){
 MonthsObjectr=document.forms[form].elements['rtrnmonth'];
 MonthsObjectr.length=0;
 MonthsObjectr.length=months.length;
 for (i=0; i< months.length ; i++)
 {
 MonthsObjectr.options[i].text=months[i];
 }

 }
   MonthsObject.selectedIndex = parseInt(mon);

 YearsObject.length=0;
 YearsObject.length=years.length;
 for (i=0; i< years.length ; i++)
 {
 YearsObject.options[i].text=years[i];
 }
 if (ddyear=="styear"){
 YearsObjectr=document.forms[form].elements['rtrnyear'];
 YearsObjectr.length=0;
 YearsObjectr.length=years.length;
 for (i=0; i< years.length ; i++)
 {
 YearsObjectr.options[i].text=years[i];
 }

      }

 var YrselectedIndex=0;
   for (i=0; i< years.length ; i++)
   {

   if ( year == years[i])YrselectedIndex = i;

   }

   if (YrselectedIndex > YearsObject.options.length)YrselectedIndex=0;
   YearsObject.selectedIndex=YrselectedIndex;

  document.forms[form].elements[field].value="";
  var vWinCal = window.open("", "Calendar");
  if (item3=="stdate" && item4=="stmonth" && item5=="styear"){
  mimic(item3,"rtrndate");
  mimic(item4,"rtrnmonth");
  mimic(item5,"rtrnyear");
  }
  vWinCal.close();

  }
 function showcalendar(targetFieldName, dateValue,item1,item2,item3) {
 var allMonths = ["January", "February", "March", "April", "May", "June",
  "July", "August", "September", "October", "November", "December"];
 var weekdays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
 var nweekstart = 1;
    var dateValue=dateValue+" 0:0:0";

 var theDate = (dateValue == null || dateValue =="" ?  new Date() : formatstd(dateValue));
 var previous = new Date(theDate);
 var monthc=theDate.getMonth();
 monthc=monthc-1;
 previous.setDate(1);
 previous.setMonth(monthc);
 var nextone = new Date(theDate);
 var nextmon=theDate.getMonth()+1;
 nextone.setDate(1);
 nextone.setMonth(nextmon);
 var firstDayofDate = new Date(theDate);
 firstDayofDate.setDate(1);
 firstDayofDate.setDate(1-(7+firstDayofDate.getDay()-nweekstart)%7);
 var dtlastday = new Date(nextone);
 dtlastday.setDate(0);
 var d = new Date();
 var todayday=new String(d.getDate());
 if(todayday.length==1)todayday="0"+todayday;
 var todaymon=new String(d.getMonth());
 if(todaymon.length==1)todaymon="0"+todaymon;
 var todayyr=new String(d.getFullYear());
 var todaycmp=new String(todayyr+todaymon+todayday);
 var todaycmpI=parseInt(todaycmp);

 var writeline = new String (
  "<html>\n"+ "<head>\n"+ "<title>Calendar</title>\n"+"</head>\n"+"<LINK REL='stylesheet' TYPE='text/css' HREF='/stylesheets/calendar.CSS' media='screen'/>"+
  "<body bgcolor=\"#FFFFFF\" >\n"+"<table class=\"V1\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n"+"<tr><td>\n"+
  "<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"100%\">\n"+"<tr>\n<td class=\"V1\"><a href=\"javascript:window.opener.showcalendar('"+
  targetFieldName+"', '"+ formatdts1(previous)+"','"+item1+"','"+item2+"','"+item3+"'"+");\">"+"<img src=\"/images/icons_5.gif\" width=\"16\" height=\"16\" border=\"0\""+
  " alt=\"previous month\"></a></td>\n"+" <td class=\"V1\" colspan=\"5\" align=\"CENTER\">"
  +allMonths[theDate.getMonth()]+" "+theDate.getFullYear()+"</td>\n"+"<td class=\"V1\" align=\"right\"><a href=\"javascript:window.opener.showcalendar('"
  +targetFieldName+"', '"+formatdts1(nextone)+"','"+item1+"','"+item2+"','"+item3+"'"+");\">"+"<img src=\"/images/icons_3.gif\" width=\"16\" height=\"16\" border=\"0\""+
  " alt=\"next month\"></a></td>\n</tr>\n");

 var thisDayofDate = new Date(firstDayofDate);

 writeline += "<tr>\n";
 for (var n=0; n<7; n++)
  writeline += " <td class=\"V7\">"+
  weekdays[(nweekstart+n)%7]+"</td>\n";

 writeline += "</tr>\n";
 while (thisDayofDate.getMonth() == theDate.getMonth() ||
  thisDayofDate.getMonth() == firstDayofDate.getMonth()) {


  writeline += "<tr >\n";
  for (var ncurrentwday=0; ncurrentwday<7; ncurrentwday++) {
  var currentycmp=new String(thisDayofDate.getFullYear());
  var currentmcmp=new String(thisDayofDate.getMonth());
  if(currentmcmp.length==1)currentmcmp="0"+currentmcmp;
  var currentdcmp=new String(thisDayofDate.getDate());
  if(currentdcmp.length==1)currentdcmp="0"+currentdcmp;
  var currentcmp= new String(currentycmp+currentmcmp+currentdcmp);
  var currentcmpI= parseInt(currentcmp);

    if (thisDayofDate.getDate() == theDate.getDate() &&
     thisDayofDate.getMonth() == theDate.getMonth())

     writeline += " <td class=\"V6\"  align=\"right\">";
    //else if (thisDayofDate.getDay() == 0 || thisDayofDate.getDay() == 6)

     //writeline += " <td class=\"V3\" align=\"right\">";

    else

     writeline += " <td class=\"V4\" align=\"right\">";


    if ((thisDayofDate.getMonth() == theDate.getMonth()) && (currentcmpI >= todaycmpI))

     writeline += "<a href=\"javascript:window.opener.dateswitch('"+formatdts(thisDayofDate)+"','"+targetFieldName+"','"+item1+"','"+item2+"','"+item3+"'"+");\">"+
     "<font color=\"#990099\" >";
    else

     writeline +=
     "<div class=\"V3\">";
    writeline += thisDayofDate.getDate()+"</a></td>\n";
    thisDayofDate.setDate(thisDayofDate.getDate()+1);
  }

  writeline += "</tr>\n";
 }

 writeline += "\n<tr><td colspan=\"7\" class=\"V1\">"+
  "Purple Parking Limited" +
  "</td></tr>\n" +
  "</table>\n" +
  "</tr>\n</td>\n</table>\n" +
  "</body>\n" +
  "</html>\n";

 var vWinCal = window.open("", "Calendar",
  "dependent=yes, width=300,height=170, menubar=no, status=no,resizable=no,top=390,left=600");
 vWinCal.opener = self;
 var calcdoc = vWinCal.document;
 calcdoc.write (writeline);
 calcdoc.close();
}
function formatstd (dateValue) {
 var redate = /^(\d+)\-(\d+)\-(\d+)\s+(\d+)\:(\d+)\:(\d+)$/;
 if (!redate.exec(dateValue))return ;
 return (new Date (RegExp.$3, RegExp.$2-1, RegExp.$1, RegExp.$4, RegExp.$5, RegExp.$6));
}
function formatdts (theDate) {
 return (new String (
   theDate.getDate()+"-"+(theDate.getMonth()+1)+"-"+theDate.getFullYear()));
}
function formatdts1 (theDate) {

 return (new String (
   theDate.getDate()+"-"+(theDate.getMonth()+1)+"-"+theDate.getFullYear()));
}
function drp(form, field, fieldD, fieldM, fieldY)
 {
var days = new Array('Dt','00','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31');
var months = new Array('Month','January','February','March','April','May','June','July','August','September','October','November','December');
var MonthsNum = new Array('00','1','2','3','4','5','6','7','8','9','10','11','12');
var years= new Array(11);
years[0]="Year";
var d = new Date();
var dyfI = parseInt(d.getFullYear());
 for (i = 1; i < years.length; i++)
 {
  years[i]=dyfI;
  dyfI=dyfI+1;
 }
 /*
 use function availably checking to get ids of
 form, hidden field, drop down date, drop down month, drop down year
 */
   if (document.getElementById) {
   dt=document.getElementById(field);
   fm=document.getElementById(form);
   ddd=document.getElementById(fieldD);
   ddm=document.getElementById(fieldM);
   ddy=document.getElementById(fieldY);
   } else if (document.all) {
   dt=document.all[field];
   ddd=document.all[fieldD];
   ddm=document.all[fieldM];
   ddy=document.all[fieldY];
   fm=document.all[form];
   } else  if (document.layers) {
   dt=document[field];
   fm=document[form];
   ddd=document[fieldD];
   ddm=document[fieldM];
   ddy=document[fieldY];

   }
   /*
 get the index number of the selected item in each drop down
 if nothing has been selected then set to 0 (i.e. "Dt", "Month", "Year")
 */
   var dddsi=ddd.selectedIndex;
   var ddmsi=ddm.selectedIndex;
   var ddysi=ddy.selectedIndex;
   if ( dddsi == -1 )dddsi=0;
   if ( ddmsi == -1 )ddmsi=0;
   if ( ddysi == -1 )ddysi=0;
   var sendday=days[0];
   var sendmonth=MonthsNum[0];
   var sendyear=years[0];

   for (i = 0; i < days.length; i++)
   {
    if ( ddd.options[dddsi].text==days[i])sendday=days[i];
   }
   for (i = 0; i < months.length; i++)
   {
    if ( ddm.options[ddmsi].text==months[i])sendmonth=MonthsNum[i];
   }
   for (i = 0; i < years.length; i++)
   {
    if ( ddy.options[ddysi].text==years[i])sendyear=years[i];
   }

   if(sendyear == "Year" )sendyear=sendyear=new String(d.getFullYear());
   if((sendmonth == "00") ||(sendmonth == "Month")){
   var sendmi=d.getMonth();
   sendmonth=new String(sendmi+1);
   }
   if((sendday == "00") || (sendday == "Dt"))sendday=new String(d.getDate());

   var senddate=sendday+"-"+sendmonth+"-"+sendyear;
   dt.value=senddate;
    pformat = "DD/MM/YYYY";
  pyear = new String(sendyear);
  pmonth = new String(sendmonth);
  pitem = fm.name+"."+dt.name;
  showcalendar(pitem, senddate,ddd.name,ddm.name,ddy.name)
 }
 Now = new Date();
 NowDay = Now.getDate();
 NowMonth = Now.getMonth();
 NowYear = Now.getYear();
 if (NowYear < 2000) NowYear += 1900;
function DaysInMonth(WhichMonth, WhichYear)
{
  var DaysInMonth = 31;
  if (WhichMonth == "4" || WhichMonth == "6" || WhichMonth == "9" || WhichMonth == "04" || WhichMonth == "06" || WhichMonth == "09" || WhichMonth == "11") DaysInMonth = 30;
  if (WhichMonth == "02" && (WhichYear/4) != Math.floor(WhichYear/4)) DaysInMonth = 28;
  if (WhichMonth == "2" && (WhichYear/4) != Math.floor(WhichYear/4)) DaysInMonth = 28;
  if (WhichMonth == "02" && (WhichYear/4) == Math.floor(WhichYear/4)) DaysInMonth = 29;
  if (WhichMonth == "2" && (WhichYear/4) == Math.floor(WhichYear/4)) DaysInMonth = 29;
  return DaysInMonth;
}
 function noquotes(a)
 {
  var q = a.value;
  var x = "";
  for (var i = 0; i < q.length; i++)
 {
    var c = q.charAt(i);
    var f = q.charCodeAt(i);
     if (f == 34 || f == 39 || f == 59 || f == 60 || f == 62 || f == 123 || f == 125 )
        {
        x=x+"`";
        }
    else
        {
         x=x+c;
        }
  }

  a.value = x ;
 }
 function loadAirportsAndTerminals(form) {

  airport = new Array(89,89,89);

   terminals = new Array(89,89,89,89,89,89);


 airport[0] = ["HEATHROW MEET & GREET","0","C","1"];
  terminals[0] = ["1","2","3","4","5",""];

 airport[1] = ["HEATHROW BUDGET MEET AND GREET","1","C","1"];
  terminals[1] = ["1","2","3","4","5",""];

 airport[2] = ["HEATHROW UB8 MEET AND GREET PARKING","2","C","1"];
  terminals[2] = ["1","2","3","4","5",""];

 airport[3] = ["HEATHROW ECONOMY MEET AND GREET","3","C","1"];
  terminals[3] = ["1","2","3","4","5",""];

 airport[4] = ["AIRPARKS GATWICK MEET & GREET","4","C","0"];
  terminals[4] = ["N","S","","","",""];

 airport[5] = ["GATWICK METEOR MEET & GREET","5","C","0"];
  terminals[5] = ["N","S","","","",""];

 airport[6] = ["STANSTED EASY PARKING MEET & GREET","6","C","0"];
  terminals[6] = ["1","","","","",""];

 airport[7] = ["STANSTED METEOR MEET & GREET","7","C","0"];
  terminals[7] = ["1","","","","",""];

 airport[8] = ["STANSTED LETUSPARK MEET AND GREET","8","C","0"];
  terminals[8] = ["1","","","","",""];

 airport[9] = ["STANSTED SUPER PARKING MEET AND GREET","9","C","0"];
  terminals[9] = ["1","","","","",""];

 airport[10] = ["LUTON AIRPORT EXPRESS PARKING MEET AND GREET","10","C","0"];
  terminals[10] = ["1","","","","",""];

 airport[11] = ["AIRPARKS MANCHESTER GOLD MEET & GREET","11","C","0"];
  terminals[11] = ["1","2","3","","",""];

 airport[12] = ["MANCHESTER PURPLEPARKING MEET AND GREET","12","C","0"];
  terminals[12] = ["1","2","3","","",""];

 airport[13] = ["MANCHESTER CHAUFFEUR PARKING (MINI VALET)","13","C","0"];
  terminals[13] = ["1","2","3","","",""];

 airport[14] = ["MANCHESTER CHAUFFEUR MEET & GREET PARKING","14","C","0"];
  terminals[14] = ["1","2","3","","",""];

 airport[15] = ["MANCHESTER MEET & GREET UNDERCOVER","15","C","0"];
  terminals[15] = ["1","2","3","","",""];

 airport[16] = ["MANCHESTER MIA PREMIER MEET AND GREET","16","C","0"];
  terminals[16] = ["1","2","3","","",""];

 airport[17] = ["MANCHESTER AIRPARKS MEET AND GREET","17","C","0"];
  terminals[17] = ["1","2","3","","",""];

 airport[18] = ["MANCHESTER EASYPARK LTD MEET AND GREET","18","C","0"];
  terminals[18] = ["1","2","3","","",""];

 airport[19] = ["E MIDLANDS PRESTIGE PARKING MEET & GREET","19","C","0"];
  terminals[19] = ["1","","","","",""];

 airport[20] = ["EDINBURGH ONE WAY MEET & GREET","20","C","0"];
  terminals[20] = ["1","","","","",""];

 airport[21] = ["EDINBURGH SECURE AIRPARKS MEET & GREET","21","C","0"];
  terminals[21] = ["1","","","","",""];

 airport[22] = ["BIRMINGHAM METEOR DROP & GO","22","C","0"];
  terminals[22] = ["1","2","","","",""];

 airport[23] = ["BIRMINGHAM ANGLOPARKS MEET & GREET","23","C","0"];
  terminals[23] = ["1","2","","","",""];

 airport[24] = ["BIRMINGHAM AARDVARK MEET & GREET","24","C","0"];
  terminals[24] = ["1","2","","","",""];

 airport[25] = ["GLASGOW CHAUFFEUR MEET & GREET","25","C","0"];
  terminals[25] = ["1","","","","",""];

 airport[26] = ["LIVERPOOL SKYPARK MEET AND GREET","26","C","0"];
  terminals[26] = ["1","","","","",""];

 airport[27] = ["BRISTOL CHAUFFEURED PARKING","27","C","0"];
  terminals[27] = ["1","","","","",""];

 airport[28] = ["BRISTOL AIRPORT MEET AND GREET","28","C","0"];
  terminals[28] = ["1","","","","",""];

 airport[29] = ["NORWICH DROP & GO","29","C","0"];
  terminals[29] = ["1","","","","",""];

 airport[30] = ["HEATHROW PARK AND RIDE","30","L","1"];
  terminals[30] = ["1","2","3","4","5",""];

 airport[31] = ["HEATHROW QUALITY AIRPORT PARKING PARK AND RIDE","31","L","0"];
  terminals[31] = ["1","2","3","4","5",""];

 airport[32] = ["HEATHROW PARK AND RIDE PREMIUM","32","L","1"];
  terminals[32] = ["1","2","3","4","5",""];

 airport[33] = ["HEATHROW QUALITY AIRPORT PARKING PREMIUM","33","L","1"];
  terminals[33] = ["1","2","3","4","5",""];

 airport[34] = ["AIRPARKS GATWICK PARK & RIDE","34","L","0"];
  terminals[34] = ["N","S","","","",""];

 airport[35] = ["GATWICK APH PARK & RIDE","35","L","0"];
  terminals[35] = ["N","S","","","",""];

 airport[36] = ["LONDON CITY AIRPORT PARK & RIDE","36","L","0"];
  terminals[36] = ["1","","","","",""];

 airport[37] = ["LUTON PARK & RIDE","37","L","0"];
  terminals[37] = ["1","","","","",""];

 airport[38] = ["LUTON SHORT TERM PARK & RIDE","38","L","0"];
  terminals[38] = ["1","","","","",""];

 airport[39] = ["LUTON MID TERM PARK & RIDE","39","L","0"];
  terminals[39] = ["1","","","","",""];

 airport[40] = ["LUTON LONG TERM PARK & RIDE","40","L","0"];
  terminals[40] = ["1","","","","",""];

 airport[41] = ["LUTON SHORT TERM SAVER PARK & RIDE","41","L","0"];
  terminals[41] = ["1","","","","",""];

 airport[42] = ["LUTON MID TERM SAVER PARK & RIDE","42","L","0"];
  terminals[42] = ["1","","","","",""];

 airport[43] = ["LUTON LONG TERM SAVER PARK & RIDE","43","L","0"];
  terminals[43] = ["1","","","","",""];

 airport[44] = ["LUTON AIRPARKS SAVER PARK AND RIDE","44","L","0"];
  terminals[44] = ["1","","","","",""];

 airport[45] = ["STANSTED ORANGE PARK AND RIDE","45","L","0"];
  terminals[45] = ["1","","","","",""];

 airport[46] = ["STANSTED CONCORD PARK AND RIDE","46","L","0"];
  terminals[46] = ["1","","","","",""];

 airport[47] = ["ABERDEEN AIRPARK PARK AND RIDE","47","L","0"];
  terminals[47] = ["1","","","","",""];

 airport[48] = ["BELFAST KILLEAD AIRLODGE PARK AND RIDE","48","L","0"];
  terminals[48] = ["1","","","","",""];

 airport[49] = ["BIRMINGHAM PARK & RIDE","49","L","0"];
  terminals[49] = ["1","2","","","",""];

 airport[50] = ["BIRMINGHAM APH PARK & RIDE","50","L","0"];
  terminals[50] = ["1","2","","","",""];

 airport[51] = ["BIRMINGHAM AIRPARKS SAVER PARK AND RIDE","51","L","0"];
  terminals[51] = ["1","2","","","",""];

 airport[52] = ["BRISTOL EZ PARKING PARK & RIDE","52","L","0"];
  terminals[52] = ["1","","","","",""];

 airport[53] = ["BRISTOL SILVERZONE PARK AND RIDE","53","L","0"];
  terminals[53] = ["1","","","","",""];

 airport[54] = ["BRISTOL SILVERZONE SAVER PARK AND RIDE","54","L","0"];
  terminals[54] = ["1","","","","",""];

 airport[55] = ["BRISTOL AIRPORT LONG STAY PARK AND RIDE","55","L","0"];
  terminals[55] = ["1","","","","",""];

 airport[56] = ["CARDIFF PARK & RIDE","56","L","0"];
  terminals[56] = ["1","","","","",""];

 airport[57] = ["E MIDLANDS AIRPORT PARK & RIDE","57","L","0"];
  terminals[57] = ["1","","","","",""];

 airport[58] = ["E MIDLANDS PRESTIGE PARK & RIDE","58","L","0"];
  terminals[58] = ["1","","","","",""];

 airport[59] = ["E MIDLANDS AIRPARKS SAVER PARK AND RIDE","59","L","0"];
  terminals[59] = ["1","","","","",""];

 airport[60] = ["EDINBURGH SECURE AIRPARKS PARK & RIDE","60","L","0"];
  terminals[60] = ["1","","","","",""];

 airport[61] = ["EXETER PARK AND RIDE","61","L","0"];
  terminals[61] = ["1","","","","",""];

 airport[62] = ["AIRPARKS GLASGOW PARK & RIDE","62","L","0"];
  terminals[62] = ["1","","","","",""];

 airport[63] = ["GLASGOW PARKSAFE PARK & RIDE","63","L","0"];
  terminals[63] = ["1","","","","",""];

 airport[64] = ["GLASGOW PARK `N` FLY PARK AND RIDE","64","L","0"];
  terminals[64] = ["1","","","","",""];

 airport[65] = ["GLASGOW SWIFT PARK AND RIDE","65","L","0"];
  terminals[65] = ["1","","","","",""];

 airport[66] = ["GLASGOW DIRECT PARKING PARK AND RIDE","66","L","0"];
  terminals[66] = ["1","","","","",""];

 airport[67] = ["AIRPARKS GLASGOW SAVER PARK AND RIDE","67","L","0"];
  terminals[67] = ["1","","","","",""];

 airport[68] = ["LEEDS/BRADFORD PARK & RIDE","68","L","0"];
  terminals[68] = ["1","","","","",""];

 airport[69] = ["LIVERPOOL JOHN LENNON PARK & RIDE","69","L","0"];
  terminals[69] = ["1","","","","",""];

 airport[70] = ["LIVERPOOL SKYPARK OUTDOOR PARK AND RIDE","70","L","0"];
  terminals[70] = ["1","","","","",""];

 airport[71] = ["LIVERPOOL SKYPARK INDOOR PARK AND RIDE","71","L","0"];
  terminals[71] = ["1","","","","",""];

 airport[72] = ["LIVERPOOL IMAGINE INDOOR PARK AND RIDE","72","L","0"];
  terminals[72] = ["1","","","","",""];

 airport[73] = ["LIVERPOOL IMAGINE OUTDOOR PARK AND RIDE","73","L","0"];
  terminals[73] = ["1","","","","",""];

 airport[74] = ["LIVERPOOL APL OUTDOOR PARKING","74","L","0"];
  terminals[74] = ["1","","","","",""];

 airport[75] = ["AIRPARKS MANCHESTER GOLD PARK & RIDE","75","L","0"];
  terminals[75] = ["1","2","3","","",""];

 airport[76] = ["MANCHESTER AIRPARKS PARK & RIDE","76","L","0"];
  terminals[76] = ["1","2","3","","",""];

 airport[77] = ["MANCHESTER PARK & RIDE","77","L","0"];
  terminals[77] = ["1","2","3","","",""];

 airport[78] = ["MANCHESTER BUDGET AIRPORT PARKING PARK & RIDE","78","L","0"];
  terminals[78] = ["1","2","3","","",""];

 airport[79] = ["MANCHESTER SECURAPARK PARK AND RIDE","79","L","0"];
  terminals[79] = ["1","2","3","","",""];

 airport[80] = ["VALUE PARKING MANCHESTER PARK AND RIDE","80","L","0"];
  terminals[80] = ["1","2","3","","",""];

 airport[81] = ["MANCHESTER AIRPARKS ADVANCE PARK AND RIDE","81","L","0"];
  terminals[81] = ["1","2","3","","",""];

 airport[82] = ["MANCHESTER PURPLEPARKING PARK AND RIDE","82","L","0"];
  terminals[82] = ["1","2","3","","",""];

 airport[83] = ["NEWCASTLE ON AIRPORT PARKING (LONG STAY)","83","L","0"];
  terminals[83] = ["1","","","","",""];

 airport[84] = ["AIRPARKS BELLAIR NEWCASTLE PARK & RIDE","84","L","0"];
  terminals[84] = ["1","","","","",""];

 airport[85] = ["AIRPARKS BELLAIR NEWCASTLE UC PARK & RIDE","85","L","0"];
  terminals[85] = ["1","","","","",""];

 airport[86] = ["NEWCASTLE AIRPARKS SAVER PARK AND RIDE","86","L","0"];
  terminals[86] = ["1","","","","",""];

 airport[87] = ["PRESTWICK PARK & RIDE PARK & RIDE","87","L","0"];
  terminals[87] = ["1","","","","",""];

 airport[88] = ["TEESSIDE AIRPORT PARK & RIDE","88","L","0"];
  terminals[88] = ["1","","","","",""];

 airport[89] = ["SOUTHAMPTON PARK AND RIDE (LONG STAY)","89","L","0"];
  terminals[89] = ["1","","","","",""];

 starttermBox = document.forms[form].elements["startterm"];
 rtrntermBox = document.forms[form].elements["rtrnterm"];
 }


 function nocarwash()
  {
     if (document.getElementById) {
       document.getElementById("cwtxt").style.color="gray";
       document.getElementById("cwlnk").style.color="gray";
       document.getElementById("cw").disabled=true;
       document.getElementById("cw").checked=false;
     } else if (document.all) {
       document.all["cwtxt"].style.color="gray";
       document.all["cwlnk"].disabled=true;
       document.all["cw"].disabled=true;
       document.all["cw"].checked=false;
      } else  if (document.layers) {
      document["cwtxt"].color="gray";
      document["cwlnk"].disabled=true;
      document["cw"].disabled=true;
      document["cw"].disabled=false;
      }
 }

 function carwash()
  {
     if (document.getElementById) {
       document.getElementById("cwtxt").style.color="black";
       document.getElementById("cwlnk").style.color="black";
       document.getElementById("cw").disabled=false;
       document.getElementById("cw").checked=false;
     } else if (document.all) {
       document.all["cwtxt"].style.color="black";
       document.all["cwlnk"].disabled=false;
       document.all["cw"].disabled=false;
       document.all["cw"].checked=false;
      } else  if (document.layers) {
      document["cwtxt"].color="black";
      document["cwlnk"].disabled=false;
      document["cw"].disabled=false;
      document["cw"].disabled=false;
      }
 }

 function grey(txt,hrs,min,pas,ptx) {
    if (document.getElementById) {
     document.getElementById(txt).style.color="gray";
     document.getElementById(hrs).disabled=true;
     document.getElementById(min).disabled=true;
     if(pas != "")document.getElementById(pas).disabled=true;
     if(ptx != "")document.getElementById(ptx).style.color="gray";
    } else if (document.all) {
     document.all[txt].style.color="gray";
     document.all[hrs].disabled=true;
     document.all[min].disabled=true;
     if(pas != "")document.all[pas].disabled=true;
     if(ptx != "")document.all[ptx].style.color="gray";
    } else  if (document.layers) {

      document[txt].color="gray";
      document[hrs].disabled=true;
      document[min].disabled=true;
      if(pas != "")document[pas].disabled=true;
      if(ptx != "")document[ptx].color="gray";
    }
   }

 function norm(txt,hrs,min,pas,ptx) {
    if (document.getElementById) {
     document.getElementById(txt).style.color="black";
     document.getElementById(hrs).disabled=false;
     document.getElementById(min).disabled=false;
      if(pas != "")document.getElementById(pas).disabled=false;
     if(ptx != "")document.getElementById(ptx).style.color="black";
    } else if (document.all) {
     document.all[txt].style.color="black";
     document.all[hrs].disabled=false;
     document.all[min].disabled=false;
     if(pas != "")document.all[pas].disabled=false;
     if(ptx != "")document.all[ptx].style.color="black";
    } else  if (document.layers) {

      document[txt].color="black";
      document[hrs].disabled=false;
      document[min].disabled=false;
       if(pas != "")document[pas].disabled=false;
      if(ptx != "")document[ptx].color="black";
    }
   }

 function populateTerminalSelect(Airservice,form) {

   loadAirportsAndTerminals(form);
   starttermBox.options.length = 0;
   rtrntermBox.options.length = 0;
   var selectedItem = Airservice.selectedIndex;
   if (Airservice.selectedIndex == -1)selectedItem=0;
   var selectedText = Airservice.options[selectedItem].text;
   var terminalIndex = 0;
       greying = "C";
       cwflag = "0";
      for (var i = 0; i < airport.length; i++) {
           if (airport[i][0] == selectedText){
          terminalIndex = airport[i][1];
          greying = airport[i][2];
          cwflag = airport[i][3];
     break;
      }
     }


      var i = 0;
      while (terminals[terminalIndex][i] != "") {
     starttermBox.options.length = i+1;
           rtrntermBox.options.length = i+1;
     i++;

    }

         var i = 0;
               while (terminals[terminalIndex][i] != "") {
      starttermBox.options[i].text = terminals[terminalIndex][i];
      rtrntermBox.options[i].text = terminals[terminalIndex][i];
      i++;

    }
     if(greying == "C"){
       grey("carriv","arrivhour","arrivmin","passengers","ptext");
       norm("cmeet","meethour","meetmin","","");
      } else {
       grey("cmeet","meethour","meetmin","","");
       norm("carriv","arrivhour","arrivmin","passengers","ptext");
      }


     if(cwflag == "1"){
       carwash();
      } else {
       nocarwash();
      }

  }
 function amendPopTerminalSelect(Airservice,form) {

   stm=getTm("startterm");
   rtm=getTm("rtrnterm");
   loadAirportsAndTerminals(form);

   starttermBox.options.length = 0;
   rtrntermBox.options.length = 0;
   var selectedItem = Airservice.selectedIndex;
   if (Airservice.selectedIndex == -1)selectedItem=0;
   var selectedText = Airservice.options[selectedItem].text;
   var terminalIndex = 0;
       greying = "C";
       cwflag = "0";
      for (var i = 0; i < airport.length; i++) {
           if (airport[i][0] == selectedText){
          terminalIndex = airport[i][1];
          greying = airport[i][2];
          cwflag = airport[i][3];
     break;
      }
     }


      var i = 0;
      while (terminals[terminalIndex][i] != "") {
     starttermBox.options.length = i+1;
           rtrntermBox.options.length = i+1;
     i++;

    }

         var i = 0;
               while (terminals[terminalIndex][i] != "") {
      starttermBox.options[i].text = terminals[terminalIndex][i];
      rtrntermBox.options[i].text = terminals[terminalIndex][i];
      i++;

    }

     setTm("startterm",stm);
     setTm("rtrnterm",rtm);

     if(greying == "C"){
       grey("carriv","arrivhour","arrivmin","passengers","ptext");
       norm("cmeet","meethour","meetmin","","");
      } else {
       grey("cmeet","meethour","meetmin","","");
       norm("carriv","arrivhour","arrivmin","passengers","ptext");
      }


     if(cwflag == "1"){
       carwash();
      } else {
       nocarwash();
      }

  }

 function mimic(issue,receive){

    if (document.getElementById) {
     i=document.getElementById(issue);
     r=document.getElementById(receive);
     selectedItem = i.selectedIndex;
     if (i.selectedIndex == -1)selectedItem=0;
     r.selectedIndex= selectedItem;

    } else if (document.all) {
     i=document.all[issue];
     r=document.all[receive];
     selectedItem = i.selectedIndex;
     if (i.selectedIndex == -1)selectedItem=0;
     r.selectedIndex= selectedItem;

    } else  if (document.layers) {

       i=document[issue];
       r=document[receive];
     selectedItem = i.selectedIndex;
     if (i.selectedIndex == -1)selectedItem=0;
     r.selectedIndex= selectedItem;
    }
 }
function getTm(name)
 {
 var f=document.forms[0];
 var o="";

 for (var i = 0;i < f.length; i++) // loop through form elements
    {
         var e=f.elements[i];
         if (e.name == name)
         {
           for (var z = 0;z < e.options.length; z++)
             {
                  if (e.options[z].selected)
                   {
                     o=e.options[z].text;

                    return o;
                    continue;
                   }
              }
         }
    }
  return o;
 }
function setTm(name,val)
 {
 var f=document.forms[0];

 for (var i = 0;i < f.length; i++) // loop through form elements
    {
         var e=f.elements[i];
         if (e.name == name)
         {

           for (var z = 0;z < e.options.length; z++)
             {
                  if (e.options[z].text == val)
                   {
                       e.options[z].selected=true;

                    continue;
                   }
              }
         }
    }
 }

function checkit(){

   if (document.getElementById) {
     dh=document.getElementById('departH');
     dm=document.getElementById('departM');
  rh=document.getElementById('returnH');
     rm=document.getElementById('returnM');
  sdy=document.getElementById('stdate');
     smt=document.getElementById('stmonth');
  syr=document.getElementById('styear');
  rdy=document.getElementById('rtrndate');
     rmt=document.getElementById('rtrnmonth');
  ryr=document.getElementById('rtrnyear');
  airp=document.getElementById('ap');
  ret=document.getElementById('arrivalTime');
  dep=document.getElementById('departureTime');

  sDh = dh.selectedIndex;
  sDm = dm.selectedIndex;
  sRh = rh.selectedIndex;
  sRm = rm.selectedIndex;
  sSdy = sdy.selectedIndex;
  sSmt = smt.selectedIndex;
  sSyr = syr.selectedIndex;
  sRdy = rdy.selectedIndex;
  sRmt = rmt.selectedIndex;
  sRyr = ryr.selectedIndex;
  sap = airp.selectedIndex;

  if(sDh == -1)sDh=0;
  if(sDm == -1)sDm=0;
  if(sRh == -1)sRh=0;
  if(sRm == -1)sRm=0;
  if(sSdy == -1)sSdy=0;
  if(sSmt == -1)sSmt=0;
  if(sSyr == -1)sSyr=0;
  if(sRdy == -1)sRdy=0;
  if(sRmt == -1)sRmt=0;
  if(sRyr == -1)sRyr=0;
  if(sap == -1)sap=0;
  var returnValid = true;
  var err="";
  var adh=dep.value.slice(0,2);
  var adm=dep.value.slice(3);
  var rth=ret.value.slice(0,2);
  var rtm=ret.value.slice(3);
  var months = new Array('Month','January','February','March','April','May','June','July','August','September','October','November','December');
  var mon = new Array('00','01','02','03','04','05','06','07','08','09','10','11','12');
  var day = new Array('Dt','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31');
  var rmi=0;
  var dmi=0;
  for(i=0;i<months.length;i++){
  if (smt.options[sSmt].text == months[i])dmi=i;
  if (rmt.options[sRmt].text == months[i])rmi=i;
 }

   if ((dh.options[sDh].text == adh  && dm.options[sDm].text == adm && rh.options[sRh].text == rth  && rm.options[sRm].text == rtm) || (dh.options[sDh].text == "00"  && dm.options[sDm].text == "00" && rh.options[sRh].text == "00"  && rm.options[sRm].text == "00"))
   {
  err +="\n Arrival and Return times have not been changed or are all invalid";
  returnValid = false;
  }

  var nodo=0;
  var d = new Date();
  var ddi =d.getDate();
  var dd=day[ddi];
  var ddmi = d.getMonth();
  ddmi=ddmi+1;
  var ddm=mon[ddmi];
  var dyf = new String(d.getFullYear());
  var today=dyf+ddm+dd;
  if (sdy.options[sSdy].text == "Dt" ){err +="\n Departure date ";returnValid = false;}
  if (smt.options[sSmt].text == "Month" ){err +="\n Departure Month ";returnValid = false;}
  if (syr.options[sSyr].text == "Year" ){err +="\n Departure Year ";returnValid = false; }
  if (rdy.options[sRdy].text == "Dt" ){err +="\n Return date ";returnValid = false;}
  if (rmt.options[sRmt].text == "Month" ){err +="\n Return Month ";returnValid = false; }
  if (ryr.options[sRyr].text == "Year" ){err +="\n Return Year ";returnValid = false;}
  if (airp.options[sap].text == "Select Airport" ){err +="\n Airport ";returnValid = false;}
  if ((sdy.options[sSdy].text == "Dt") || (smt.options[sSmt].text == "Month" ) || (syr.options[sSyr].text == "Year" ))
  {
   nodo=1;
  }
  if (nodo==0)
  {
   var date = syr.options[sSyr].text+mon[dmi]+sdy.options[sSdy].text;

   dt3=parseInt(date);
   dt4=parseInt(today);
   okay=dt3-dt4;

   if (okay <0){err +="\n Departure cannot be in the past ";returnValid = false;}
  }
   nodo=0;
  if ((rdy.options[sRdy].text == "Dt") || (rmt.options[sRmt].text == "Month" ) || (ryr.options[sRyr].text == "Year" ))
  {
   nodo=1;

  }
  if (nodo==0)
  {
   var date = ryr.options[sRyr].text+mon[rmi]+rdy.options[sRdy].text;
   dt5=parseInt(date);
   dt4=parseInt(today);
   okay=dt5-dt4;
   okay1=dt3-dt5;

   if (okay < 0){err +="\n Return cannot be in the past ";returnValid = false;}
   if (okay1 > 0){err +="\n Return cannot be before departure";returnValid = false;}
  }

  if (returnValid){
  return returnValid;
  }else{
  alert("\nThe following fields have been left blank or are invalid\n"+err);
  return returnValid;
  }

    } else if (document.all) {
     dh=document.all['departH'];
     dm=document.all['departM'];
  rh=document.all['returnH'];
     rm=document.all['returnM'];
     rm=document.all['stdate'];
     rm=document.all['stmonth'];
     rm=document.all['styear'];
     rm=document.all['rtrndate'];
     rm=document.all['rtrnmonth'];
     rm=document.all['rtrnyear'];
     rm=document.all['ap'];
  ret=document.all['arrivalTime'];
  dep=document.all['departureTime'];
  sDh = dh.selectedIndex;
  sDm = dm.selectedIndex;
  sRh = rh.selectedIndex;
  sRm = rm.selectedIndex;
  sSdy = sdy.selectedIndex;
  sSmt = smt.selectedIndex;
  sSyr = syr.selectedIndex;
  sRdy = rdy.selectedIndex;
  sRmt = rmt.selectedIndex;
  sRyr = ryr.selectedIndex;
  sap = airp.selectedIndex;
  if(sDh == -1)sDh=0;
  if(sDm == -1)sDm=0;
  if(sRh == -1)sRh=0;
  if(sRm == -1)sRm=0;
  if(sSdy == -1)sSdy=0;
  if(sSmt == -1)sSmt=0;
  if(sSyr == -1)sSyr=0;
  if(sRdy == -1)sRdy=0;
  if(sRmt == -1)sRmt=0;
  if(sRyr == -1)sRyr=0;
  if(sap == -1)sap=0;
  var err="";
  var adh=dep.value.slice(0,2);
  var adm=dep.value.slice(3);
  var rth=ret.value.slice(0,2);
  var rtm=ret.value.slice(3);
  var months = new Array('Month','January','February','March','April','May','June','July','August','September','October','November','December');
  var mon = new Array('00','01','02','03','04','05','06','07','08','09','10','11','12');
  var day = new Array('00','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31');
  var rmi=0;
  var dmi=0;
  for(i=0;i<months.length;i++){
  if (smt.options[sSmt].text == months[i])dmi=i;
  if (rmt.options[sRmt].text == months[i])rmi=i;
 }
   if ((dh.options[sDh].text == adh  && dm.options[sDm].text == adm && rh.options[sRh].text == rth  && rm.options[sRm].text == rtm) || (dh.options[sDh].text == "00"  && dm.options[sDm].text == "00" && rh.options[sRh].text == "00"  && rm.options[sRm].text == "00"))
  {
  err +="\n Arrival and Return times have not been changed or are all invalid";
  returnValid = false;
  }
  var nodo=0;
  var d = new Date();
  var ddi =d.getDate();
  var dd=day[ddi];
  var ddmi = d.getMonth();
  ddmi=ddmi+1;
  var ddm=mon[ddmi];
  var dyf = new String(d.getFullYear());
  var today=dyf+ddm+dd;
  if (sdy.options[sSdy].text == "Dt" ){err +="\n Departure date ";returnValid = false;}
  if (smt.options[sSmt].text == "Month" ){err +="\n Departure Month ";returnValid = false;}
  if (syr.options[sSyr].text == "Year" ){err +="\n Departure Year ";returnValid = false; }
  if (rdy.options[sRdy].text == "Dt" ){err +="\n Return date ";returnValid = false;}
  if (rmt.options[sRmt].text == "Month" ){err +="\n Return Month ";returnValid = false; }
  if (ryr.options[sRyr].text == "Year" ){err +="\n Return Year ";returnValid = false;}
  if (airp.options[sap].text == "Select Airport" ){err +="\n Airport ";returnValid = false;}
  if ((sdy.options[sSdy].text == "Dt") || (smt.options[sSmt].text == "Month" ) || (syr.options[sSyr].text == "Year" ))
  {
   nodo=1;
  }
  if (nodo==0)
  {
   var date = syr.options[sSyr].text+mon[dmi]+sdy.options[sSdy].text;
   dt3=parseInt(date);
   dt4=parseInt(today);
   okay=dt3-dt4;
   if (okay <0){err +="\n Departure cannot be in the past ";returnValid = false;}
  }
   nodo=0;
  if ((rdy.options[sRdy].text == "Dt") || (rmt.options[sRmt].text == "Month" ) || (ryr.options[sRyr].text == "Year" ))
  {
   nodo=1;

  }
  if (nodo==0)
  {
   var date = ryr.options[sRyr].text+mon[rmi]+rdy.options[sRdy].text;
   dt5=parseInt(date);
   dt4=parseInt(today);
   okay1=dt3-dt5;
   if (okay < 0){err +="\n Return cannot be in the past ";returnValid = false;}
   if (okay1 > 0){err +="\n Return cannot be before departure";returnValid = false;}
  }

  if (returnValid){
  return returnValid;
  }else{
  alert("\nThe following fields have been left blank or are invalid\n"+err);
  return returnValid;
  }

    } else  if (document.layers) {

       dh=document['departH'];
       dm=document['departM'];
    dh=document['returnH'];
       dm=document['returnM'];
       dm=document['stdate'];
       dm=document['stmonth'];
       dm=document['styear'];
       dm=document['rtrndate'];
       dm=document['rtrnmonth'];
       dm=document['rtrnyear'];
       dm=document['ap'];
    ret=document['arrivalTime'];
  dep=document['departureTime'];
  sDh = dh.selectedIndex;
  sDm = dm.selectedIndex;
  sRh = rh.selectedIndex;
  sRm = rm.selectedIndex;
  sSdy = sdy.selectedIndex;
  sSmt = smt.selectedIndex;
  sSyr = syr.selectedIndex;
  sRdy = rdy.selectedIndex;
  sRmt = rmt.selectedIndex;
  sRyr = ryr.selectedIndex;
  sap = airp.selectedIndex;
  if(sDh == -1)sDh=0;
  if(sDm == -1)sDm=0;
  if(sRh == -1)sRh=0;
  if(sRm == -1)sRm=0;
  if(sSdy == -1)sSdy=0;
  if(sSmt == -1)sSmt=0;
  if(sSyr == -1)sSyr=0;
  if(sRdy == -1)sRdy=0;
  if(sRmt == -1)sRmt=0;
  if(sRyr == -1)sRyr=0;
  if(sap == -1)sap=0;
  var err="";
  var adh=dep.value.slice(0,2);
  var adm=dep.value.slice(3);
  var rth=ret.value.slice(0,2);
  var rtm=ret.value.slice(3);
  var months = new Array('Month','January','February','March','April','May','June','July','August','September','October','November','December');
  var mon = new Array('00','01','02','03','04','05','06','07','08','09','10','11','12');
  var day = new Array('00','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31');
  var rmi=0;
  var dmi=0;
  for(i=0;i<months.length;i++){
  if (smt.options[sSmt].text == months[i])dmi=i;
  if (rmt.options[sRmt].text == months[i])rmi=i;
  }
   if ((dh.options[sDh].text == adh  && dm.options[sDm].text == adm && rh.options[sRh].text == rth  && rm.options[sRm].text == rtm) || (dh.options[sDh].text == "00"  && dm.options[sDm].text == "00" && rh.options[sRh].text == "00"  && rm.options[sRm].text == "00"))
  {
  err +="\n Arrival and Return times have not been changed or are all invalid";
  returnValid = false;
  }
  var nodo=0;
  var d = new Date();
  var ddi =d.getDate();
  var dd=day[ddi];
  var ddmi = d.getMonth();
  ddmi=ddmi+1;
  var ddm=mon[ddmi];
  var dyf = new String(d.getFullYear());
  var today=dyf+ddm+dd;
  if (sdy.options[sSdy].text == "Dt" ){err +="\n Departure date ";returnValid = false;}
  if (smt.options[sSmt].text == "Month" ){err +="\n Departure Month ";returnValid = false;}
  if (syr.options[sSyr].text == "Year" ){err +="\n Departure Year ";returnValid = false; }
  if (rdy.options[sRdy].text == "Dt" ){err +="\n Return date ";returnValid = false;}
  if (rmt.options[sRmt].text == "Month" ){err +="\n Return Month ";returnValid = false; }
  if (ryr.options[sRyr].text == "Year" ){err +="\n Return Year ";returnValid = false;}
  if (airp.options[sap].text == "Select Airport" ){err +="\n Airport ";returnValid = false;}
  if ((sdy.options[sSdy].text == "Dt") || (smt.options[sSmt].text == "Month" ) || (syr.options[sSyr].text == "Year" ))
  {
   nodo=1;
  }
  if (nodo==0)
  {
   var date = syr.options[sSyr].text+mon[dmi]+sdy.options[sSdy].text;
   dt3=parseInt(date);
   dt4=parseInt(today);
   okay=dt3-dt4;
   if (okay <0){err +="\n Departure cannot be in the past ";returnValid = false;}
  }
   nodo=0;
  if ((rdy.options[sRdy].text == "Dt") || (rmt.options[sRmt].text == "Month" ) || (ryr.options[sRyr].text == "Year" ))
  {
   nodo=1;

  }
  if (nodo==0)
  {
   var date = ryr.options[sRyr].text+mon[rmi]+rdy.options[sRdy].text;
   dt5=parseInt(date);
   dt4=parseInt(today);
   okay2=dt5-dt4;
   okay1=dt3-dt5;
   if (okay2 < 0){err +="\n Return cannot be in the past? ";returnValid = false;}
   if (okay1 > 0){err +="\n Return cannot be before departure";returnValid = false;}
  }
  if (returnValid){
  return returnValid;
  }else{
  alert("\nThe following fields have been left blank or are invalid\n"+err);
  return returnValid;
  }

    }
 }
 function vSign() {
 var url="https://digitalid.verisign.com/as2/7a30287bdfdeb8e50ffc27d8b4bf96cf";
 sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=500,height=450');
 self.name = "mainWin";
 }
//function to change the available days in a months
function ChangeOptionDays(Which)
{

var inp='VCT';
var inpd="stdate";
var inpm="stmonth";
var inpy="styear";
if (Which== 'rtrn'){
var inpd="rtrndate";
var inpm="rtrnmonth";
var inpy="rtrnyear";
}
if (Which== 'first'){
var inpd="stdate";
var inpm="stmonth";
var inpy="styear";
}
var inpdr="rtrndate";
var inpmr="rtrnmonth";
var inpyr="rtrnyear";

if (document.getElementById) {
  DaysObject=document.getElementById(inpd);
  MonthObject=document.getElementById(inpm);
  YearObject=document.getElementById(inpy);
  DaysObjectr=document.getElementById(inpdr);
  MonthObjectr=document.getElementById(inpmr);
  YearObjectr=document.getElementById(inpyr);
 } else if (document.all) {
   DaysObject=document.all[inpd];
  MonthObject=document.all[inpm];
  YearObject=document.all[inpy];
  DaysObjectr=document.all[inpdr];
  MonthObjectr=document.all[inpmr];
  YearObjectr=document.all[inpyr];
 } else  if (document.layers) {
  DaysObject=document[inpd];
  MonthObject=document[inpm];
  YearObject=document[inpy];
  DaysObjectr=document[inpdr];
  MonthObjectr=document[inpmr];
  YearObjectr=document[inpyr];
 }


  Month = MonthObject[MonthObject.selectedIndex].text;
  Year = YearObject[YearObject.selectedIndex].text;
  DaysForThisSelection = 31;
  if (Month == "April" || Month == "June" || Month == "September" || Month == "November") DaysForThisSelection = 30;
  if (Month == "February" && (Year/4) != Math.floor(Year/4)) DaysForThisSelection = 28;
  if (Month == "February" && (Year/4) == Math.floor(Year/4)) DaysForThisSelection = 29;

  CurrentDaysInSelection = DaysObject.length;
  CurrentDaysInSelection=CurrentDaysInSelection-1;
  day31 = new Array('Dt','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31');
  day30 = new Array('Dt','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30');
  day28 = new Array('Dt','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28');
  day29 = new Array('Dt','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29');
  calc = parseInt(DaysForThisSelection);
  calc1=calc+1;
   sel=DaysObject.selectedIndex;
 text=DaysObject.options[sel].text;

    if (CurrentDaysInSelection > DaysForThisSelection)
  {

   DaysObject.options.length=0;
 DaysObject.options.length=calc+1;
 if (Which == 'st'){
 DaysObjectr.options.length=0;
 DaysObjectr.options.length=calc+1;
 }
     for (i=0; i< calc1 ; i++)
    {

   if (calc == 31)DaysObject.options[i].text=day31[i];
   if (calc == 30)DaysObject.options[i].text=day30[i];
   if (calc == 28)DaysObject.options[i].text=day28[i];
   if (calc == 29)DaysObject.options[i].text=day29[i];
   if (Which == 'st'){
   if (calc == 31)DaysObjectr.options[i].text=day31[i];
    if (calc == 30)DaysObjectr.options[i].text=day30[i];
    if (calc == 28)DaysObjectr.options[i].text=day28[i];
    if (calc == 29)DaysObjectr.options[i].text=day29[i];
 }

    }
  }
  if (DaysForThisSelection > CurrentDaysInSelection)
   DaysObject.options.length=0;
 DaysObject.options.length=calc+1;
 if (Which == 'st'){
 DaysObjectr.options.length=0;
 DaysObjectr.options.length=calc+1;
 }
  {

    for (i=0; i< calc1 ; i++)
    {

   if (calc == 31)DaysObject.options[i].text=day31[i];
   if (calc == 30)DaysObject.options[i].text=day30[i];
   if (calc == 28)DaysObject.options[i].text=day28[i];
   if (calc == 29)DaysObject.options[i].text=day29[i];
   if (Which == 'st'){
    if (calc == 31)DaysObjectr.options[i].text=day31[i];
    if (calc == 30)DaysObjectr.options[i].text=day30[i];
    if (calc == 28)DaysObjectr.options[i].text=day28[i];
    if (calc == 29)DaysObjectr.options[i].text=day29[i];
  }
    }
  }
  DaysObject.selectedIndex = 0;

  for (i=0; i< calc1 ; i++)
  {
  if ( text == DaysObject.options[i].text)DaysObject.selectedIndex = i;
  if (Which == 'st'){
  if ( text == DaysObjectr.options[i].text)DaysObjectr.selectedIndex = i;
  }
  }

}
//function to set options to today
function SetToToday(form,Which)
{
var inp='VCT';
var inpd=Which+"date";
var inpm=Which+"month";
var inpy=Which+"year";

if (document.getElementById) {
  DaysObject=document.getElementById(inpd);
  MonthObject=document.getElementById(inpm);
  YearObject=document.getElementById(inpy);
 } else if (document.all) {
   fm=document.all[inp];
  DaysObject=document.all[inpd];
  MonthObject=document.all[inpm];
  YearObject=document.all[inpy];
 } else  if (document.layers) {
  DaysObject=document[inpd];
  MonthObject=document[inpm];
  YearObject=document[inpy];
 }

  YearObject[0].selected = true;
  MonthObject[NowMonth].selected = true;

  ChangeOptionDays(Which);

  DaysObject[NowDay-1].selected = true;
}

function setMDY(item0,item1,item2,item3)
{
  var months = new Array('Month','January','February','March','April','May','June','July','August','September','October','November','December');
  day31 = new Array('Dt','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31');
  day30 = new Array('Dt','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30');
  day28 = new Array('Dt','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28');
  day29 = new Array('Dt','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29');
  var d = new Date();
  var dyf = d.getFullYear();
  var years =new Array();
  var o=1;
  years[0]="Year";
 for (i = dyf; i < dyf+1; i++)
 {
 years[o]=new String(dyf);
 o++;
 years[o]=new String(dyf+1);
 o++;
 }
if (document.getElementById) {
  DaysObject=document.getElementById(item1);
  MonthObject=document.getElementById(item2);
  YearObject=document.getElementById(item3);
  FormObjectr=document.getElementById(item0);
  ;
 } else if (document.all) {
   DaysObject=document.all[item1];
  MonthObject=document.all[item2];
  YearObject=document.all[item3];
  FormObjectr=document.all[item0];

 } else  if (document.layers) {
  DaysObject=document[item1];
  MonthObject=document[item2];
  YearObject=document[item13];
  FormObjectr=document[item0];

 }
 var CDT=DaysObject.options[DaysObject.selectedIndex].text;
 var CMT=MonthObject.options[MonthObject.selectedIndex].text;
 var CYT=YearObject.options[YearObject.selectedIndex].text;

 DaysForThisSelection = 31;
  if (CMT == "April" || CMT == "June" || CMT == "September" || CMT == "November") DaysForThisSelection = 30;
  if (CMT == "February" && (CYT/4) != Math.floor(CYT/4)) DaysForThisSelection = 28;
  if (CMT == "February" && (CYT/4) == Math.floor(CYT/4)) DaysForThisSelection = 29;
 if (DaysForThisSelection == 31){
  DaysObject.options.length=0;
   DaysObject.options.length=day31.length;
  for (i=0; i< day31.length ; i++){
  DaysObject.options[i].text=day31[i];
 }
 }else if (DaysForThisSelection == 30){
  DaysObject.options.length=0;
   DaysObject.options.length=day30.length;
  for (i=0; i< day30.length ; i++){
  DaysObject.options[i].text=day30[i];
 }
 }else if (DaysForThisSelection == 29){
  DaysObject.options.length=0;
   DaysObject.options.length=day29.length;
  for (i=0; i< day29.length ; i++){
  DaysObject.options[i].text=day29[i];
 }
 }else if (DaysForThisSelection == 28){
  DaysObject.options.length=0;
   DaysObject.options.length=day28.length;
  for (i=0; i< day28.length ; i++){
  DaysObject.options[i].text=day28[i];
 }
 }
 for (i=0; i< DaysObject.length ; i++){
 if(CDT==DaysObject.options[i].text)DaysObject.selectedIndex=[i];
}
  MonthObject.options.length=0;
   MonthObject.options.length=months.length;
  for (i=0; i< months.length ; i++){
  MonthObject.options[i].text=months[i];
 }
 for (i=0; i< MonthObject.length ; i++){
 if(CMT==MonthObject.options[i].text)MonthObject.selectedIndex=[i];
}
  YearObject.options.length=0;
   YearObject.options.length=years.length;
  for (i=0; i< years.length ; i++){
  YearObject.options[i].text=years[i];
 }
 for (i=0; i< YearObject.length ; i++){
 if(CYT==YearObject.options[i].text)YearObject.selectedIndex=[i];
}
}

