// function to determine if a date (yyyymmdd) is in the future

function isFutureDate (comp_date)
   {
   var today = new Date();
   var todays_year = today.getFullYear();
   var todays_month = today.getMonth();
   var todays_day = today.getDate();
   var calc_date = todays_year*10000 + (todays_month+1)*100 + todays_day;
   if (comp_date > calc_date) return true;
   else return false;
   }

// code defining html for the event records on the noticeboard
// given an event and a name, this routine returns an anchor tag
// the event text is linked to an HTML notice file with the format nb_name.html

function link_html (event, name)
   {
   var s = event;
   if (name.length > 0) s = ' <a href="notices/nb_' + name + '.html">' + event + '</a>';
   return s;
   }

// code defining html for the event records on the noticeboard
// given an event and a name, this routine returns an anchor tag
// the event text is linked to a PDF notice file with the format nb_name.pdf

function link_pdf (event, name)
   {
   var s = event;
   if (name.length > 0) s = ' <a href="notices/nb_' + name + '.pdf" target="_blank">' + event + '</a>';
   return s;
   }

// use this routine when you have event, location, date and time
// this routine returns four fields with separators inside a <tr>...</tr> structure:
//   an event name which can be a link to the file called nb_name.html which contains the details
//   a venue
//   a date
//   a time
// to supress the link just leave name empty

function record1_html (event, venue, edate, etime, name)
   {
   var s = '<tr><td align="right">' + link_html(event, name) + '</td><td>&nbsp;</td>' +
           '<td align="right">' + venue + '</td><td>&nbsp;</td>' +
           '<td align="right">' + edate + '</td><td>&nbsp;</td>' +
           '<td align="right">' + etime + '</td><td>&nbsp;</td></tr>'
   return s;
   }

// use this routine when you want a free-format event record
// this record type has one field inside a <tr>...</tr> structure (with a colspan=8):
//   text +
//   an event name which is a link to the file called nb_name.html which contains the details +
//   text
// it is a generalised non-column format (since text can be empty) with a link wherever required
// to supress the link just leave name empty

function record2_html (text1, link, text3, name)
   {
   var s = '<tr><td align="left" colspan="8">' + text1 + ' ' +  link_html(link, name) +
           ' ' + text3 + '</td></tr>';
   return s;
   }

// this is the same as the routine above, but it links to a PDF rather than an HTML file

function record2_pdf (text1, link, text3, name)
   {
   var s = '<tr><td align="left" colspan="8">' + text1 + ' ' +  link_pdf(link, name) +
           ' ' + text3 + '</td></tr>';
   return s;
   }

