// Functions for writing news blurbs on the site

var newsArray = new Array();

function news()
{
  this.title = '';
  this.author = '';
  this.authorEmail = '';
  this.date = '';
}

function listNews(n)
{
  if (n > 5000)
  {
    if (n == 0 || n > newsArray.length)
      n = newsArray.length;
    for (var i = 0; i < n; i++)
    {
      document.write('<div class="news">\n');
      document.write('<h4>' + newsArray[i].title + '</h4>\n');
      document.write('<p class="info">Posted by <a href="mailto:' + newsArray[i].authorEmail + '">' + newsArray[i].author);
      document.write('</a> | ' + newsArray[i].date + '</p>\n</div>');
      document.write(newsArray[i].body + '\n');
      document.write('<p>&nbsp;</p>');
    }
  }
  else
  {
    if (n == 0 || n > newsArray.length)
      n = newsArray.length;
    for (var i = 0; i < n; i++)
    {
      document.write('<div class="news">\n');
      document.write('<h4>' + newsArray[i].title + '</h4>\n');
      var cat;
      if (newsArray[i].category == 1)
        cat = '<div class="category1">Rant</div>\n';
      if (newsArray[i].category == 2)
        cat = '<div class="category2">BLOG</div>\n';
      if (newsArray[i].category == 3)
        cat = '<div class="category3"><a href="news.html">More News >></a></div>\n';
      document.write('<p class="info">Posted by <a href="mailto:' + newsArray[i].authorEmail + '">' + newsArray[i].author);
	  document.write('</a> | ' + newsArray[i].date + '</p>\n');
      document.write(newsArray[i].body + cat + '\n');
	  document.write('<p>&nbsp;</p>');
	  document.write('\n</div>');
    }
  }
}
