

function getFormattedTechnoteData (technotes, numItems) {
  var data = new Array();
  var notes = new Array();
  var j = 0;

  // Strip out TechNote instances, put them into notes array.
  for (var i = technotes.length; --i >=0; ) {
    if (technotes[i].constructor == TechNote) {
      notes[j++] = technotes[i];
    }
  }

  // Sort notes array by date.
  notes.sort(chronSortTechnotes);

  // Create array suitable for use by buildContentTable().
  for (var i = 0; i < numItems; i++) {
    data[i] = [notes[i].name, 
               "../../asdg/technotes/" + notes[i].folder, 
               notes[i].dateadded];
  }

  // Custom chronological sort function.
  function chronSortTechnotes (tn1, tn2) {
    return tn2.dateadded.getTime() - tn1.dateadded.getTime();
  }

  return data;
}


