// JavaScript Document
$(document).ready(function(){

	$("#xebecPressReleases li:last-child").addClass("lastInlist");


	$.jGFeed('http://feeds.feedburner.com/ngvglobal',
	function(feeds){
	  // Check for errors
	  if(!feeds){
		// there was an error
		return false;
	  }
	  // do whatever you want with feeds here
	  for(var i=0; i<4; i++){
		var entry = feeds.entries[i];			
		var snippetttext = entry.contentSnippet;
		//snippetttext = snippetttext.substring(0,90);
	
		var spacetext ="";
		var newsnippetttext = snippetttext.replace("...", " ");	
		
		//Unordered List
			var html = '<li>';
			//trace( $item.attr("link") );
			
			html += '<div class="rssheader"><h3><a href="'+ entry.link +'" target="_blank">' + entry.title + '</a></h3> ' +
			
		  	'<p class="date">' + entry.publishedDate + '</p></div>' +
			
			'<p>' + newsnippetttext  + ' <a href="'+ entry.link +'" target="_blank">[...]</a>' + '</p>' + '</li>';
			
			
			
			
			$('#ngvglobalFeed').append(html);
	  
	  }
	}, 10);
	
	$.jGFeed('http://biogasenergy.wordpress.com/feed/',
	function(feeds){
	  // Check for errors
	  if(!feeds){
		// there was an error
		return false;
	  }
	  // do whatever you want with feeds here
	  for(var i=0; i<4; i++){
		var entry = feeds.entries[i];			
		var snippetttext = entry.contentSnippet;
		//snippetttext = snippetttext.substring(0,90);
		
		var spacetext ="";
		var newsnippetttext = snippetttext.replace("...", " ");

			//Unordered List
			var html = '<li>';
			//trace( $item.attr("link") );
			
			html += '<div class="rssheader"><h3><a href="'+ entry.link +'" target="_blank">' + entry.title + '</a></h3> ' +
			
		  	'<p class="date">' + entry.publishedDate + '</p></div>' +
			
			'<p>' + newsnippetttext + '<a href="'+ entry.link +'" target="_blank">[...]</a>' + '</p>' + '</li>';
			
			// '<p>' + $item.attr("c:date") + '</p>' +
			
			
			$('#BiogasEnergyFeed').append(html);
	  
	  }
	}, 10);
	
	
	$.jGFeed('http://www.epa.gov/lmop/rss/whatsnew_rss.xml',
	function(feeds){
	  // Check for errors
	  if(!feeds){
		// there was an error
		return false;
	  }
	  // do whatever you want with feeds here
	  for(var i=0; i<4; i++){
			
			var entry = feeds.entries[i];			
			var snippetttext = entry.contentSnippet;
			//snippetttext = snippetttext.substring(0,90);
			
			var spacetext ="";
			var newsnippetttext = snippetttext.replace("...", " ");
			newsnippetttext = newsnippetttext.replace("(none)", " ");


			//Unordered List
			var html = '<li>';
			//trace( $item.attr("link") );
			
			html += '<div class="rssheader"><h3><a href="'+ entry.link +'" target="_blank">' + entry.title + '</a></h3> ' +
			
		  	'<p class="date">' + entry.publishedDate + '</p></div>' +
			
			'<p>' + newsnippetttext + '<a href="'+ entry.link +'" target="_blank">[...]</a>' + '</p>' + '</li>';
			
			// '<p>' + $item.attr("c:date") + '</p>' +
			
			
			$('#BiofuelsFeed').append(html);
	  
	  }
	}, 10);
	
	
	
	
}); // end of ready() function
