      var count=0;

    function Onlyone()
   {
        if (count == 0)
         {
         count++;
         return true;
         }
      else
     {
   alert('Please wait, your request is being processed.');
         return false;
     }
   }

// dates stuff
var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');

function getArrDayOfWeek()
{
	var y = document.myForm.arrival_year.options[document.myForm.arrival_year.selectedIndex].value;
	var m = document.myForm.arrival_month.options[document.myForm.arrival_month.selectedIndex].value;
	var d = document.myForm.arrival_day.options[document.myForm.arrival_day.selectedIndex].value;
	var c = new Date(y,m-1,d,0,0,0);
	var dayOfWeek = c.getDay();
	document.myForm.arrivaldow.value = days[dayOfWeek];
	getDepDayOfWeek();
}

function getDepDayOfWeek()
{
	var y = document.myForm.departure_year.options[document.myForm.departure_year.selectedIndex].value;
	var m = document.myForm.departure_month.options[document.myForm.departure_month.selectedIndex].value;
	var d = document.myForm.departure_day.options[document.myForm.departure_day.selectedIndex].value;
	var c = new Date(y,m-1,d,0,0,0);
	var dayOfWeek = c.getDay();
	document.myForm.departuredow.value = days[dayOfWeek];
}

      // quadYear
function y2k(number){return (number < 1000) ? number + 1900 : number;}

function isLeapYear(yr)
{
  if (((yr % 4 == 0) && (yr % 100 != 0)) || (yr % 400 == 0)) { return true; }
  else { return false; }
}

function changeDates()
{
  theForm = document.myForm;
  var date;
  yearOffset = parseInt(theForm.arrival_year.options[0].value,10);
  var inMonth=theForm.arrival_month.selectedIndex;
  var inYear=parseInt(theForm.arrival_year.options[theForm.arrival_year.selectedIndex].value,10);
  
	
  if(isLeapYear(inYear)) { var days = new Array(31,29,31,30,31,30,31,31,30,31,30,31); }
  else { var days = new Array(31,28,31,30,31,30,31,31,30,31,30,31); }

  var inMonthVal = theForm.arrival_month.options[theForm.arrival_month.selectedIndex].value;
  var inDay=parseInt(theForm.arrival_day.options[theForm.arrival_day.selectedIndex].value,10);
  	date=inDay+"-"+inMonthVal+"-"+inYear;
	document.cookie="homepageADates="+escape(date)+';path=/';

  if(inDay >= days[inMonth]) { inDay = days[inMonth]; }
  else { inDay = inDay%days[inMonth]; }
  theForm.arrival_day.options[inDay-1].selected=true;

  outMonth=inMonth;
  outDay = inDay%days[inMonth];
  outYear=inYear;
  if(outDay == 0) { outMonth = (inMonth + 1) % 12; }
  if(outDay == 0 && inMonth == 11) { outYear++; }

  theForm.departure_month.options[outMonth].selected=true;
  theForm.departure_day.options[outDay].selected=true;
  theForm.departure_year.options[(outYear-yearOffset)].selected=true;
	var outDay=parseInt(theForm.departure_day.options[theForm.departure_day.selectedIndex].value,10);
	var outMonthVal = theForm.departure_month.options[theForm.departure_month.selectedIndex].value;
	date=outDay+"-"+outMonthVal+"-"+outYear;
	document.cookie="homepageDDates="+escape(date)+';path=/';

  getArrDayOfWeek();
}

function checkOutDate()
{
//  if (cal != "")
//	  alert("in checkoutdate");
  theForm = document.myForm;
  yearOffset = parseInt(theForm.arrival_year.options[0].value,10);
  var outMonth=theForm.departure_month.selectedIndex;
  var outYear=parseInt(theForm.departure_year.options[theForm.departure_year.selectedIndex].value,10);
	
  if(isLeapYear(outYear)) { var days = new Array(31,29,31,30,31,30,31,31,30,31,30,31); }
  else { var days = new Array(31,28,31,30,31,30,31,31,30,31,30,31); }

  var outDay=parseInt(theForm.departure_day.options[theForm.departure_day.selectedIndex].value,10);
  var outMonthVal = theForm.departure_month.options[theForm.departure_month.selectedIndex].value;
	date=outDay+"-"+outMonthVal+"-"+outYear;
	document.cookie="homepageDDates="+escape(date)+';path=/';

  if(outDay >= days[outMonth]) { outDay = days[outMonth]; }
  else { outDay = outDay%days[outMonth]; }
  theForm.departure_day.options[outDay-1].selected=true;

  getDepDayOfWeek();
}
