(function ($) {
	$(document).ready(function(){
		var newsXmlSrc = 'news.xml';
		var newsArray = [];
		var position = 0;
		
		$.get(newsXmlSrc, {}, function(xml) {
			$('newsList', xml).each(function(){
				$(this).find('news').each(function(i) {
					newsArray[i] = $(this).text();
				});
			});
			
			$("#news-content").html(newsArray[position]);
			position = 1;
		});
		
		setInterval(function() {
			$("#news-content").html(newsArray[position]);
			if (++position == newsArray.length) {
				position = 0;
			}
		}, 5000);
	});
})(jQuery);
