
(function($){

	"use strict";

	$(document).ready(function(){

		setupNewsHeadline();

	});

	function setupNewsHeadline()
	{
		/* Build news data. */
		var newsItems = $('#news li')
			.map(function(){
				var date = $(this).find('h3').text();
				var url = $(this).find('a').attr('href');
				var text = $(this).find('p').text();
				return '<li><a href="'+ url +'">'+ text +'('+ date +')</a></li>';
			})
			.get()
		;

		/* Set news. */
		$('#headline div.data')
			.append('<div><ul>'+ newsItems.join('') +'</ul></div>')
			.find('li')
				.css('whiteSpace', 'nowrap')
			.end()
			/* Setup circular. */
			.find('div')
				.jCarouselLite({
					btnPrev: '#headline ul > li.prev',
					btnNext: '#headline ul > li.next'
				})
			.end()
		;
	}

})(jQuery);



