// JavaScript Document

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

 jQuery(document).ready(function(){
								 
	stato = 0;
	lingua = "it";
	jQuery("#P-it").css("cursor","default");

   // ANIMAZIONE BARRA
	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"); };
		} 
	);
	

	
	//########################	
	function CambiaPulsante(n){
		
		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");
		
		switch(n){
			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;
			
			}		
	};
	
	//###############################
	function CambiaSezione(n){
		
		//SPOSTA LOGO HOME
		jQuery("#top").animate({"height":"160px"}, 400);
		jQuery("#LOGO").attr("src", "../default/logo-top.png");
		jQuery("#content-top").css({"top":"50px"});
		jQuery("#menu").animate({"top":"180px"}, 400);
		
		jQuery("#len").css("top", "80px");
		//		jQuery("#content-top").css("margin", "0 0 0 -450px");
		
		jQuery("#content-top").animate({"margin":"0 0 0 -450px"},200);
		
		jQuery("#content-top").css("text-align", "left");
		jQuery("#footer").fadeIn();
		
		stato = n;
		
		CambiaPulsante(n);
		
		jQuery("#c0").hide();
		jQuery("#c1").hide();
		jQuery("#c2").hide();
		jQuery("#c3").hide();
		jQuery("#c4").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);
		initialize();
		
	});
	
	jQuery("#P4").click(function(){
		CambiaSezione(4);
	});
	
	
	
	//#################################
	//--CAMBIA LINGUA--//
	/*function CambiaLingua(n){	
		
		switch(n){
			case 1:
				jQuery("#flag-it").css("opacity","1.0");
				jQuery("#P-it").css("cursor","default");
				jQuery("#P-en").css("cursor","pointer");
				jQuery("#flag-en").css("opacity","0.4");
				linqua = "it"; break;
			
			case 2:
				jQuery("#flag-it").css("opacity","0.4");
				jQuery("#P-en").css("cursor","default");
				jQuery("#P-it").css("cursor","pointer");
				jQuery("#flag-en").css("opacity","1.0");
				lingua="en"; break;
			}

	};
	
	jQuery("#P-it").click(function(){
		CambiaLingua(1);
	});
	
	jQuery("#P-en").click(function(){
		CambiaLingua(2);
	});
 
 */
	
	//########################
	//NIENTE SOTTO QUESTA RIGA
});
