/**
 * @author gioriv
 */

 $(document).ready(function(){
 	
	
	
	

	
	
	
	
	
	
	
	
	
		$("#tab a").click(function(){
			
			
			if ($("#tab").width() == 30) 
			
			
			
			{
			
			
		
	
	$("#tab").stop().animate({width: '390px'}, {queue: false, duration: 1000, easing: 'easeOutBounce'});
					
					$("#tab p").show();
					
		
				
				
			}
			
			
			else
			
			{
				
			$("#tab").stop().animate({width: '30px'}, {
					queue: false,
					duration: 1000,
					easing: 'easeOutBounce'
				})
					
		$("#tab p").hide()
					
			
				
			}
		
		});
		
	
		
		





	
	//Remove outline from links
	$("#menu a").click(function(){
		$(this).blur();
	});
	
	//When mouse rolls over
	$("#menu li").mouseover(function(){
		$(this).stop().animate({height:'90px'},{queue:false, duration:600, easing: 'easeOutBounce'})
	});
	
	//When mouse is removed
	$("#menu li").mouseout(function(){
		$(this).stop().animate({height:'34px'},{queue:false, duration:600, easing: 'easeOutBounce'})
	});
	

$("#payoff0 a").click(function(){
    $("#payoff0").fadeOut("normal", function() {
		$("#telecent0").fadeOut("normal", function() {
		   $("#tele").animate({"left": "-=380px"	}, 1000, function() {
		   	$("#tele, #telecent, #teleleft, #teleright, #teleleftcenter, #telerightcenter").animate({"height": "+=130"	}, 300);
	      	$("#teletop, #teletopcenter, #telebottom, #telebotcenter, #telecent, #tele").animate({"width": "+=300"	}, 300);
			$("#teletopdx, #telebottomdx, #teleright").animate({"left": "+=300"}, 100, function() {
			$("#telecent1").fadeIn(3000) ;
		
	
    $("#piramide1").fadeIn(1000, function() {
		$(".webby").fadeIn(700, function() {
			$(".webbypro").fadeIn(700, function() {
				$(".webby2").fadeIn(1500, function() {
		
	$("#piramide2").fadeIn(2000, function() {
		
			$(".pubbliweb").fadeIn(500, function() {
				$(".pubbliwebpro").fadeIn(1500, function() {
		
		$("#piramide3").fadeIn(2000, function() {
		$(".seo").fadeIn(3000, function() {
			$(".webby, .webbypro, .webby2, .pubbliweb, .pubbliwebpro, .seo, #piramide1, #piramide2, #piramide3").hide(500, function() {	
		$("#telecent1").fadeOut(1000, function() {	
			$("#telecent2a, #telechiudi").fadeIn(1000, function() {	

});
});
});
});
});
});
});
});

});

});
});

});
			
          
	});
		});
	});
    });
});


	//When mouse rolls over
	$(".cloudh1 a").mouseover(function(){
		$(this).removeClass('cloudwrap')
		$(this).addClass('greengear aligncenter')
	});
	
	//When mouse is removed
	$(".cloudh1 a").mouseout(function(){
		$(this).removeClass('greengear')
		$(this).addClass('cloudwrap ')
	});
	
	//When mouse rolls over
	$(".cloudh2 a").mouseover(function(){
		$(this).removeClass('cloudwrap')
		$(this).addClass('arancio aligncenter')
	});
	
	//When mouse is removed
	$(".cloudh2 a").mouseout(function(){
		$(this).removeClass('arancio')
		$(this).addClass('cloudwrap')
	});
	
		//When mouse rolls over
	$(".cloudh3 a").mouseover(function(){
		$(this).removeClass('cloudwrap')
		$(this).addClass('blugear aligncenter')
	});
	
	//When mouse is removed
	$(".cloudh3 a").mouseout(function(){
		$(this).removeClass('blugear')
		$(this).addClass('cloudwrap')
	});





$("a.next").click(function(){
	
    $("#piramide1").fadeIn(2000, function() {
		
	$("#piramide2").fadeIn(2000, function() {
		
		$("#piramide3").fadeIn(2000, function() {
		
});

});
});

});





$("#telecent2a a").click(function(){
    $("#telecent2a").fadeOut("normal", function() {
		$("#telecent2b").fadeIn("normal", function() {
		   
				

        });
    });
});

$("#telecent2b a").click(function(){
    $("#telecent2b").fadeOut("normal", function() {
		$("#telecent3").fadeIn("normal", function() {
		   
				

        });
    });
});


$("#telecent3 a").click(function(){
    $("#telecent3").fadeOut("normal", function() {
		$("#telecent4").fadeIn("normal", function() {
		   
				

        });
    });
});

$("#telecent4 a").click(function(){
	$("#telechiudi").fadeOut("normal", function() {
    $("#telecent4").fadeOut("normal", function() {
			$("#tele, #telecent, #teleleft, #teleright, #teleleftcenter, #telerightcenter").animate({"height": "-=130"	}, 500)
			 $("#teletopdx, #telebottomdx, #teleright").animate({"left": "-=300"}, 500)	
	      	  $("#teletop, #teletopcenter, #telebottom, #telebotcenter, #telecent, #tele").animate({"width": "-=300"	}, 200)
			    
				
		$("#tele").animate({"left": "+=380px"	}, 1000, function() {
		   			 					
			    $("#payoff0").fadeIn("normal")
				
				 $("#telecent0").fadeIn("normal")
		
	});				   
});	
});
        });
		
				
$("#telechiudi a").click(function(){
	 $(".webby, .webbypro, .webby2, .pubbliweb, .pubbliwebpro, .seo, #piramide1, #piramide2, #piramide3, #telecent1, #telecent2a, #telecent2b, #telecent3, #telecent4").stop()
	     $(".webby, .webbypro, .webby2, .pubbliweb, .pubbliwebpro, .seo, #piramide1, #piramide2, #piramide3, #telecent1, #telecent2a, #telecent2b, #telecent3, #telecent4").hide()
		 $("#telechiudi").fadeOut("normal", function() {
 			$("#tele, #telecent, #teleleft, #teleright, #teleleftcenter, #telerightcenter").animate({"height": "-=130"	}, 500)
			 $("#teletopdx, #telebottomdx, #teleright").animate({"left": "-=300"}, 500)	
	      	  $("#teletop, #teletopcenter, #telebottom, #telebotcenter, #telecent, #tele").animate({"width": "-=300"	}, 200)
			 
			  $("#telecent1, #telecent2a, #telecent2b, #telecent3, #telecent4").fadeOut().stop()
			    
				
		$("#tele").animate({"left": "+=380px"	}, 1000, function() {
		   			
								 					
			    $("#payoff0").fadeIn("normal")
				
				 $("#telecent0").fadeIn("normal")
				 
		
				 
				 
		
			   
});	
});
        });
		
		
		


	$("#box1").mouseover(function(){
		$("#box1 img").stop().animate({opacity:'1'})
		
	});
	
		$("#box1").mouseout(function(){
		$("#box1 img").stop().animate({opacity:'0.8'})
		
	});
	
		$("#box2").mouseover(function(){
		$("#box2 img").stop().animate({opacity:'1'})
		
	});
	
		$("#box2").mouseout(function(){
		$("#box2 img").stop().animate({opacity:'0.8'})
		
	});
	
		$("#box3").mouseover(function(){
		$("#box3 img").stop().animate({opacity:'1'})
		
	});
	
		$("#box3").mouseout(function(){
		$("#box3 img").stop().animate({opacity:'0.8'})
		
	});
  



	


	




$("#box1").click(function(){
	$("#box0").fadeOut("normal")
	$("#box1").animate({"left": "15px"	}, 800)
	 $("#box2, #box3, #box0, #box0hov, #webmarketing, #immagine, #griglia, #callout ").fadeOut("normal")
       $("#box4, #subtitle1").fadeIn("normal", function() {
           $("#webdesign").fadeIn("slow", function() {
		   	 $("#box1 img").animate({"opacity": "1"	
		   	 
      
    
    }); 
  
  });
        });
    });
	
	$("#box2").click(function(){
		 $("#box2").animate({"left": "15px"	}, 800)
	  $("#box1, #griglia, #box3,#box0hov, #box0, #webdesign, #immagine, #callout").fadeOut("normal")	
	 
	      $("#box4, #subtitle2").fadeIn("normal", function() {
		    $("#webmarketing").fadeIn("normal", function() {
             	$("#box2 img").animate({"opacity": "1"	
		   	 
         }); 
	    
  
	
     });
  
        });
    });
	
   $("#box3").click(function(){
   	$("#box3").animate({"left": "15px"	}, 800)
	  $("#box1, #griglia, #box2, #box0hov, #box0, #webdesign, #webmarketing, #callout").fadeOut("normal")
	  
	      $("#box4, #subtitle3").fadeIn("normal", function() {
		    $("#immagine").fadeIn("normal", function() {
               	$("#box3 img").animate({"opacity": "1"	
		   	 
         });  
     

     });   
  
        });
    });
	
	$("#box4").click(function(){
		
		if($("#box1").is(":visible")) 
				
	 {
	 	
 	 $("#webdesign, #subtitle1").fadeOut("normal", function(){
	$("#box2, #box3, #subtitle0, #callout").fadeIn(1000)
		 $("#box1").animate({"left": "195px"	}, 500)
		     $("#box4").fadeOut("normal")
		         $("#griglia, #box0").fadeIn("normal")
				    
                       $("#box1 img").animate({"opacity": "0.5"})	
		   	  $(".payoff").css({"visibility": "visible"})
        
	   });  
	
}

else if($("#box2").is(":visible"))

{
	
  $("#webmarketing, #subtitle2").fadeOut("normal", function(){
  	$("#box1, #box3, #subtitle0, #callout").fadeIn(1000)
		 $("#box2").animate({"left": "380px"	}, 1000)
		     $("#box4").fadeOut("normal")
			
		        $("#griglia, #box0").fadeIn("normal")
				 
                       $("#box2 img").animate({"opacity": "0.5"})	
	 $(".payoff").css({"visibility": "visible"})
	  }); 
}

	
   
   else if($("#box3").is(":visible"))
   
   
   {
   	
	    $("#immagine, #subtitle3").fadeOut("normal", function(){
   $("#box1, #box2, #subtitle0, #callout").fadeIn(1000)
		 $("#box3").animate({"left": "570px"	}, 1500)
		 	   $("#box4").fadeOut("normal")
			   	$("#griglia, #box0").fadeIn("normal")										
            
      $("#box3 img").animate({"opacity": "0.5"})	
	 $(".payoff").css({"visibility": "visible"})
	}); 
	
   }
   
    else if($("#box3, #box2, #box1").is(":hidden"))
   
   
   {
   	
   $("#box1, #box3, #box2, #subtitle0, #callout").fadeIn(500)
		 $("#box3").animate({"left": "550px"	}, 500)
		 $("#box2").animate({"left": "350px"	}, 500)
		 $("#box1").animate({"left": "150px"	}, 500)
		 	   $("#box4").fadeOut("normal")
			   $("#immagine, #webdesign, #webmarketing, #subtitle1, #subtitle2, #subtitle3").hide(100)
		          
					 	$("#griglia, #box0").fadeIn("normal")										
               $("#box1 img, #box2 img, #box3 img").animate({"opacity": "0.5"})	
      
	
	
	
   }
   
   
   
   
   });
    

	


});






                                 
		

	
	

 
 

