// ================================================
// HHF internal functions
// by dta-online.com
// Autor: H.Schau
// ================================================


// Open Calender
function OpenCal(strZiel, strForm, strFeld, intWidth)
{

// If strFeld has a value, the lookup window starts in month of the date
// Zeile 22 "calendar_window" ist ein Fenstername, kein Titel ... deshalb keine Leerzeichen
// Feldname in Formular (zb Ankunft) muss mehr als 3 Zeichen haben
    strZiel = strZiel + strForm +"."+strFeld;

    if ((document.forms[strForm].elements[strFeld].value != "") )
    {
strZiel = strZiel + "&userdate=" + document.forms[strForm].elements[strFeld].value;
    }


    Test = window.open(strZiel, "calendar_window", 'width='+intWidth+',height=160,scrollbars=no,resizable');

    if (document.all)
      {
      var ClickX = window.event.x;
      var ClickY = window.event.y;
      if (navigator.appVersion.indexOf("MSIE 5")>0 )
      {
      Test.moveTo(ClickX+window.screenLeft-50, ClickY+window.screenTop+15);
      }
      }

}



  // by dta - check if the dates are valid
  function chkForm()
  {

   error=0;
     date1 = new Date(document.form.drop_a_year.value, document.form.drop_a_month.value -1, document.form.drop_a_day.value);
     if(date1.getMonth() > (document.form.drop_a_month.value -1)) {
             error=1;
     }
     date2 = new Date(document.form.drop_d_year.value, document.form.drop_d_month.value -1, document.form.drop_d_day.value);
     if(date2.getMonth() > (document.form.drop_d_month.value -1)) {
             error=1;
     }
     if(date1 >= date2) {
           error=1;
     }

     if(error) {
        alert("Please check the date! \n(not valid)" );
        document.form.drop_d_month.focus();
        return false;
     }

  }
