// JavaScript Document

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

 jQuery(document).ready(function(){
								 
	stato = 0;
	
   // ANIMAZIONE BARRA

	
	jQuery("img").filter(".t1").hover(
		function(){ jQuery(this).attr("src", "img/button/bb-over.png");}, function(){ 
			if (1 != stato){ jQuery(this).stop().attr("src", "img/button/bb.png"); } else {  jQuery(this).stop().attr("src", "img/button/bb-over.png");
			};
		} 
	);
	
	jQuery("img").filter(".t2").hover(
		function(){ jQuery(this).attr("src", "img/button/contatti-over.png");}, function(){ 
			if (2 != stato){ jQuery(this).stop().attr("src", "img/button/contatti.png"); } else {  jQuery(this).stop().attr("src", "img/button/contatti-over.png");
			};
		} 
	);
	
	jQuery("img").filter(".t3").hover(
		function(){ jQuery(this).attr("src", "img/button/ercolano-over.png");}, function(){ 
			if (3 != stato){ jQuery(this).stop().attr("src", "img/button/ercolano.png"); } else {  jQuery(this).stop().attr("src", "img/button/ercolano-over.png"); };
		} 
	);
	
	jQuery("img").filter(".t4").hover(
		function(){ jQuery(this).attr("src", "img/button/itinerari-over.png");}, function(){ 
			if (4 != stato){ jQuery(this).stop().attr("src", "img/button/itinerari.png"); } else {  jQuery(this).stop().attr("src", "img/button/itinerari-over.png"); };
		} 
	);
	
	jQuery("img").filter(".t5").hover(
		function(){ jQuery(this).attr("src", "img/button/galleria-over.png");}, function(){ 
			if (5 != stato){ jQuery(this).stop().attr("src", "img/button/galleria.png"); } else {  jQuery(this).stop().attr("src", "img/button/galleria-over.png"); };
		} 
	);
	
	jQuery("img").filter(".t6").hover(
		function(){ jQuery(this).attr("src", "img/button/dove-over.png");}, function(){ 
			if (6 != stato){ jQuery(this).stop().attr("src", "img/button/dove.png"); } else {  jQuery(this).stop().attr("src", "img/button/dove-over.png"); };
		} 
	);
	
	jQuery("img").filter(".t7").hover(
		function(){ jQuery(this).attr("src", "img/button/idea-over.png");}, function(){ 
			if (7 != stato){ jQuery(this).stop().attr("src", "img/button/idea.png"); } else {  jQuery(this).stop().attr("src", "img/button/idea-over.png"); };
		} 
	);
	

	
	//########################	
	function CambiaPulsante(n){
		
		jQuery('#P1 img').attr("src", "img/button/galleria.png");
		jQuery('#P2 img').attr("src", "img/button/wine-cocktail.png");
		jQuery('#P3 img').attr("src", "img/button/bb.png");
		jQuery('#P7 img').attr("src", "img/button/idea.png");
		
		switch(n){
			case 1:
				jQuery('#P1 .t1').attr("src", "img/button/galleria.png"); break;
			
			case 2:
				jQuery('#P2 .t2').attr("src", "img/button/wine-cocktail-over.png"); break;
			
			case 3:
				jQuery('#P3 .t3').attr("src", "img/button/bb-over.png"); break;
			

			
			}
	};
	
	//###############################
	function CambiaSezione(n){
		
		//SPOSTA LOGO HOME
		
		if(stato!=n){
			stato = n;
			
			jQuery("#home").fadeOut();
			jQuery("#giallo").fadeOut();
			jQuery("#nero").fadeOut();
			jQuery("#rosso").fadeOut();
		
		
		
		switch(n){
	
			
			case 1:
				jQuery("#giallo").fadeIn(); break;
			
			case 2:
				jQuery("#nero").fadeIn(); break;
			
			case 3:
				jQuery("#rosso").fadeIn(); break;
			
			}
			
		CambiaPulsante(n);
		
		
	
	};
	};


	
	jQuery("#P1").click(function(){
		CambiaSezione(1);
	});
	
	jQuery("#P2").click(function(){
		CambiaSezione(2);
	});
	
	jQuery("#P3").click(function(){
		CambiaSezione(3);
	});
	
	
	//########################
	//NIENTE SOTTO QUESTA RIGA
});
