  function show_calendar(str_target, str_datetime) {
    var arr_months = ["Januar", "Februar", "März", "April", "Mai", "Juni",
      "Juli", "August", "September", "Oktober", "November", "Dezember"];
    var week_days = ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"];
    var n_weekstart = 1; // day week starts from (normally 0 or 1)
    
    var dt_datetime = (str_datetime == null || str_datetime =="" ?  new Date() : str2dt4(str_datetime));
    var dt_prev_month = new Date(dt_datetime);
    dt_prev_month.setMonth(dt_datetime.getMonth()-1);
    if (dt_datetime.getMonth()%12 != (dt_prev_month.getMonth()+1)%12) {
      dt_prev_month.setMonth(dt_datetime.getMonth());
      dt_prev_month.setDate(0);
    }
    var dt_next_month = new Date(dt_datetime);
    dt_next_month.setMonth(dt_datetime.getMonth()+1);
    if ((dt_datetime.getMonth() + 1)%12 != dt_next_month.getMonth()%12)
      dt_next_month.setDate(0);
    
    var dt_firstday = new Date(dt_datetime);
    dt_firstday.setDate(1);
    dt_firstday.setDate(1-(7+dt_firstday.getDay()-n_weekstart)%7);
    var dt_lastday = new Date(dt_next_month);
    dt_lastday.setDate(0);
    
    // print calendar header
    var str_buffer = new String (
      "<html>\n"+
      "<head>\n"+
      "  <title>Kalender</title>\n"+
      "<link rel='stylesheet' type='text/css' href='http://www.bodo.de/efa/efa.css'>\n"+
      "<STYLE type='text/css'>\n"+
      "<!--\n"+
      "TD.heading { background-color: #FFCB08; text-decoration: none; color:#ffffff; text-decoration: none; font: bold 10px , verdana; }\n"+
      "A.focusDay:link { color: #FF0000; text-decoration: none; font: bold 10px , verdana; }\n"+
      "A.focusDay:hover { color: #FF0000; text-decoration: none; font: bold 10px , verdana; }\n"+
      "A.focusDay:visited { color: #FF0000; text-decoration: none; font: bold 10px , verdana; }\n"+
      "A.weekday:link { color: #0D73B2; text-decoration: none; font: bold 10px , verdana; }\n"+
      "A.weekday:hover { color: #FF0000; text-decoration: none; font: bold 10px , verdana; }\n"+
      "A.weekday { color: #0073B2; text-decoration: none; font: bold 10px , verdana; }\n"+
      "A.outOfMonthDay:link { color: #EDEEF5; text-decoration: none; font: bold 10px , verdana; }\n"+
      "A.outOfMonthDay:hover { color: #EDEEF5; text-decoration: none; font: bold 10px , verdana; }\n"+
      "A.outOfMonthDay { color: EDEEF5; text-decoration: none; font: bold 10px , verdana; }\n"+
      "-->\n"+
      "</STYLE>\n"+
      "</head>\n"+
      "<body bgcolor=\"#0073B2\">\n"+
      "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n"+
      "<tr bgcolor=\"#FFFFFF\"><td>\n"+
      "<table cellspacing=\"1\" cellpadding=\"1\" border=\"0\" width=\"100%\" bgcolor=\"#353C91\" align=\"center\">\n"+
      "<tr>\n  <td class=\"schwarz\" bgcolor=\"#EDEEF5\" align=\"left\">\n"+
      "<input class='button' type='button' name='previousMonth' value=' < ' onClick=\"javascript:window.opener.show_calendar('"+str_target+"', '"+dt2dtstr4(dt_prev_month)+"');\"></td>\n"+
      "  <td class=\"schwarz\" colspan=\"5\" align=\"center\" bgcolor=\"#FFF3D1\">"+
      arr_months[dt_datetime.getMonth()]+" "+dt_datetime.getFullYear()+"</td>\n"+
      "  <td class=\"schwarz\" bgcolor=\"#FFF3D1\" align=\"right\">\n"+
      "<input class='button' type='button' name='nextMonth' value=' > ' onClick=\"javascript:window.opener.show_calendar('"+str_target+"', '"+dt2dtstr4(dt_next_month)+"');\"></td>\n</tr>\n"
    );
  
    var dt_current_day = new Date(dt_firstday);
    // print weekdays titles
    str_buffer += "<tr>\n";
    for (var n=0; n<7; n++) {
      str_buffer += "  <td class='heading' align='center'>"+
      week_days[(n_weekstart+n)%7]+"</td>\n";
    }

    var current_date = new Date();
    current_day = current_date.getDate();

    // print calendar table
    str_buffer += "</tr>\n";
    while (dt_current_day.getMonth() == dt_datetime.getMonth() ||
      dt_current_day.getMonth() == dt_firstday.getMonth()) {
      // print row header
      str_buffer += "<tr>\n";
      for (var n_current_wday=0; n_current_wday<7; n_current_wday++) {
        if (dt_current_day.getDate() == dt_datetime.getDate() &&
          dt_current_day.getMonth() == dt_datetime.getMonth() &&
          dt_current_day.getYear() == dt_datetime.getYear())
          // print current date
          str_buffer += "  <td align='center' bgcolor='#FFFFFF'>";
        else if (dt_current_day.getDay() == 0 || dt_current_day.getDay() == 6)
          // weekend days
          str_buffer += "  <td align='center' bgcolor='#FFFFFF'>";
        else
          // print working days of current month
          str_buffer += "  <td align='center' bgcolor='#FFFFFF'>";

        if (dt_current_day.getMonth() == dt_datetime.getMonth() && dt_current_day.getDate() != current_day) {
          str_buffer += "<a class=\"weekDay\" href=\"javascript:window.opener.document.eingabe.itdDateDay.value='"+dt2day(dt_current_day)+
          "';window.opener.document.eingabe.itdDateMonth.value='"+dt2month(dt_current_day)+
          "';window.opener.document.eingabe.itdDateYear.value='"+dt2year(dt_current_day)+"';"+
          "window.close();\">";
        }
        else if (dt2day(dt_current_day) == current_day) {
          str_buffer += "<a class=\"focusDay\" href=\"javascript:window.opener.document.eingabe.itdDateDay.value='"+dt2day(dt_current_day)+
          "';window.opener.document.eingabe.itdDateMonth.value='"+dt2month(dt_current_day)+
          "';window.opener.document.eingabe.itdDateYear.value='"+dt2year(dt_current_day)+"';"+
          "window.close();\">";
        }
        else {
          str_buffer += "<a class=\"outOfMonthDay\" href=\"javascript:window.opener.document.eingabe.itdDateDay.value='"+dt2day(dt_current_day)+
          "';window.opener.document.eingabe.itdDateMonth.value='"+dt2month(dt_current_day)+
          "';window.opener.document.eingabe.itdDateYear.value='"+dt2year(dt_current_day)+"';"+
          "window.close();\">";
        }

        str_buffer += dt_current_day.getDate()+"</a></td>\n";
        dt_current_day.setDate(dt_current_day.getDate()+1);
      }
      // print row footer
      str_buffer += "</tr>\n";
    }
    // print calendar footer
    str_buffer +=

      "<tr>\n  <td colspan=\"7\" class=\"schwarz\" bgcolor=\"#FFF3D1\" align=\"center\">\n"+
      "<input class='button' type='button' name='thisDate' value=' heute ' onClick=\"javascript:window.opener.show_calendar('"+str_target+"', '"+dt2dtstr4(current_date)+"');\">\n"+
      "</td>\n</tr>\n"+


      "</table>\n" +
      "</tr>\n</td>\n</table>\n" +
      "</body>\n" +
      "</html>\n";
  
    var vWinCal = window.open("", "Kalender", 
      "width=200,height=200,status=no,resizable=no,top=200,left=200");
    vWinCal.opener = self;
    vWinCal.focus();
    var calc_doc = vWinCal.document;
    calc_doc.write (str_buffer);
    calc_doc.close();
  }
  // datetime parsing and formatting routimes
  function str2dt4 (str_datetime) {
    var re_date = /^(\d+)\/(\d+)\/(\d+)$/;
    if (!re_date.exec(str_datetime))
      return alert("Invalid Datetime format: "+ str_datetime);
    return (new Date (RegExp.$3, RegExp.$1-1, RegExp.$2));
  }
  function dt2dtstr4 (dt_datetime) {
    return (new String (
        (dt_datetime.getMonth()+1)+"/"+dt_datetime.getDate()+"/"+dt_datetime.getFullYear()));
  }
  function dt2month (dt_datetime) {
    strmon = new String (dt_datetime.getMonth()+1);
    if (strmon.length < 2)
      strmon = "0" + strmon;
    return (strmon);
  }
  function dt2day (dt_datetime) {
    strtag = new String (dt_datetime.getDate());
    if (strtag.length < 2)
      strtag = "0" + strtag;
    return (strtag);
  }
  function dt2year (dt_datetime) {
    var strjahr = new String (dt_datetime.getFullYear());
    jahr = strjahr.substr(2,2);
    return (jahr);
  }
  var datelike = new RegExp(/^(3[01]|0[1-9]|[12]\d)\-(0[1-9]|1[012])\-\d{4}/);

