	
	/* Cambia la classe al click */	
	
	var Lst1;
	function CngClass1(obj){
	if (Lst1) Lst1.className='';
	obj.className='on';
	Lst1=obj;
	}	
	
	var Lst2;
	function CngClass2(obj){
	if (Lst2) Lst2.className='';
	obj.className='on';
	Lst2=obj;
	}	
	
	var Lst3;
	function CngClass3(obj){
	if (Lst3) Lst3.className='';
	obj.className='on';
	Lst3=obj;
	}	
	
	var Lst4;
	function CngClass4(obj){
	if (Lst4) Lst4.className='';
	obj.className='on';
	Lst4=obj;
	}	
	
	function resetClassLst() {
	Lst1.className='';
	Lst2.className='';
	Lst3.className='';
	Lst4.className='';
	}
	


	$(document).ready(function() {
	
	/* Nascondo il menuCat */
	function resetHide() {
		$("#liv1").css("display", "none");
		$("#liv2").css("display", "none");
		$("#liv3").css("display", "none");
		$("#liv4").css("display", "none");
		$("#liv5").css("display", "none");
		$("#chiudi").css("display", "none");
		$("span.load").css("display", "none");
	}
	
	resetHide();
	
	
	/* Imposto tutti i sottomenu a 0 di larghezza per poi animarli con animate*/
	function resetWidth() {
		$("#liv2").css("width", 0);
		$("#liv3").css("width", 0);
		$("#liv4").css("width", 0);
		$("#liv5").css("width", 0);
	}
	
	resetWidth();

	/* Mostro il menuCat e applico la classe "on" al cat */	
	$("#cat").click(function() {
		$("#cat").toggleClass("on");
		$("#liv1").animate({"height": "toggle", "opacity": "toggle"}, 200);
		$("#chiudi1").css("display","block");	
	});
	
	/* Nascondo il menuCat */	
	
	function chiudi() {
		$("#cat").removeClass("on");
		resetHide();
		resetWidth();
		resetClassLst();
	}

	/*
	$("#box-menu").mouseleave(function() {
	chiudi();
	});
	*/
	
	$('html').click(function() {
	$("#icone li").children("span.tooltip").css("display", "none");
	});
	
	$('html').click(function() {
	hideLabel(); 
	chiudi();
	});
	
	$('#cat').click(function(e) {	e.stopPropagation();	});

	$('#liv1').click(function(e) { e.stopPropagation(); });
	
	$('#liv2').click(function(e) { e.stopPropagation(); });
	
	$('#liv3').click(function(e) { e.stopPropagation(); });
	
	$('#liv4').click(function(e) { e.stopPropagation(); });
	
	$('#liv5').click(function(e) { e.stopPropagation(); });
	
	$('.boxForm label').click(function(e) { e.stopPropagation(); });

	$("#chiudi1").click(function(){ chiudi(); });
	$("#chiudi2").click(function(){ chiudi(); });
	$("#chiudi3").click(function(){ chiudi(); });
	$("#chiudi4").click(function(){ chiudi(); });
	$("#chiudi5").click(function(){ chiudi(); });
	 
	/* Animazione loader */

	$("#box-menu li a").each(function(){
	$(this).click(function(){
	$("span.load").hide();	
	$(this).children("span.load").fadeIn().delay(500).fadeOut();	
	$("#liv2").delay(500).animate({ width: "192px"}, 200 );	
	$("#chiudi1").css("display","none");	
	$("#chiudi2").css("display","block");	
	$("#chiudi3").css("display","none");	
	$("#chiudi4").css("display","none");	
	$("#chiudi5").css("display","none");	
	});
	});	 

	/* Animazione sotto menu */

	
	$("#liv2 li a").each(function(){
	$(this).click(function(){
	$("#liv3").delay(500).animate({ width: "192px"}, 200 );	
	$("#chiudi1").css("display","none");	
	$("#chiudi2").css("display","none");	
	$("#chiudi3").css("display","block");	
	$("#chiudi4").css("display","none");	
	$("#chiudi5").css("display","none");	
	});
	});	 

	$("#liv3 li a").each(function(){
	$(this).click(function(){
	$("#liv4").delay(500).animate({ width: "192px"}, 200 );	
	$("#chiudi1").css("display","none");	
	$("#chiudi2").css("display","none");	
	$("#chiudi3").css("display","none");	
	$("#chiudi4").css("display","block");	
	$("#chiudi5").css("display","none");	
	});
	});
	
	$("#liv4 li a").each(function(){
	$(this).click(function(){
	$("#liv5").delay(500).animate({ width: "192px"}, 200 );	
	$("#chiudi1").css("display","none");	
	$("#chiudi2").css("display","none");	
	$("#chiudi3").css("display","none");	
	$("#chiudi4").css("display","none");	
	$("#chiudi5").css("display","block");	
	});
	});	 
	 
	/* Easing customizzato per i marchi */	
	$.easing.custom = function (x, t, b, c, d) {
		var s = 1.70158; 
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1))+1)*t + s) + 2) + b;
	}
	
	/* Animazione scrollable per i marchi */				
	$("#chained").scrollable({easing: 'custom', speed: 800, circular: true, mousewheel: true}).navigator().autoscroll({
		interval: 4000
	});
		
	
	
	/* Animazione della Barra del Catalogo in home */
	
	
	/*
	$("#catBar li div").each(function(){
	$(this).css("display", "none");
	});	 
	
	$("#catBar li").each(function(){
	$(this).click(function(){
	$(this).children("div").animate({"height": "toggle", "opacity": "toggle"}, 200);		
	$("#catBar li").mouseleave(function() {
	$(this).children("div").css("display", "none");
	});
	});
	});	 
	*/

	/* Animazione dei tooltip nella scheda libro */
	
	$("#icone li span.tooltip").each(function(){
	$(this).css("display", "none");
	});	 
	
	$("#icone li").each(function(){
	$(this).click(function(){
	$(this).children("span.tooltip").animate({"height": "toggle", "opacity": "toggle"}, 200);	
	});
	});
	
	
	
	/* Animazione dei tooltip nel form */

	function hideLabel() {
	$(".boxForm label.infoLabel").each(function(){
	$(this).css("display", "none");
	});
	}	
	
	hideLabel(); 
	
	$(".boxForm label").each(function(){
	$(this).click(function(){	
	hideLabel(); 
	$(this).find("label.infoLabel").fadeIn();	
	});
	});	 
	
	
	
	 

});
