function get_rss_feed() {
	// from http://visualrinse.com/2008/09/24/how-to-build-a-simple-rss-reader-with-jquery/
	// clear the content in the div for the next feed.
	$('#feed-list').append(getWaitImage());
	// use the JQuery get to grab the URL from the selected item, put the results in to an argument for parsing in the inline function called when the feed retrieval is complete
	$.get('ajax/proxy.php?url=http://feeds.ew.com/entertainmentweekly/latest', function(d) {
		$("#feed-list").empty();
		// find each 'item' in the file and parse it
		$(d).find('item').each(function(index) {
 
			if (index < 7) {
				// name the current found item this for this particular loop run
				var $item = $(this);
				// grab the post title
				var title = $item.find('title').text();
				// console.log(title);
				// grab the post's URL
				var link = $item.find('link').text();
				
				var description = $item.find('description').text();
				 
				// now create a var 'html' to store the markup we're using to output the feed to the browser window
				var html = '<li id="story-'+index+'"><a href="external.php?l=' + link + '" title="' + title + '">' + title + '<\/a>';
				html += '<p class="description">' + description + '...</p><\/li>';
	
	 
				//put that feed content on the screen!
				$('#feed-list').append($(html));
			}
		});
	});
 
};

function nextStory(liNum)
{
	if (liNum == 6)
	{
		$('#story-'+liNum).hide();
		liNum = 0;
		$('#story-'+liNum).show();
		$('.rss-feed .next-link').attr('href', 'javascript:nextStory('+liNum+')');
	}
	else
	{
		$('#story-'+liNum).hide();
		$('#story-'+(liNum+1)).show();
		$('.rss-feed .next-link').attr('href', 'javascript:nextStory('+(liNum+1)+')');
	}
}

$(document).ready(function(){
	get_rss_feed();
});