var aPreloader = new Array();
function fnPreloadImage(sSrcImage) {
	aPreloader[aPreloader.length] = new Image();
	aPreloader[aPreloader.length - 1].src = sSrcImage;
}

var sDemo = 0;
function demo() {
	sDemo = sDemo == 7 ? 1 : sDemo + 1;
	var $demo = $("#demo img#demo" + sDemo), $next = $("#demo img#demo" + (sDemo == 7 ? 1 : sDemo + 1));
	$demo.animate({ opacity: 1 }, 3000, '', function () {
		$demo.css('z-index', 2);
		$next.css('z-index', 1).show();
		$demo.fadeOut(2000, demo);
	} ) ;
}

$(document).ready( function () {
	$("#produit #images img").each(function () {
		if (this.src.indexOf('nopic') == -1) {
			var sSrc = this.src.replace(/-min\./, '.');
			$(this).wrap('<a href="' + sSrc + '" rel="splash|groupe1"></a>');
			fnPreloadImage(sSrc);
		}
	} ) ;
	
	demo();
} ) ;