var validatePickUp = function(evt) {
  elemsWithErrors.each(clearErrorArray);
  elemsWithErrors = elemsWithErrors.compact();
  if ($F("customer").blank()) {
    handleError("customer", "Please enter the customer name.", true);
  } else if ($F("your_name").blank()) {
    handleError("your_name", "Please enter your name.", true);
  } else if ($F("phone").blank()) {
    handleError("phone", "Please enter your phone number.", true);
  } else if (!phoneRegex1.test($F("phone")) &&
             !phoneRegex2.test($F("phone")) &&
             !phoneRegex3.test($F("phone")) &&
             !phoneRegex4.test($F("phone"))) {
    handleError("phone", "Please enter a valid phone number in the format (###)###-####.", true);
  } else if ($F("email").blank()) {
    handleError("email", "Please enter your email address.", true);
  } else if (!emailRegex.test($F("email"))) {
    handleError("email", "Please enter a valid email address.", true);
  } else if ($F("location").blank()) {
    handleError("location", "Please enter the location.", true);
  } else if ($F("unit_num").blank()) {
    handleError("unit_num", "Please enter the unit number.", true);
  } else if ($F("ready_date").blank()) {
    handleError("ready_date", "Please enter the ready date.", true);
  } else if (!dateRegex.test($F("ready_date"))) {
    handleError("ready_date", "Please enter the ready date in the format MM/DD/YYYY.", true);
  } else if ($F("pickup_date").blank()) {
    handleError("pickup_date", "Please enter the pickup date.", true);
  } else if (!dateRegex.test($F("pickup_date"))) {
    handleError("pickup_date", "Please enter the pickup date, in the format MM/DD/YYYY.", true);
  } else {
    return true;
  }
  evt.stop();
  return false;
}
Event.observe(window, "load", function() {
  $("submitBtn").observe("click", validatePickUp.bindAsEventListener());
  Calendar.setup({
    dateField      : "ready_date",
    triggerElement : "ready-date-cal"
  });
  Calendar.setup({
    dateField      : "pickup_date",
    triggerElement : "pickup-date-cal"
  });
});