var now = new Date();
var currday = now.getDate();
var currmonth = now.getMonth()+1;

function loadDates() {
  var currdate = new Date();
  var currday = now.getDate();
  var currmonth = now.getMonth()+1;
  var curryear = now.getYear();
  if(curryear < 1900) {
    curryear = curryear + 1900;
  }
  var neatdate = currmonth + '/' + currday + '/' + curryear;
  document.forms[0].inputdatein.value = neatdate;
  document.forms[0].inputdateout.value = neatdate;
}

function processDates() {
  var arrdate = document.forms[0].inputdatein.value;
  var arrdatesplit = arrdate.split("/");
  var arrday = arrdatesplit[1];
  var arrmonth = arrdatesplit[0];
  if(arrmonth == '01') {
    arrmonth = '00';
  } else {
    arrmonth = arrmonth-1;
  }
  var arryear = arrdatesplit[2];
  
  var depdate = document.forms[0].inputdateout.value;
  var depdatesplit = depdate.split("/");
  var depday = depdatesplit[1];
  var depmonth = depdatesplit[0];
  if(depmonth == '01') {
    depmonth = '00';
  } else {
    depmonth = depmonth-1;
  }
  var depyear = depdatesplit[2];
  document.forms[0].arrivalDay.value = arrday;
  document.forms[0].arrivalMonthYear.value = arryear + arrmonth;
  document.forms[0].departureDay.value = depday;
  document.forms[0].departureMonthYear.value = depyear + depmonth;
}

var yesterday = new Date();
yesterday.setDate(yesterday.getDate()-1);

var calin = new CalendarPopup();
calin.addDisabledDates(null,formatDate(yesterday,"yyyy-MM-dd"));
var calout = new CalendarPopup();
calout.addDisabledDates(null,formatDate(yesterday,"yyyy-MM-dd"));