$(document).ready(function(){
	$('.thumbs img').each(function(){
		
		var class1 = $(this).attr('class');
		var viewer = $(this).parent().prev();
		var toShow = $(this).parent().prev().find('.view'+class1);

		
		$(this).click(function(){
			viewer.find('img[class!=view'+class1+']').fadeOut('slow',function(){toShow.fadeIn()});
		});
	});
	
	$("#avantapresCaroussel").scrollable({circular:true});
	$("#smallthumbsCaroussel").scrollable({ vertical: true });	
	
	avantApresApi = $("#avantapresCaroussel").data('scrollable');
	smallThumbsApi = $("#smallthumbsCaroussel").data('scrollable');
	
	$('#smallthumbsCaroussel img').each(function(){
		$(this).click(function(){
			id = $(this).attr('id').replace('thu','');
			avantApresApi.seekTo(parseInt(id),100);
		});
	});
});
