var interval = 10000;
var animationSpeed = 500;

$(
	function()
	{
		var numNews = $("#left_news_container").children().length;
		if (numNews > 1) 
		{
			$("#left_news_container").height($($("#left_news_container").children()[0]).outerHeight(true));
			var intervalFunc = setInterval(animateNews, interval);
		}
		
		function animateNews()
		{
			var children = $("#left_news_container").children();
			$(children[0]).animate(
				{
					opacity: 0
				},
				animationSpeed,
				"linear",
				function()
				{
					$(children[0]).css("display", "none");
					$(children[1]).css("display", "block");
					$(children[1]).css("opacity", "0");
					$(children[1]).animate(
						{
							opacity: 1
						},
						animationSpeed,
						"linear",
						function()
						{
							$("#left_news_container").append($(children[0]));
						}
					);
					var containerHeight = $(children[1]).outerHeight(true);
					$("#left_news_container").animate(
						{
							height: containerHeight
						},
						animationSpeed,
						"easeInOutCubic",
						function()
						{
						}
					);
				}
			);
		}
		
	}
);
