function CalendarEntry(sm,sd,sy,em,ed,ey,cl,desc)
{
    this.startMonth = sm;
    this.startDay = sd;
    this.startYear = sy;
    this.endMonth = em;
    this.endDay = ed;
    this.endYear = ey;
    this.closed = cl;
    this.description = desc;
    
    // Figure out how and if this date is to be displayed
    var now = new Date();
    var year = now.getFullYear();
    this.tbd = (this.startDay == -1);       // If day=-1, display TBD
    if (this.startDay <= 0 ) {
        var cdate = new Date(this.startYear,this.startMonth-1,1,0,0,0);
    } else {
        var cdate = new Date(this.startYear,this.startMonth-1,this.startDay,0,0,0);
    }
    this.display = (cdate.getTime() >= now.getTime());
}
function ce_toString()
{
    if (!this.display) return "";
    var now = new Date();
    var currentYear = now.getFullYear();
    var s = '<tr valign="bottom">';
    s += '<td>';
    
    // Check for TBD
    if (this.tbd) {
	if (this.startMonth == -1) {
            s += 'TBD, '+this.startYear;
        } else {
            s += CalendarMonths[this.startMonth-1];
            s += ' TBD, '+this.startYear;
        }
    } else {
        s += CalendarMonths[this.startMonth-1];
        if (this.startDay != 0) s += ' ' + this.startDay;
        if (this.startYear != this.endYear || this.endYear == 0) {
            s += ", " + this.startYear;
        }
        if (this.endMonth != 0) {
            s += ' - ' + CalendarMonths[this.endMonth-1];
            if (this.endDay != 0) s+= ' ' + this.endDay;
            if (this.endDay != 0) s += ",";
            s += " " + this.endYear;
        }
    }
    if (this.closed) {
        s += '<span style="vertical-align:super; font-size:75%">*</span>';
    }
    s += '</td>'
    s += '<td><img src="./images/x.gif" width="20"></td>';
    s += '<td>' + this.description + '</td>';
    s += '</tr>';
    return s;
}
CalendarEntry.prototype.toString = ce_toString;
		
function generateCalendar(theCalendar, closedNote)
{
    var now = new Date();
    var year = now.getFullYear();
    var theDate;
    var i;
    var s = '<table style="margin-top:5px;" align="center" width="90%">';
        
    for (i=0; i<theCalendar.length; i++) {
        s += theCalendar[i].toString();
    }
    if (closedNote) {
        s += '<tr><td colspan="3" style="padding-top:10px;"><em><span style="vertical-align:super; font-size:75%">*</span> ' + closedMessage + '</em></td></tr>';
    }
    s += '</table>';
    return s;
}


