jQuery(document).ready(function() {
	jQuery("#thumbs").jcarousel({
		itemVisible: 5,
		itemScroll: 5
	});
});

$(document).ready(function() {
	// Prechargement des photos
	var aPhotos = new Array();
	$('#thumbs a.lienPhoto').each(function(i) {
		var pic = new Image();
		pic.src = this.href;
		aPhotos[i] = pic;
	});
	
	$('#thumbs a.lienPhoto').click(function() {
		if (this.getAttribute('href') && (this.getAttribute('rel') == 'slide')) {
	          var inst = this;
	          $("#slide").fadeOut('slow', function() {	          	
				  // Prechargement de l'image
				  var title = inst.getAttribute('title');
				  var href = inst.getAttribute('href');
				  var noimage = "#img-"+inst.id.split('-')[1];
				  var pic = new Image();
				  pic.onload = function() {
			          $("#centralimg").attr("src", href);
			          $("#centralimg").attr("alt", title);
			          $("#centralimg").attr("title", title);
			 		 
			          $("#legendeimg").html(title);		          		          
			          $("#creditimg").html($(noimage).attr('longdesc'));		         
			          $("#slide").fadeIn("slow");
				  };
				  pic.src = href;         
	          });
	          
	         
			return false;
		}
	});
});