var date_start=0, date_end=365;

function afterSetDateValue(ref_field, target_field, date) {
  if (date!="") {
    var startDate=document.AirRqst.DepartDt;
    var endDate=document.AirRqst.ReturnDt;

    if (target_field==startDate) {

      var endDateStart=dayOffset(date, date_start), endDateEnd=dayOffset(date, date_end), endDateValue=getDateValue(endDate);
      setRange("conf", endDateStart, endDateEnd);

      if (checkDate(endDateValue)==0 && (compareDates(endDateStart, endDateValue)>0 || compareDates(endDateEnd, endDateValue)<0)) {
        setDateValue(endDate, endDateStart);
      }
    }
  }
  else {
    setRange("conf", "", "");
  }
}

function opencal1(inval) {
   if ( inval == "" ) {
      if ( document.AirRqst.DepartDt.value == "" ) {
	     showCalendar('',document.AirRqst.DepartDt,document.AirRqst.DepartDt,'','holder1',0,30,1);
	  }
   }
   else { showCalendar('',document.AirRqst.DepartDt,document.AirRqst.DepartDt,'','holder1',0,30,1); }	  	 
}

function opencal2(inval) {
   if ( inval == "" ) {
      if ( document.AirRqst.ReturnDt.value == "" ) {
	      showCalendar('conf',document.AirRqst.ReturnDt,document.AirRqst.ReturnDt,'','holder2',0,30,1);
	  }
   }
   else { showCalendar('conf',document.AirRqst.ReturnDt,document.AirRqst.ReturnDt,'','holder2',0,30,1); }	  	 
}

