jQuery(function($) {
	$('.highlights ul.highlight-items').jcarousel({
		scroll: 1,
		visible: 3,
		buttonNextHTML: '<div class="next"><a href="#">Next</a></div>',
		buttonPrevHTML: '<div class="prev"><a href="#">Previous</a></div>',
		initCallback: function() {
			// Png fix for ie6 for higlight items image
			if ($.browser.msie && $.browser.version == 6) {
				if (!(typeof DD_belatedPNG === 'undefined')) {
					DD_belatedPNG.fix('.highlights .thumbnail img');
				}
			}
		},
		itemLastInCallback: {
			onBeforeAnimation: function(carousel, item, index, state) {
				if (state == 'next' || state == 'init') {
					$(item).addClass('no-bg');
				}
			},
			onAfterAnimation: function(carousel, item, index, state) {
				if (state == 'prev' || state == 'init') {
					$(item).addClass('no-bg');
				}
			}
		},
		itemLastOutCallback: {
			onBeforeAnimation: function(carousel, item, index, state) {
				if (state == 'next' || state == 'init') {
					$(item).removeClass('no-bg');
				}
			},
			onAfterAnimation: function(carousel, item, index, state) {
				if (state == 'prev' || state == 'init') {
					$(item).removeClass('no-bg');
				}
			}
		}
	});
	
	$('ul.highlight-items .content').each(function() {
		var content = $(this);
		var title = content.find('h2').text();
		var cta = content.find('span.more a').text();
		var links = content.find('a').click(function() {
			pageTracker._trackEvent('Homepage Banners Carousel', cta, title);
			return true;
		});
	});
});

