$(function(){
	$("a[rel^='lightbox']").prettyPhoto({
		allowresize: true,
		default_width: 500						
	});
	
	//FadeIn random pictures
	$('#random-pictures').fadeTo(0,0,function(){
		
		//On redimensionne les images qui dépasse
		$('#random-pictures img').each(function(){
			var img = $(this);
			var imgCont = img.parent().height() ; //hauteur Balise parent et conteneur de l'image
			if(img.attr('height') >= imgCont){
				img.attr('height',imgCont ); //à la hauteur de son contenur <a>
				img.removeAttr('width');
			}									
		});
		
		//On remontre tous le bloc
		$(this).fadeTo(2000,1);				
	});
	
	//Lien de couleur dans le menu
	$('#menu > ul > li > a').each(function(){
		var a = $(this) ;
		var text = a.text();
		var pos = text.indexOf('|')
		a.html( text.substr(0, pos)+'<span class="tiret"> | </span><span class="orange">'+text.substr(pos + 1)+'</span>');
	});
	
	//Menu categories de produit sur la page produits.htm
	$('#categorie-products').hide(0,function(){
		$(this).slideDown(300);										 
	});
	
	
	/**
	*	Redimenssione les images si trop grande en hauteur sur la page catégorie de produit
	*/
	$('#products-list .imgcont img').each(function(){
												    
		if($(this).attr('height') > 90){
			$(this).attr('height' , 90);
			$(this).removeAttr('width');
		}											   
	});

});
