if (typeof primeTalents == 'undefined') {
	var primeTalents = {};
}

primeTalents.person = {
	tabs: function() {
		$('.tabs').each(function() {
			$('a[href=#' + this.id + ']').click(function(e) {
				e.preventDefault();
				e.stopPropagation();
				
				$('.tabs').hide();
				$($(this).attr('href')).show();
				
				return false;
			});
		});
	}
};
primeTalents.person.carousel = {
	show: function(category) {
		var options = $('ul.casting-list:first').data('carousel');
		$('ul.casting-list:eq(1)').show();
		
		if (category == true) {
			$('ul.casting-list li').show();
		} else {
			$('ul.casting-list li').hide();
			$('ul.casting-list li' + category).show();
		}
		
		var items = $('ul.casting-list:first').find('>*').filter(function() { return this.style.display !== 'none'; });
		var width = 0;
		items.each(function() {
			width += $(this).outerWidth(true);
		});
		options.totalWidth = width;
		
		$('ul.casting-list:first').data('carousel', options);
		
		$('ul.casting-list:first').parent().css('left', 0);
		$('ul.casting-list:first').parent().stop();
		
		if (options.totalWidth > options.width + 10) {
			$('ul.casting-list:first').carousel('move');
		} else {
			$('ul.casting-list:eq(1)').hide();
		}
		
		return false;
	}
};