var inday = new Date(); inday.setDate(inday.getUTCDate()+1) // initial check-in tomorrow
var outday = new Date(); outday.setDate(inday.getUTCDate()+2) // check-out day after tomorrow

function selectdate(form) {
  document.resform.date11.selectedIndex = inday.getUTCDate()-1  // runs from 1 to last day in month
  document.resform.date12.selectedIndex = inday.getUTCMonth()   // runs from 0 to 11
  document.resform.date13.selectedIndex = inday.getUTCFullYear()-2008
  document.resform.date21.selectedIndex =outday.getUTCDate()-1
  document.resform.date22.selectedIndex =outday.getUTCMonth()
  document.resform.date23.selectedIndex =outday.getUTCFullYear()-2008
}

function adjustdate(form) { 
  inday.setYear(document.resform.date13.selectedIndex+2008)
  inday.setMonth(document.resform.date12.selectedIndex)
  inday.setDate(document.resform.date11.selectedIndex+1)
  if (outday.getTime() <= inday.getTime()) 
  {
  	outday.setTime(inday.getTime())
  	outday.setDate(outday.getUTCDate()+1)
  }

  document.resform.date11.selectedIndex = inday.getUTCDate()-1
  document.resform.date12.selectedIndex = inday.getUTCMonth()
  document.resform.date13.selectedIndex = inday.getUTCFullYear()-2008
  document.resform.date21.selectedIndex =outday.getUTCDate()-1
  document.resform.date22.selectedIndex =outday.getUTCMonth()
  document.resform.date23.selectedIndex =outday.getUTCFullYear()-2008
}

function adjustoutdt(form) { 
  outday.setYear(document.resform.date23.selectedIndex+2008)
  outday.setMonth(document.resform.date22.selectedIndex)
  outday.setDate(document.resform.date21.selectedIndex+1)
  document.resform.date21.selectedIndex =outday.getUTCDate()-1
  document.resform.date22.selectedIndex =outday.getUTCMonth()
  document.resform.date23.selectedIndex =outday.getUTCFullYear()-2008
}

function emailtest(email) {
  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email.value)){ return true; }
  else {
    alert("Invalid E-mail Address!\r" + email.value + " \rPlease re-enter.")
    email.focus(); email.select();
    return false;
  }
}
function nametest(reqr) {
  if (reqr.value != '') { return true; }
  else {
    alert("Please enter your name.")
    reqr.focus(); reqr.select();
    return false;
  }
}
function roomtest(rmtp1,rmtp2,rmtp3,rmtp4,rmtp5,rmtp6,rmtp7) {
  if (rmtp1.checked ||
  	 rmtp2.checked ||
  	 rmtp3.checked ||
  	 rmtp4.checked ||
  	 rmtp5.checked ) { return true; }
  else {
    alert("Please select at least one type of villa")
    return false;
  }
}

