function sentence(bodytext) {
  return bodytext.substr(0, bodytext.indexOf('.') + 1);
}

function noticeitem(date, header, body) {
    var output = "";
    output += '<div class="notice">';
    output += '<a href="news.html#' + date + '">';
    output += '<h4>' + date + '</h4>';
    output += '<p class="upper"><b>' + header + '</b></p>';
    output += '<p>' + sentence(body) + '</p>';
    output += '</a></div>';

    document.write(output);
}

function notices(number) {
    if(!number) {
	number = articles.length;
    }
    for(i = 0; i < number && i < articles.length; i++) {
	noticeitem(articles[i][0], articles[i][1], articles[i][2]);
    }
}

function newsitem(date, header, body, href) {
    var output = "";
    output += '<a name="' + date + '"><h4 style="margin-bottom: 0px">' + date + '</h4></a>';
    output += '<h3>' + header + '</h3>';
    output += '<p>' + body + '</p>';
    output += '<br/>';
    
    document.write(output);
}

function news(number) {
    if(!number) {
	number = articles.length;
    }
    for(i = 0; i < number && i < articles.length; i++) {
	newsitem(articles[i][0], articles[i][1], articles[i][2]);
    }
}
