/*  Copyright Mihai Bazon, 2002, 2003  |  http://dynarch.com/mishoo/
 * ------------------------------------------------------------------
 *
 * The DHTML Calendar, version 0.9.6 "Keep cool but don't freeze"
 *
 * Details and latest version at:
 * http://dynarch.com/mishoo/calendar.epl
 *
 * This script is distributed under the GNU Lesser General Public License.
 * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html
 */

/** The Calendar user click handler function. */

 function dateChanged(calendar) {
    // Beware that this function is called even if the end-user only
    // changed the month/year.  In order to determine if a date was
    // clicked you can use the dateClicked property of the calendar:
    if (calendar.dateClicked) {
      // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
      var y = calendar.date.getFullYear();
      var m = calendar.date.getMonth() + 1;     // integer, 0..11
      var d = calendar.date.getDate();      // integer, 1..31
      var mdy = "" ;
      var m0 = m ;
      var d0 = d ;
      if (d < 10) d0  = "0"+d;
      if (m < 10)  m0 = "0"+m;

      mdy = m0+"/"+d0+"/"+y;
       
      // redirect...
      //window.location = "http://mail.brantford.ca/brantfordevents.nsf/cew?openform?date="+m+"/"+d+"/"+y;
      // window.location = "http://mail.brantford.ca/brantfordevents.nsf/cewbydate?openform&date="+mdy;            
      window.open ("http://mail.brantford.ca/brantfordevents.nsf/cewbydate?openform&date="+mdy);

    }
    //else
    //   window.location = "http://mail.brantford.ca/brantfordevents.nsf/cewbydate?openform" ;
    
  };

Calendar.setup(
    {
      flat         : "calendar-container", // ID of the parent element
      flatCallback : dateChanged,          // our callback function
      weekNumbers  : false
    }
  );
  