// archive: and object with an members array of items to list // // usually an archive of news articles or press releases to list // grouped by date function buildArticleArchive(archive, sidParam) { var html = ""; try { var headlineList = archive.members; var items = headlineList.length; var articleDate; var prevDate = new Date(0); for (var i=items-1; i>=0; i--) { try { var item = headlineList[i]; if (item.date) { var articleUTCDate = item.date; var y = parseInt(articleUTCDate.substring(0,4), 10); var m = parseInt(articleUTCDate.substring(5,7), 10) - 1; var d = parseInt(articleUTCDate.substring(8,10), 10); // parse the hour and timezone offset from UTC, and correct hour value var h = parseInt(articleUTCDate.substring(11,13), 10); var t = parseInt(articleUTCDate.substring(20,22), 10); h = h - t; if (h < 0) { h = 24 + h; d--; if (d < 1) { d = 1; } // yea, wrong but the tournament doesnt span over more than one month } articleDate = new Date(Date.UTC(y, m, d, h)); if ((articleDate.getDate() != prevDate.getDate()) || (items-1 == i)) { if (items-1 != i) { // need to skip the first one html += ""; } if (archive.type == "press") { html += "" + articleDate.toLocaleDateString() + ""; } else { html += "