$(document).ready(function() {
	// On masque tt les photos sauf la premiere 
	$('#image-middle').children('a').each(function() {
		$(this).hide();
	});
	
	$('#image-middle').children('a:first').show();
	//---\
	
	
	$("a.imgToFancy").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 10, 'overlayOpacity' : 0.5});
	
	$("#image-mini a").click(function(){
		
		$('#image-middle a').hide(100);
		
		hrefTarget = $(this).attr('href');

		
		$("#"+$(this).attr('id')).parents("a").show(602);
//		alert($(this).attr('id'));
//		alert($("#"+$(this).attr('id')).length);

		/*alt = '';
		
		if($(this).find('img').attr('alt')) {
			alt = $(this).find('img').attr('alt');
		}
		
		if(alt == '') {
			$("img[src='"+hrefTarget+"']").parents("a").show(602);
		} else {
			$("img[alt='"+alt+"']").parents("a").show(602);
		}*/
		
		title = '';
		
		if($(this).find('img').attr('title')) {
			title = $(this).find('img').attr('title');
		}
		
		if(title == '') {
			$("img[src='"+hrefTarget+"']").parents("a").show(602);
		} else {
			$("img[alt='"+title+"']").parents("a").show(602);
		}
		
		$(this).siblings('a').find('img').removeClass('border-highlight');
		$(this).find('img').addClass('border-highlight');
		
		// On renvoie false pour bloquer le lien html
		return false;
	});
	
	// On test la hauteur du commentaire
	if($('#content-coment').height() > 300) {
		$('#content-coment').height(300);
		$('#content-coment').css('overflow','auto');
	}
});