
$(document).ready(displayEvents);
$(document).ready(displayDetail);

function displayEvents() {
   var siteId;
   $('td.ac_highlighted').click(function () {
      //kill selection from all & any
      $('.ac_higlighted').removeClass('ac_selected');

      //load events in event pane
      siteId = $(this).parents('table').attr('rel');
      $('#agenda_events').load('/templates/snippets/calendar_load.asp?a=events&d='+ this.getAttribute('rel') + '&s='+ siteId, null, displayDetail);

      //add selection to clicked cell
      $(this).addClass('ac_selected');
   });
}


function displayDetail() {
   // clear pane
   $('#agenda_detail').html('');

   // bind onclick
   $('.detail_link').click(function () {
      //load events in event pane
      // todo: for some reason, data from this load is not displayed in IE7. The content is set to innerHTML, but does not show in
      //	in the browser.. (??)
      // Since siFR is applied onload and this title is generated on demand, we need to reapply the siFR
      $('#agenda_detail').load('/templates/snippets/calendar_load.asp?a=detail&d='+ this.getAttribute('rel'), null, apply_siFR);

   });
}
