// JavaScript Document
document.observe('dom:loaded', function() {
    //Get the querystring if there is one.
	var queryString = window.location.search.substring(1);
	if(queryString.length > 0)
	{
		/*var storyId = queryString.split("=")[1];
		if(storyId != '')
		{
			populateNews(storyId,true);
		}*/
		// use Prototype string API
		// toQueryParams 
		var params = queryString.toQueryParams();
		if (params.story != '')
		{
			populateNews(params.story, true);
		}
		else 
		{
			// TODO - get the latest story automatically
			// REPEATED BELOW
			// 24 = ecocetera
			populateNews(24,false); 
		}
	}
	else
	{
		// TODO - get the latest story automatically
		// REPEATED ABOVE
		// 24 = ecocetera
		populateNews(24,false); 
	}
});