$j(function($) {

	
	$('.front-carousel').frontpageCarousel();
	$('.infinite-carousel').infiniteCarousel();
	$('#showcase-tab li').click(function () {
		$('.front-carousel').trigger('goto', this.getAttribute('panagora:count'));
	});

	$('#recent-wrapper .headers li.all').addClass('selected');
	$('#recent-wrapper .headers li a').click(function(e){
		e.preventDefault();
		$(this).closest('ul').find('li').removeClass('selected');
		$(this).parent().addClass('selected');
		$.get(this.href+'?partial=latest&order=Published&limit=12', function(content) {
			$('.last-published').replaceWith(content);
			$('#recent-additions .arrow').remove();
			$('#recent-additions').infiniteCarousel();
		});
	});
});