void test2() {
    Locale defaultLocale = Locale.getDefault();
    TimeZone reservedTimeZone = TimeZone.getDefault();
    Date d = new Date(2005 - 1900, Calendar.DECEMBER, 22);
    String formatted;

    TimeZone tz;
    SimpleDateFormat df;

    try {
      for (int i = 0; i < TIMEZONES.length; i++) {
        tz = TimeZone.getTimeZone(TIMEZONES[i]);
        TimeZone.setDefault(tz);
        df = new SimpleDateFormat(pattern, DateFormatSymbols.getInstance(OSAKA));
        Locale.setDefault(defaultLocale);
        System.out.println(formatted = df.format(d));
        if (!formatted.equals(DISPLAY_NAMES_OSAKA[i])) {
          throw new RuntimeException(
              "TimeZone "
                  + TIMEZONES[i]
                  + ": formatted zone names mismatch. "
                  + formatted
                  + " should match with "
                  + DISPLAY_NAMES_OSAKA[i]);
        }

        df.parse(DISPLAY_NAMES_OSAKA[i]);

        Locale.setDefault(KYOTO);
        df = new SimpleDateFormat(pattern, DateFormatSymbols.getInstance());
        System.out.println(formatted = df.format(d));
        if (!formatted.equals(DISPLAY_NAMES_KYOTO[i])) {
          throw new RuntimeException(
              "Timezone "
                  + TIMEZONES[i]
                  + ": formatted zone names mismatch. "
                  + formatted
                  + " should match with "
                  + DISPLAY_NAMES_KYOTO[i]);
        }
        df.parse(DISPLAY_NAMES_KYOTO[i]);
      }
    } catch (ParseException pe) {
      throw new RuntimeException("parse error occured" + pe);
    } finally {
      // restore the reserved locale and time zone
      Locale.setDefault(defaultLocale);
      TimeZone.setDefault(reservedTimeZone);
    }
  }
  /* look for the rate in te account file for the time in the login string */
  public RateEntry getRate(String login) {
    int logday = 0, rateday = 0;
    //    System.out.println("getRate: login='******'");
    String day, time, rate = null;
    StringTokenizer st = new StringTokenizer(login);
    // frits     pts/21       flash            Fri Mar 18 13:46 - 14:30 (6+00:44)
    //                                        ^              ^
    day = st.nextToken();
    time = st.nextToken();
    time = st.nextToken();
    time = st.nextToken().substring(0, 5);
    // System.out.println(login+" "+day+" "+time);
    // Get the international names of the days and which day is (1,2,3...
    // Then find day of each rate entry, (1,2,3,4
    // Now we can compare, independent of the language used for the days
    // Finally use the time to compare as well
    DateFormatSymbols dfs = new DateFormatSymbols();
    String[] days = dfs.getShortWeekdays();
    for (int j = 1; j < days.length; j++) {
      if (day.compareTo(days[j]) == 0) {
        logday = j;
        break;
      }
    }
    // logday -> the day given in the gorecords.xml file (the log)

    int n = rates.size();
    // the last rate applies if before the first entry
    // Init to last rate given in the account
    RateEntry tmpRE, saveRE = rates(n - 1);
    //    System.out.println("n="+n);
    for (int i = 0; i < n; i++) {
      tmpRE = rates(i);
      for (int j = 1; j < days.length; j++) {
        if (tmpRE.day.compareTo(days[j]) == 0) {
          rateday = j;
          break;
        }
      }
      //    System.out.println("j="+jday+" k="+kday+" "+tmpRE.time+" "+tmpRE.loginhr);
      // the last rate applies if before the first entry
      if (logday > rateday) {
        saveRE = tmpRE;
      }
      if ((logday == rateday) && (time.compareTo(tmpRE.time) >= 0)) {
        saveRE = tmpRE;
      }
    }
    return saveRE;
  }
 public JPanel getGuiPanel() {
   JPanel panel = new JPanel();
   JButton button = new JButton();
   button.addActionListener(new DoItListener());
   outputLabel = new JLabel("date appears here");
   DateFormatSymbols dateStuff = new DateFormatSymbols();
   month = new JComboBox(dateStuff.getMonths());
   day = new JTextField(8);
   year = new JTextField(8);
   JPanel inputPanel = new JPanel(new GridLayout(3, 2));
   inputPanel.add(new JLabel("Month"));
   inputPanel.add(month);
   inputPanel.add(new JLabel("Day"));
   inputPanel.add(day);
   inputPanel.add(new JLabel("Year"));
   inputPanel.add(button);
   inputPanel.add(outputLabel);
   return panel;
 }
 public LogDateChooser(String label) {
   thisDialog = this;
   border = new EtchedBorder();
   setBorder(border);
   Font f = new Font("Helvetica", Font.PLAIN, 10);
   title = new JLabel(label);
   add(title);
   setLayout(new DateLayout());
   dfs = new DateFormatSymbols();
   months = dfs.getMonths();
   weekdays = dfs.getShortWeekdays();
   for (int i = 0; i < 7; i++) {
     days[i] = new JLabel(weekdays[i + 1]);
     days[i].setFont(f);
     add(days[i]);
   }
   gc = new GregorianCalendar();
   mDown = new JButton("<");
   mDown.setMargin(new Insets(0, 0, 0, 0));
   mDown.addActionListener(new MDownEar());
   mDown.setBorderPainted(false);
   mDown.setFont(f);
   mDown.setForeground(Color.BLUE);
   add(mDown);
   mUp = new JButton(">");
   mUp.setMargin(new Insets(0, 0, 0, 0));
   mUp.addActionListener(new MUpEar());
   mUp.setBorderPainted(false);
   mUp.setFont(f);
   mUp.setForeground(Color.BLUE);
   add(mUp);
   month = new JLabel(months[gc.get(Calendar.MONTH)]);
   month.setHorizontalAlignment(SwingConstants.CENTER);
   month.setFont(f);
   add(month);
   year = new JLabel(new Integer(gc.get(Calendar.YEAR)).toString());
   year.setFont(f);
   add(year);
   yDown = new JButton("<");
   yDown.setMargin(new Insets(0, 0, 0, 0));
   yDown.addActionListener(new YDownEar());
   yDown.setBorderPainted(false);
   yDown.setFont(f);
   yDown.setForeground(Color.BLUE);
   add(yDown);
   yUp = new JButton(">");
   yUp.setMargin(new Insets(0, 0, 0, 0));
   yUp.addActionListener(new YUpEar());
   yUp.setBorderPainted(false);
   yUp.setFont(f);
   yUp.setForeground(Color.BLUE);
   add(yUp);
   //    System.out.println(year.getText());
   NumberEar numberEar = new NumberEar();
   for (int i = 0; i < 31; i++) {
     number[i] = new JButton(new Integer(i + 1).toString());
     number[i].setMargin(new Insets(0, 0, 0, 0));
     number[i].addActionListener(numberEar);
     number[i].setBorderPainted(false);
     number[i].setContentAreaFilled(false);
     number[i].setFont(f);
     number[i].setForeground(Color.BLUE);
     add(number[i]);
   }
   number[0].setForeground(Color.CYAN);
 }
  Double getCharge(String date, double howLong) {
    int jday = 0;
    Double nMins;
    String day, time, rate = null;
    double remain = howLong;
    StringTokenizer st = new StringTokenizer(date);
    day = st.nextToken();
    time = st.nextToken();
    time = st.nextToken();
    time = st.nextToken().substring(0, 5);
    nMins = AProps.getInstance().toMinutes(time);
    DateFormatSymbols dfs = new DateFormatSymbols();
    String[] days = dfs.getShortWeekdays();
    for (int j = 1; j < days.length; j++) {
      if (day.compareTo(days[j]) == 0) {
        jday = j;
        break;
      }
    }
    int n = rates.size(), tableNMin;
    // One Rate for the entire Login session
    if (n == 1) { // only one flat rate
      // Get time in hours
      Double howLongHr = howLong / 60.0;
      // Calc cost of logon time
      Double cost = new Double(rates(0).loginhr).doubleValue() * howLongHr;
      // Cost of each login
      Double login = new Double(rates(0).login).doubleValue();
      cost = cost + login;
      return (cost);
    }
    // Multiple Rates for this login session
    // Default to last rate in list so that if last rate is eg., Fri and
    // the current day is Sun, it will still use Friday.
    iRE = n - 1;
    RateEntry tmpRE, saveRE = rates(n - 1);
    for (int i = 0; i < n; i++) {
      tmpRE = rates(i);
      if (tmpRE.dayOfWeek() < jday) {
        saveRE = tmpRE;
        iRE = i;
      }
      tableNMin = (AProps.getInstance().toMinutes(tmpRE.time())).intValue();
      if ((tmpRE.dayOfWeek() == jday) && (nMins.intValue() > tableNMin)) {
        saveRE = tmpRE;
        iRE = i;
      }
    }
    tRE = iRE + 1; // iRE set rate, tRE set time until
    if (tRE >= n) tRE = 0;
    Double charge;
    int ndays;
    double diffMins;
    if (tRE == 0) {
      ndays = rates(0).dayOfWeek() + (7 - jday);
    } else {
      ndays = rates(tRE).dayOfWeek() - jday;
    }
    if (ndays > 7) ndays = ndays - 7;
    int nmin = AProps.getInstance().toMinutes(rates(tRE).time()).intValue() - nMins.intValue();
    diffMins = ndays * 24 * 60 + nmin;
    if (remain < diffMins) {
      diffMins = remain;
    }
    // Calc charge for the first period of time up to the next rate change
    Double hours = new Double(diffMins / 60.0);
    charge = new Double(hours * new Double(rates(iRE).loginhr()));
    // Add in the per session login rate
    charge += new Double(rates(iRE).login());
    remain -= diffMins;

    // now we have the charge for the first increment including the login,
    // calculate changes for remaining periods using their rates
    while (remain > 0.0) {

      if ((remain - rates(tRE).nMinutes()) >= 0) {

        charge += rates(tRE).nMinutes() * new Double(rates(tRE).loginhr()) / 60.0;
      } else {

        charge += remain * new Double(rates(tRE).loginhr()) / 60.0;
      }
      remain -= rates(tRE).nMinutes();
      iRE++;
      if (iRE >= n) iRE = 0;
      tRE++;
      if (tRE >= n) tRE = 0;
    }

    return (charge);
  }
  /**
   * Faces render output method .
   *
   * <p>Method Generator: org.sakaiproject.tool.assessment.devtoolsRenderMaker
   *
   * @param context <code>FacesContext</code> for the current request
   * @param component <code>UIComponent</code> being rendered
   * @throws IOException if an input/output error occurs
   */
  public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
    // get the calendar for the Locale, so this will be localized
    DateFormatSymbols dfs = new DateFormatSymbols();
    String[] days = dfs.getShortWeekdays();
    String[] months = dfs.getMonths();
    String jan = months[Calendar.JANUARY];
    String feb = months[Calendar.FEBRUARY];
    String mar = months[Calendar.MARCH];
    String apr = months[Calendar.APRIL];
    String may = months[Calendar.MAY];
    String jun = months[Calendar.JUNE];
    String jul = months[Calendar.JULY];
    String aug = months[Calendar.AUGUST];
    String sep = months[Calendar.SEPTEMBER];
    String oct = months[Calendar.OCTOBER];
    String nov = months[Calendar.NOVEMBER];
    String dec = months[Calendar.DECEMBER];
    String mon = days[Calendar.MONDAY];
    String tue = days[Calendar.TUESDAY];
    String wed = days[Calendar.WEDNESDAY];
    String thu = days[Calendar.THURSDAY];
    String fri = days[Calendar.FRIDAY];
    String sat = days[Calendar.SATURDAY];
    String sun = days[Calendar.SUNDAY];

    String contextPath = context.getExternalContext().getRequestContextPath();

    ResponseWriter writer = context.getResponseWriter();

    writer.write("<!--\n");
    writer.write("Title: Tigra Calendar\n");
    writer.write("URL: http://www.softcomplex.com/products/tigra_calendar/\n");
    writer.write("Version: 3.2\n");
    writer.write("Date: 10/14/2002 (mm/dd/yyyy)\n");
    writer.write(
        "Feedback: feedback@softcCalendar calendar = new GregorianCalendar(pdt);omplex.com (specify product title in the subject)\n");
    writer.write("Note: Permission given to use this script in ANY kind of applications if\n");
    writer.write("   header lines are left unchanged.\n");
    writer.write("Note: Script consists of two files: calendar?.js and calendar.html\n");
    writer.write("About us: Our company provides offshore IT consulting services.\n");
    writer.write("    Contact us at [email protected] if you have any programming task you\n");
    writer.write("    want to be handled by professionals. Our typical hourly rate is $20.\n");
    writer.write("-->\n");

    writer.write("<html>\n");
    //      writer.write("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n");
    //      writer.write(
    //        "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN>");
    //      writer.write("<html>\n");
    writer.write("<head>\n");
    writer.write("<title>Select Date, Please.</title>\n");
    writer.write("<style>\n");
    writer.write("	td {font-family: Tahoma, Verdana, sans-serif; font-size: 12px;}\n");
    writer.write("</style>\n");
    writer.write("<script language=\"JavaScript\">\n");
    writer.write("//<![CDATA[\n");
    writer.write("// months as they appear in the calendar's title\n");
    writer.write("// (These are dynamically built by locale DateFormatSymbols!)\n");
    writer.write(
        "var ARR_MONTHS = "
            + "[\""
            + jan
            + "\", \""
            + feb
            + "\", "
            + "\""
            + mar
            + "\", \""
            + apr
            + "\", "
            + "\""
            + may
            + "\", \""
            + jun
            + "\",\n");
    writer.write(
        "		\"" + jul + "\", \"" + aug + "\", " + "\"" + sep + "\", \"" + oct + "\", \"" + nov
            + "\", \"" + dec + "\"];\n");
    writer.write("// week day titles as they appear on the calendar\n");
    writer.write(
        "var ARR_WEEKDAYS = "
            + "[\""
            + sun
            + "\", \""
            + mon
            + "\", \""
            + tue
            + "\", "
            + "\""
            + wed
            + "\", \""
            + thu
            + "\", \""
            + fri
            + "\", "
            + "\"Sa\"];\n");
    writer.write("// day week starts from (normally 0-Su or 1-Mo)\n");
    writer.write("var NUM_WEEKSTART = 1;\n");
    writer.write(
        "// path to the directory where calendar images are stored. trailing slash req.\n");
    writer.write("var STR_ICONPATH = '" + contextPath + "/images/calendar/';\n");
    writer.write("\n");
    writer.write("var re_url = new RegExp('datetime=(\\-?\\d+)');\n");
    writer.write("var dt_current = (re_url.exec(String(window.location))\n");
    writer.write("	? new Date(new Number(RegExp.$1)) : new Date());\n");
    writer.write("var re_id = new RegExp('id=(\\d+)');\n");
    writer.write("var num_id = (re_id.exec(String(window.location))\n");
    writer.write("	? new Number(RegExp.$1) : 0);\n");
    writer.write("var obj_caller = (window.opener ? window.opener.calendars[num_id] : null);\n");
    writer.write("var root_url = new RegExp('root=(\\S+)');\n");
    writer.write(
        "var root = (root_url.exec(String(window.location)) ? new String(RegExp.$1) : \"\")\n");
    writer.write("if (obj_caller && obj_caller.year_scroll) {\n");
    writer.write("	// get same date in the previous year\n");
    writer.write("	var dt_prev_year = new Date(dt_current);\n");
    writer.write("	dt_prev_year.setFullYear(dt_prev_year.getFullYear() - 1);\n");
    writer.write("	if (dt_prev_year.getDate() != dt_current.getDate())\n");
    writer.write("		dt_prev_year.setDate(0);\n");
    writer.write("\n");
    writer.write("	// get same date in the next year\n");
    writer.write("	var dt_next_year = new Date(dt_current);\n");
    writer.write("	dt_next_year.setFullYear(dt_next_year.getFullYear() + 1);\n");
    writer.write("	if (dt_next_year.getDate() != dt_current.getDate())\n");
    writer.write("		dt_next_year.setDate(0);\n");
    writer.write("}\n");
    writer.write("\n");
    writer.write("// get same date in the previous month\n");
    writer.write("var dt_prev_month = new Date(dt_current);\n");
    writer.write("dt_prev_month.setMonth(dt_prev_month.getMonth() - 1);\n");
    writer.write("if (dt_prev_month.getDate() != dt_current.getDate())\n");
    writer.write("	dt_prev_month.setDate(0);\n");
    writer.write("\n");
    writer.write("// get same date in the next month\n");
    writer.write("var dt_next_month = new Date(dt_current);\n");
    writer.write("dt_next_month.setMonth(dt_next_month.getMonth() + 1);\n");
    writer.write("if (dt_next_month.getDate() != dt_current.getDate())\n");
    writer.write("	dt_next_month.setDate(0);\n");
    writer.write("\n");
    writer.write("// get first day to display in the grid for current month\n");
    writer.write("var dt_firstday = new Date(dt_current);\n");
    writer.write("dt_firstday.setDate(1);\n");
    writer.write("dt_firstday.setDate(1 - (7 + dt_firstday.getDay() - NUM_WEEKSTART) % 7);\n");
    writer.write("\n");
    writer.write("// function passing selected date to calling window\n");
    writer.write("function set_datetime(n_datetime, b_close) {\n");
    writer.write("	if (!obj_caller) return;\n");
    writer.write("\n");
    writer.write("	var dt_datetime = obj_caller.prs_time(\n");
    writer.write("		(document.cal ? document.cal.time.value : ''),\n");
    writer.write("		new Date(n_datetime)\n");
    writer.write("	);\n");
    writer.write("\n");
    writer.write("	if (!dt_datetime) return;\n");
    writer.write("	if (b_close) {\n");
    writer.write("		window.close();\n");
    writer.write("		obj_caller.target.value = (document.cal\n");
    writer.write("			? obj_caller.gen_tsmp(dt_datetime)\n");
    writer.write("			: obj_caller.gen_date(dt_datetime)\n");
    writer.write("		);\n");
    writer.write("	}\n");
    writer.write("	else obj_caller.popup(dt_datetime.valueOf());\n");
    writer.write("}\n");
    writer.write("\n");
    writer.write("function set_datetime_update(n_datetime, with_root) {\n");
    writer.write("  if (!obj_caller) return;\n");
    writer.write("\n");
    writer.write("  var dt_datetime = obj_caller.prs_time(\n");
    writer.write("    (document.cal ? document.cal.time.value : ''),\n");
    writer.write("    new Date(n_datetime)\n");
    writer.write("  );\n");
    writer.write("\n");
    writer.write("  if (!dt_datetime) return;\n");
    writer.write("  obj_caller.popup(dt_datetime.valueOf(), with_root);\n");
    writer.write("}\n");
    writer.write("//]]> \n");
    writer.write("</script>\n");
    writer.write("</head>\n");
    writer.write(
        "<body bgcolor=\"#FFFFFF\" marginheight=\"5\" marginwidth=\"5\" topmargin=\"5\" leftmargin=\"5\" rightmargin=\"5\">\n");
    // replaced these lines with document.write so dom balanced in XHTML
    //        writer.write("<table class=\"clsOTable\" cellspacing=\"0\" border=\"0\"
    // width=\"100%\">\n");
    //        writer.write("<tr><td bgcolor=\"#4682B4\">\n");
    //        writer.write("<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\"
    // width=\"100%\">\n");
    //        writer.write("<tr><td colspan=\"7\"><table cellspacing=\"0\" cellpadding=\"0\"
    // border=\"0\" width=\"100%\">\n");
    //        writer.write("<tr>\n");
    writer.write("<script language=\"JavaScript\">\n");
    //      writer.write("//<![CDATA[\n");
    //      writer.write("alert('got here');\n");
    //      writer.write("//<!--");
    writer.write(
        "document.write('<table>');"); // class=\"clsOTable\" cellspacing=\"0\" border=\"0\"
                                       // width=\"100%\">');\n");
    //      writer.write("document.write('<table class=\"clsOTable\" cellspacing=\"0\" border=\"0\"
    // width=\"100%\">');\n");
    writer.write("document.write('<tr><td bgcolor=\"#4682B4\">');\n");
    writer.write(
        "document.write('<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"100%\">');\n");
    writer.write(
        "document.write('<tr><td colspan=\"7\"><table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">');\n");
    writer.write("document.write('<tr>');\n");
    // following document.write() in original HTML/JavaScript was
    // nearly incomprehensible when generated into writer.write lines
    // broke up into shorter strings, hopefully more readable
    writer.write("document.write(\n");
    writer.write(
        "'<td>'+"
            +
            // using JavaScript ? operator
            "(obj_caller && obj_caller.year_scroll?"
            +
            // first alternative
            "'<a href=\"javascript:set_datetime_update('"
            + "+dt_prev_year.valueOf()+', root)\">"
            + "<img src=\"'+STR_ICONPATH+'prev_year.gif\" "
            + "width=\"16\" height=\"16\" border=\"0\" alt=\""
            + PREV_YEAR
            + "\"/></a>&#160;'"
            + ":"
            +
            // second alternative, a blank
            "'')+"
            + "'<a href=\"javascript:set_datetime_update("
            + "'+dt_prev_month.valueOf()+', root)\">"
            + "<img src=\"'+STR_ICONPATH+'prev.gif\" "
            + "width=\"16\" height=\"16\" border=\"0\" alt=\""
            + PREV_MONTH
            + "\"/></a></td>'+\n");
    writer.write(
        "'<td align=\"center\" width=\"100%\">"
            + "<font color=\"#ffffff\">'+"
            + "ARR_MONTHS[dt_current.getMonth()]+' '+"
            + "dt_current.getFullYear() + '</font></td>'+\n");
    writer.write(
        "'<td><a href=\"javascript:set_datetime_update('"
            + "+dt_next_month.valueOf()+', root)\">"
            + "<img src=\"'+STR_ICONPATH+'next.gif\" "
            + "width=\"16\" height=\"16\" border=\"0\" alt=\""
            + NEXT_MONTH
            + "\"/></a>'+"
            + // ? operator, again...
            "(obj_caller && obj_caller.year_scroll?"
            +
            // first alternative
            "'&#160;<a href=\"javascript:set_datetime_update("
            + "'+dt_next_year.valueOf()+', root)\">"
            + "<img src=\"'+STR_ICONPATH+'next_year.gif\" "
            + "width=\"16\" height=\"16\" border=\"0\" alt=\""
            + NEXT_YEAR
            + "\"/></a>'"
            + ":"
            +
            // second alternative, blank
            "'')"
            + "+'</td>'\n");
    writer.write(");\n");
    writer.write("document.write('</tr>');\n");
    writer.write("document.write('</table></td></tr>');\n");
    writer.write("document.write('<tr>')\n");
    // replaced these lines with document.write so dom balanced in XHTML
    //        writer.write("</script>\n");
    //        writer.write("</tr>\n");
    //        writer.write("</table></td></tr>\n");
    //        writer.write("<tr>\n");
    //        writer.write("<script language=\"JavaScript\">\n");
    writer.write("\n");
    writer.write("// print weekdays titles\n");
    writer.write("for (var n=0; n < 7; n++)\n");
    writer.write(
        "	document.write('<td bgcolor=\"#87cefa\" align=\"center\"><font color=\"#ffffff\">'+ARR_WEEKDAYS[(NUM_WEEKSTART+n)%7]+'</font></td>');\n");
    writer.write("document.write('</tr>');\n");
    writer.write("\n");
    writer.write("// print calendar table\n");
    writer.write("var dt_current_day = new Date(dt_firstday);\n");
    writer.write("while (dt_current_day.getMonth() == dt_current.getMonth() ||\n");
    writer.write("	dt_current_day.getMonth() == dt_firstday.getMonth()) {\n");
    writer.write("	// print row heder\n");
    writer.write("	document.write('<tr>');\n");
    writer.write("	for (var n_current_wday=0; n_current_wday < 7; n_current_wday++) {\n");
    writer.write("		if (dt_current_day.getDate() == dt_current.getDate()  && \n");
    writer.write("			dt_current_day.getMonth() == dt_current.getMonth())\n");
    writer.write("			// print current date\n");
    writer.write("			document.write('<td bgcolor=\"#ffb6c1\" align=\"center\" width=\"14%\">');\n");
    writer.write("		else if (dt_current_day.getDay() == 0 || dt_current_day.getDay() == 6)\n");
    writer.write("			// weekend days\n");
    writer.write("			document.write('<td bgcolor=\"#dbeaf5\" align=\"center\" width=\"14%\">');\n");
    writer.write("		else\n");
    writer.write("			// print working days of current month\n");
    writer.write("			document.write('<td bgcolor=\"#ffffff\" align=\"center\" width=\"14%\">');\n");
    writer.write("\n");
    writer.write(
        "		document.write('<a href=\"javascript:set_datetime('+dt_current_day.valueOf() +', true);\">');\n");
    writer.write("\n");
    writer.write("		if (dt_current_day.getMonth() == this.dt_current.getMonth())\n");
    writer.write("			// print days of current month\n");
    writer.write("			document.write('<font color=\"#000000\">');\n");
    writer.write("		else\n");
    writer.write("			// print days of other months\n");
    writer.write("			document.write('<font color=\"#606060\">');\n");
    writer.write("\n");
    writer.write("		document.write(dt_current_day.getDate()+'</font></font></a></td>');\n");
    writer.write("		dt_current_day.setDate(dt_current_day.getDate()+1);\n");
    writer.write("	}\n");
    writer.write("	// print row footer\n");
    writer.write("	document.write('</td></td></tr>');\n");
    writer.write("}\n");
    writer.write("if (obj_caller  &&  obj_caller.time_comp)\n");
    writer.write(
        "	document.write('<form onsubmit=\"javascript:set_datetime('+dt_current.valueOf()+', true)\" name=\"cal\"><tr><td colspan=\"7\" bgcolor=\"#87CEFA\"><font color=\"White\" face=\"tahoma, verdana\" size=\"2\">Time: <input type=\"text\" name=\"time\" value=\"'+obj_caller.gen_time(this.dt_current)+'\" size=\"8\" maxlength=\"8\"/></font></td></tr></form>');\n");
    writer.write("document.write('</table></td></tr></table>');\n");
    //      writer.write("//]]> \n");
    writer.write("</script>\n");
    // replaced these lines with document.write so DOM balanced in XHTML
    //        writer.write("</tr></td>\n");
    //        writer.write("</table></tr></td>\n");
    //        writer.write("</table>\n");
    writer.write("</body>\n");
    writer.write("</html>\n");
    writer.write("\n");
  }