
var d=document;var newsList=[];var noticeList=[];
function newsItem( id, linkType, headline, releaseDate, uriPath ){this.id = id;this.linkType = linkType;this.headline = headline;this.releaseDate = releaseDate;this.uriPath = uriPath;}
function noticeItem( id, headline ){this.id = id;this.headline = headline;}
  newsList[ newsList.length ] = new newsItem(22388, "article", "Back to the Future Games Two Months Away", "03 Sep 2010", "Back-to-the-Future-Games-Two-Months-Away");
  newsList[ newsList.length ] = new newsItem(22387, "article", "PES 2011 Demo Hitting PSN, PC This Month", "03 Sep 2010", "PES-2011-Demo-Hitting-PSN-PC-This-Month");
  newsList[ newsList.length ] = new newsItem(22381, "article", "Japan Hardware: Go PSP, Go!", "03 Sep 2010", "Japan-Hardware-Go-PSP-Go");
  newsList[ newsList.length ] = new newsItem(10110199, "feature", "Review//Mafia II", "02 Sep 2010", "Mafia-II");
  newsList[ newsList.length ] = new newsItem(22344, "article", "UK Software Charts: Mafia II Makes an Offer You Can&#39;t Refuse", "31 Aug 2010", "UK-Software-Charts-Mafia-II-Makes-an-Offer-You-Cant-Refuse");


d.write( "<style type=\"text/css\">" +
         "  .spongNewsNote { font-size:10px; font-family: verdana; width: 1px; text-decoration: none ! important; }" +
         "  .spongNewsContainer { vertical-align:top; font-family: verdana; font-size: 10px; }" +
         "  .spongNewsListContainer {}" +
         "  .spongNewsListRowOdd td, .spongNewsListRowEven td { padding: 3px; vertical-align:top; font-family: verdana; font-size: 10px; text-decoration: none ! important; }" +
         "  .spongNewsReleaseDate { font-weight: bold; white-space: nowrap;  text-decoration: underline ! important; }" +
         "  .spongNewsHeadline { font-weight: bold; padding-bottom:5px; text-decoration: none ! important; }" +
         "  a:link, a:visited, a:active, a:hover { font-size: 10px; text-decoration: underline ! important; }" +
         "  .spongNewsHeadlineHref {}" +
         "  </style>");

function pickNews()
{
  d.write( "<div class=\"spongNewsContainer\">" );
  switch( arguments[0] )
  {
    case "t" :
      presentNewsTabular()
      break;
    default :
      presentNewsByDate()
      break;
  }
  d.write( "<span class=\"spongNewsNote\" style=\"white-space:nowrap; overflow:none ! important;\">news feed from <a href=\"http://SPOnG.com/\" target=\"spongNews\">SPOnG.com</a><br/>Add it to your site <a href=\"http://SPOnG.com/info/freenews.asp\" target=\"spongNews\">today</a></span>" );
  d.write( "</div>" );
}

function presentNewsTabular()
{
  var prevDate = new String("");
  var noticesDone = 0;
  var notice;
  var rand = 0;
  var maxNotes = Math.min( noticeList.length, Math.ceil(newsList.length/4) );
  d.write( "<table class=\"spongNewsListContainer\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">" );
  for( var i=0; i < newsList.length; i++)
  {
    if( (i+1) % Math.ceil(newsList.length/maxNotes) == 0 && noticeList.length > 0 )
    {
      rand = Math.floor((Math.random()*noticeList.length));
      notice = noticeList[ rand ];
      d.write( "<tr class=\"" + ( ((i+noticesDone)%2 == 0) ? ("spongNewsListRowOdd") : ("spongNewsListRowEven")) + "\">" +
               "<td colspan=\"2\" class=\"spongNewsHeadline\">" + noticeList[rand].headline + "</td>" +
               "</tr>" );
      //noticeList.splice(rand,1);
      noticesDone++;
    }

    d.write( "<tr class=\"" + ( ((i+noticesDone)%2 == 0) ? ("spongNewsListRowOdd") : ("spongNewsListRowEven")) + "\">" +
             "<td class=\"spongNewsHeadline\"><a href=\"http://spong.com/" + newsList[i].linkType + "/" + newsList[i].uriPath + "\" target=\"spongNews\" class=\"spongNewsHeadlineHref\">" + newsList[i].headline + "</a></td>" +
             "<td class=\"spongNewsReleaseDate\">" + newsList[i].releaseDate + "</td>" +
             "</tr>" );
  }
  d.write( "</table>" );
}

function presentNewsByDate()
{
  var prevDate = new String("");
  var noticesDone = 0;
  var notice;
  var rand = 0;
  var maxNotes = Math.min( noticeList.length, Math.ceil(newsList.length/4) );
  d.write( "<div class=\"spongNewsListContainer\">" );
  for( var i=0; i < newsList.length; i++)
  {
    if( prevDate != newsList[i].releaseDate )
    {
      d.write( "<div class=\"spongNewsReleaseDate\">" + newsList[i].releaseDate + "</div>" );
    }

    if( (i+1) % (Math.ceil(newsList.length/maxNotes)) == 0 && noticeList.length > 0 )
    {
      rand = Math.floor((Math.random()*noticeList.length));
      notice = noticeList[ rand ];
      d.write( "<div class=\"" + ( ((i+noticesDone)%2 == 0) ? ("spongNewsListRowOdd") : ("spongNewsListRowEven")) + "\">" +
               "<div class=\"spongNewsHeadline\">"+ noticeList[rand].headline + "</div>" +
               "</div>" );
      //noticeList.splice(rand,1);
      noticesDone++;
    }

    d.write( "<div class=\"" + ( ((i+noticesDone)%2 == 0) ? ("spongNewsListRowOdd") : ("spongNewsListRowEven")) + "\"><div class=\"spongNewsHeadline\"><a href=\"http://spong.com/" + newsList[i].linkType + "/" + newsList[i].id + "/" + newsList[i].uriPath + "\" target=\"spongNews\" class=\"spongNewsHeadlineHref\">" + newsList[i].headline + "</a></div></div>" );
    prevDate = newsList[i].releaseDate;
  }
  d.write( "</div>" );
}
pickNews("");
newsList = null;
