// JavaScript Document

                        
//Creating a date object from the arrival date forms
//REMEMBER TO USE onSubmit="return adate()"; in the FORM TAG, TAKE OUT ONCLICK ON THE SUBMIT BUTTON
function adate () {

   var gotday = document.search.day.options[document.search.day.selectedIndex].text;
   var gotmonth = document.search.month.options[document.search.month.selectedIndex].text;
   var gotyear = document.search.year.options[document.search.year.selectedIndex].text;
   var gotdate = gotmonth + " " + gotday + ", " + gotyear ;
   var datestring = gotdate.toString();
   searchdate = new Date( datestring  );
   searchstring = searchdate.toString();
   todow = searchstring.substring(0,3); 		
   tomo = searchstring.substring(4,10);      
//object converted to milliseconds
   
   arrtime = searchdate.getTime();

//Creating new date Object in milliseconds

   now = new Date();
   currtime = now.getTime();
         
//subtract arrivaltime - current time, in milliseconds

difference = arrtime - currtime;

//convert 48 hours into milliseconds

delaytime = 2 * 24 * 60 * 60 * 1000;

   	
if (difference <= delaytime) {
	alert("No OnLine booking within 48 hours of today's date");
	return false;
	}
	return(checkDate());
}
