<!--
  var callbackFunction = null;

  function hideCalendar() {
    document.getElementById("calendar").style.display = "none";
    if (callbackFunction != null)
    	callbackFunction();
    return true;
  }
  
  function showCalendarWithCallback(callback) {
    callbackFunction = callback;
    showCalendar();
  }
  
  function showCalendar() {
    document.getElementById("calendar").style.display = "block";
    return true;
  }
  
  function drawCalendar() {
    var year = document.calendarForm.year;
    var month = document.calendarForm.month;
    var day = document.calendarForm.day;
    date = getDate(year, month, day);
    date.setDate(1);
    document.getElementById("cal_label").replaceChild(
  	    document.createTextNode(months[date.getMonth()] + " " + (date.getFullYear())),
  	    document.getElementById("cal_label").childNodes[0]);
    var y = 0;
    var x = 0;
    var previousDay = 0;
    while (y < 6) {
      var display = 0;
      document.getElementById("cal_" + x + "_" + y).parentNode.className="";
      if ((y == 0 && x < date.getDay()) || date.getDate() < previousDay)
          display = " ";
      else {
          display = date.getDate();
          if (date.getDate() == day.value)
              document.getElementById("cal_" + x + "_" + y).parentNode.className="selectedCalendarDate";
          previousDay = date.getDate();
  	      date.setDate(previousDay + 1);
      }

      document.getElementById("cal_" + x + "_" + y).replaceChild(
  			document.createTextNode(display),
  			document.getElementById("cal_" + x + "_" + y).childNodes[0]);
      x = (x + 1) % 7;
  	  if (x == 0)
  	    y++;
    }
    return false;
  }

  function previousYear() {
    var year = document.calendarForm.year;
    var month = document.calendarForm.month;
    var day = document.calendarForm.day;
    date = getDate(year, month, day);
    date.setYear(date.getFullYear() - 1);
    year.value = date.getFullYear();
    month.value = date.getMonth();
    day.value = date.getDate();
    drawCalendar(year, month, day);
  }

  function nextYear() {
    var year = document.calendarForm.year;
    var month = document.calendarForm.month;
    var day = document.calendarForm.day;
    date = getDate(year, month, day);
    date.setYear(date.getFullYear() + 1);
    year.value = date.getFullYear();
    month.value = date.getMonth();
    day.value = date.getDate();
    drawCalendar(year, month, day);
  }

  function nextMonth() {
    var year = document.calendarForm.year;
    var month = document.calendarForm.month;
    var day = document.calendarForm.day;
    var oldMonth = month.value;
    date = getDate(year, month, day);
    date.setMonth(date.getMonth() + 1);
    if (oldMonth != 11 && Math.abs(date.getMonth() - oldMonth) > 1)
        date.setDate(0);
    year.value = date.getFullYear();
    month.value = date.getMonth();
    day.value = date.getDate();
    drawCalendar(year, month, day);
  }

  function previousMonth() {
    var year = document.calendarForm.year;
    var month = document.calendarForm.month;
    var day = document.calendarForm.day;
    var oldMonth = month.value;
    date = getDate(year, month, day);
    date.setMonth(date.getMonth() - 1);
    if (date.getMonth() == oldMonth)
        date.setDate(0);
    year.value = date.getFullYear();
    month.value = date.getMonth();
    day.value = date.getDate();
    drawCalendar(year, month, day);
  }

  function getDate(year, month, day) {
    var date = new Date();
    if (year.value)
        date.setFullYear(year.value);
    if (month.value)
        date.setMonth(month.value);
    if (day.value)
        date.setDate(day.value);
    day.value = date.getDate();
    month.value = date.getMonth();
    year.value = date.getFullYear();
    return date;
  }
// -->

