/*
 *		Very simple JSON newsreader
 *		Grabs json array from a newsflash.json file and puts it in the #newsflash container.
 *		(c) 2011 Russ / Razor-Studios
 *		Available under very expensive licence.
 */

$(window).load(function() {

	// Grab the JSON
	$.getJSON('site/content/newsflash.json', function(data) {
		
		// Make the Newest First
		data.articles.reverse();
		
		// Loop the articles
		for(i in data.articles)
		{
			// Max 3 Articles..
			if(i < 3)
			{
				// Article Date
				$('#newsflash').append('<p class="title">' + data.articles[i].date + '</p>');
				// Article Body
				$('#newsflash').append('<p class="article">' + data.articles[i].body + '</p>');
				
				// More link
				if(data.articles[i].href)
				{
					$('#newsflash').append('<p class="link"><a href="' + data.articles[i].href + '">Read More &gt;</a></p>');
				}
			}
		}

	});
});
