// $Id: sm_archive.js,v 1.2 2005/03/29 22:56:31 barryh Exp $
// $Source: /usr/local/cvsroot/projects/squash/vioma/content/scripts/sm_archive.js,v $

// Generate list of archived content files, e.g. features and articles
function archiveLinks(archive) {
    var ii=0;
    // remove extra formatting from description
    //for (ii=0; ii<archive.length-4; ii=ii+4) {
    //    archive[ii+3] = reformat( archive[ii+3] );
    //}

    // write the list of links
    document.writeln('<table border="1">');
    for (ii=0; ii<archive.length-5; ii=ii+5) {
        var date = archive[ii+0];
        var url = '/vcm/' + archive[ii+1] + '/' + archive[ii+2];
        var title = archive[ii+3];
        var author = archive[ii+4];
        if (title != '') {
            document.writeln('<tr>'
                           + '<td width="80px"><span class="default">' + date + '</span></td>'
                           + '<td width="250px"><a href="' + url + '"><font color="#990000"><span class="link">' + title + '</span></font></a></td>'
                           + '<td width="100px" style="border:none"><span class="default">' + author + '</span></td>'
                         //+ '<br><span style="color:blue">' + archive[ii+1] + '</span>'
                         //+ '<br><span style="color:red">' + archive[ii+2] + '</span>'
                         //+ '<br>' + archive[ii+3]
                           + '</tr>');
        }
    }
    document.writeln('</table>');
    document.writeln('<br/>');
}

// helper to remove extra HTML formatting that was inserted by CML into the RTF field
function reformat(mystring) {
    var s = mystring.replace(/&#60;span&#62;/g, "");
    s = s.replace(/&#60;\/span&#62;/g, " ");

    s = s.replace(/&#60;br&#62;/g, "<br>");
    s = s.replace(/&#60;\/br&#62;/g, " ");
    return s;
}