
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(22381, "article", "Japan Hardware: Go PSP, Go!", "03 Sep 2010", "Japan-Hardware-Go-PSP-Go");
  newsList[ newsList.length ] = new newsItem(22378, "article", "Japanese Software Chart: Capcom Cats Get the Cream", "03 Sep 2010", "Japanese-Software-Chart-Capcom-Cats-Get-the-Cream");
  newsList[ newsList.length ] = new newsItem(10110198, "feature", "Review//Valkyria Chronicles II", "02 Sep 2010", "Valkyria-Chronicles-II");
  newsList[ newsList.length ] = new newsItem(22374, "article", "Sony&#39;s Massive TGS Line-Up Revealed", "02 Sep 2010", "Sonys-Massive-TGS-Line-Up-Revealed");
  newsList[ newsList.length ] = new newsItem(22360, "article", "The 3rd Birthday set to Party on PS3?", "01 Sep 2010", "The-3rd-Birthday-set-to-Party-on-PS3");
  newsList[ newsList.length ] = new newsItem(22323, "article", "Japan Video Games Hardware: Robots Secure PS3 Win", "27 Aug 2010", "Japan-Video-Games-Hardware-Robots-Secure-PS3-Win");
  newsList[ newsList.length ] = new newsItem(22321, "article", "Japanese Game Charts: Another Century&#39;s #1", "27 Aug 2010", "Japanese-Game-Charts-Another-Centurys-1");
  newsList[ newsList.length ] = new newsItem(22311, "article", "Hirai: PS3 Can Beat PS2 Sales at End of 10 Year Lifecycle", "26 Aug 2010", "Hirai-PS3-Can-Beat-PS2-Sales-at-End-of-10-Year-Lifecycle");
  newsList[ newsList.length ] = new newsItem(22247, "article", "Hope for LittleBigPlanet PSP Sequel Builds", "20 Aug 2010", "Hope-for-LittleBigPlanet-PSP-Sequel-Builds");
  newsList[ newsList.length ] = new newsItem(22245, "article", "Japan Hardware: Sales Up Despite Software Slump", "20 Aug 2010", "Japan-Hardware-Sales-Up-Despite-Software-Slump");
  newsList[ newsList.length ] = new newsItem(22244, "article", "Japanese Software Charts: Wii Party Reigns Again", "20 Aug 2010", "Japanese-Software-Charts-Wii-Party-Reigns-Again");
  newsList[ newsList.length ] = new newsItem(22234, "article", "Next-Gen PSP to Feature Touch Controls", "19 Aug 2010", "Next-Gen-PSP-to-Feature-Touch-Controls");
  newsList[ newsList.length ] = new newsItem(22232, "article", "Pachter Admits: &#34;I don&#39;t Really Know&#34;", "19 Aug 2010", "Pachter-Admits-I-dont-Really-Know");
  newsList[ newsList.length ] = new newsItem(22217, "article", "PES 2011 Release Date Challenges FIFA 11 - UK Update", "18 Aug 2010", "PES-2011-Release-Date-Challenges-FIFA-11-UK-Update");
  newsList[ newsList.length ] = new newsItem(22182, "article", "Sony makes PSP into iPhone Challenger", "16 Aug 2010", "Sony-makes-PSP-into-iPhone-Challenger");


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;
