// JavaScript Document

//####### Evita CONFLITTO jQUERY vs LightBox
jQuery.noConflict();
//####################################

 jQuery(document).ready(function(){
								 
	stato = 0;
	
   // ANIMAZIONE BARRA
   
   	jQuery("img").filter(".t0").hover(
		function(){ jQuery(this).attr("src", "img/b0_over.png");}, function(){ 
			if (0 != stato){ jQuery(this).stop().attr("src", "img/b0.png"); } else {  jQuery(this).stop().attr("src", "img/b0_over.png"); };
		} 
	);
	
	jQuery("img").filter(".t1").hover(
		function(){ jQuery(this).attr("src", "img/b1_over.png");}, function(){ 
			if (1 != stato){ jQuery(this).stop().attr("src", "img/b1.png"); } else {  jQuery(this).stop().attr("src", "img/b1_over.png"); };
		} 
	);
	
	jQuery("img").filter(".t2").hover(
		function(){ jQuery(this).attr("src", "img/b2_over.png");}, function(){ 
			if (2 != stato){ jQuery(this).stop().attr("src", "img/b2.png"); } else {  jQuery(this).stop().attr("src", "img/b2_over.png"); };
		} 
	);
	
	jQuery("img").filter(".t3").hover(
		function(){ jQuery(this).attr("src", "img/b3_over.png");}, function(){ 
			if (3 != stato){ jQuery(this).stop().attr("src", "img/b3.png"); } else {  jQuery(this).stop().attr("src", "img/b3_over.png"); };
		} 
	);
	
	jQuery("img").filter(".t4").hover(
		function(){ jQuery(this).attr("src", "img/b4_over.png");}, function(){ 
			if (4 != stato){ jQuery(this).stop().attr("src", "img/b4.png"); } else {  jQuery(this).stop().attr("src", "img/b4_over.png"); };
		} 
	);
	
	jQuery("img").filter(".t5").hover(
		function(){ jQuery(this).attr("src", "img/b5_over.png");}, function(){ 
			if (5 != stato){ jQuery(this).stop().attr("src", "img/b5.png"); } else {  jQuery(this).stop().attr("src", "img/b5_over.png"); };
		} 
	);
	
	//########################	
	function CambiaPulsante(n){
		
		jQuery('#P0 img').attr("src", "img/b0.png");
		jQuery('#P1 img').attr("src", "img/b1.png");
		jQuery('#P2 img').attr("src", "img/b2.png");
		jQuery('#P3 img').attr("src", "img/b3.png");
		jQuery('#P4 img').attr("src", "img/b4.png");
		jQuery('#P5 img').attr("src", "img/b5.png");
		
		switch(n){
			case 0:
				jQuery('#P0 .t0').attr("src", "img/b0_over.png"); break;
			
			case 1:
				jQuery('#P1 .t1').attr("src", "img/b1_over.png"); break;
			
			case 2:
				jQuery('#P2 img').attr("src", "img/b2_over.png"); break;
			
			case 3:
				jQuery('#P3 img').attr("src", "img/b3_over.png"); break;
					
			case 4:
				jQuery('#P4 img').attr("src", "img/b4_over.png"); break;
		
			case 5:
				jQuery('#P5 img').attr("src", "img/b5_over.png"); break;
			
			}
	};
	
	//###############################
	function CambiaSezione(n){
		
		//SPOSTA LOGO HOME
		
		
		stato = n;
		
		CambiaPulsante(n);
		
		jQuery("#c0").hide();
		jQuery("#c1").hide();
		jQuery("#c2").hide();
		jQuery("#c3").hide();
		jQuery("#c4").hide();
		jQuery("#c5").hide();
		
		jQuery("#c" + n).fadeIn();
	
	};

	jQuery("#P0").click(function(){
		CambiaSezione(0);
	});
	
	jQuery("#P1").click(function(){
		CambiaSezione(1);
	});
	
	jQuery("#P2").click(function(){
		CambiaSezione(2);
	});
	
	jQuery("#P3").click(function(){
		CambiaSezione(3);
	});
	
	jQuery("#P4").click(function(){
		CambiaSezione(4);
	});
	
	jQuery("#P5").click(function(){
		CambiaSezione(5);
	});
	
	//########################
	//NIENTE SOTTO QUESTA RIGA
});
