function NewsChanger(news)
{
	// Offset so the arrow won't be right at the top of news item
	var ARROW_OFFSET = 6; 
	
	// Time (in milliseconds) to wait to switch to the next story automatically
	// default: 10000
	var SWITCH_TIME = 12000;
	
	// Key codes
	var UP_ARROW = 38;
	var DOWN_ARROW = 40;
 
	var _current_story = 0;

	var _news_area_image = jQuery(jQuery(news).find(".image.news_area")[0]);
	var _news_area_flash = jQuery(jQuery(news).find(".flash.news_area")[0]);
	var _news_links = jQuery(news).find("#right_column #news_items a");
	var _news_img =  jQuery(news).find("#news_img")[0];
	var _news_link =  jQuery(news).find("#news_link")[0];
	var _news_param =  _news_area_flash.find("param[name=movie]")[0];
	var _news_embed =  jQuery(news).find("#news_embed")[0];
	var _arrow = jQuery(news).find("#arrow")[0];
		
	(function init()
	{
	//	bind_keys();
		add_onclicks();
		move_arrow(_news_links[0]);
		_auto_change_interval = setInterval(auto_change, SWITCH_TIME);
		if (stories[0].type == 'youtube') {
			clearInterval(_auto_change_interval);
		}
	})();
	
	// Switches to the next story (returns to first story once the last story has been reached)
	function auto_change()
	{
		var next_story = _current_story + 1 < _news_links.length ? _current_story + 1 : 0;
		change_story(next_story);
	}
	
	function bind_keys()
	{
		jQuery(window).keypress(function(e) 
		{ 
			if (e.which == UP_ARROW)
				change_story(_current_story - 1);
			else if (e.which == DOWN_ARROW)
				change_story(_current_story + 1);
		});
	}
	
	// Add an onclick to each news link
	function add_onclicks()
	{
		_news_links.each(function (index, link) 
		{ 
			link.onclick = 
			function () 
			{ 
				change_story(this.id); 
				clearInterval(_auto_change_interval);
				return false; 
			}; 
		});
	}
	
	// Change to the story for the link
	function change_story(story_id)
	{
		if (story_id >= 0 && story_id < _news_links.length)
		{
			swap_media(story_id);
			set_current(story_id);
			_current_story = story_id;
		}
	}
	
	// Set the link as the curent link
	function set_current(story_id)
	{
		_news_links.each(function (index, link) { link.className = ""; });			
		_news_links[story_id].className = "selected";
		move_arrow(_news_links[story_id]);
	}
	
	// Move the arrow to the link
	function move_arrow(link)
	{
		jQuery(_arrow).animate({ "top": link.offsetTop + ARROW_OFFSET + "px" }, 300);
	}

	// Change the image story to the image for the story id
	function swap_media(story_id)
	{
		_news_area_flash.addClass('hide');
		_news_area_image.addClass('hide');
		if(stories[story_id].type == 'youtube') {
			_news_area_flash.removeClass('hide');
			var escapedUrl = $('<div/>').text(stories[story_id].media_url).html();
			_news_area_flash.html("<object width=\"300\" height=\"250\">" +
				"<param name=\"movie\" value=\"" + escapedUrl + "\"></param>" + 
				"<param name=\"wmode\" value=\"transparent\"></param>" +
				"<embed src=\"" + escapedUrl + "\" type=\"application/x-shockwave-flash\"" +
				" wmode=\"transparent\" width=\"300\" height=\"250\">" +	
				"</embed>" +
			"</object>");
			clearInterval(_auto_change_interval);
		} else if (stories[story_id].type == 'flash') {
			// set html of flash area according to story parameters
		} else {
			_news_area_image.removeClass('hide');	
			_news_img.src = stories[story_id].media_url;
			_news_link.href = stories[story_id].href;		
		}
	}
}
