$(document).ready(function(){ 
        /*
        $("body > *").hide();
        $(document).mousemove(function(){ 
            $("body > *").fadeIn(1000); 
        }); 	
        */
        
        $("#logo").hide();
        $(document).mousemove(function(){ 
            $("#logo").fadeIn(1000); 
        }); 
        
        $("#logo").delay(1000).fadeIn(1000); 

      $("ul.lista_home").animate({opacity: "0.0"}, 600)
        .animate({opacity: "1"},  1100);
 
        
      $(".menuhome li").append('<img class="shadow" src="immagini/stile/bottone_shadow.jpg" width="160px" height="41px" alt="" />');
	  
       var testo_desc = $("#logo_menu");
	
		$(".menuhome li").hover(function() {
			var e = this;
		    $(e).find("a").stop().animate({ marginTop: "-16px" }, 250, function() {
		    	$(e).find("a").animate({ marginTop: "-10px" }, 250);
		    });
		    $(e).find("img.shadow").stop().animate({ width: "80%", height: "30px", marginLeft: "15px", opacity: 0.25 }, 250);
            
            var titolo = $(e).find("a").attr("rel");
            $(testo_desc).find("span").text(titolo)
      
 
            $(testo_desc).stop().fadeTo(600,0.8);
		},function(){
			var e = this;
		    $(e).find("a").stop().animate({ marginTop: "4px" }, 250, function() {
		    	$(e).find("a").animate({ marginTop: "0px" }, 250);
		    });
		    $(e).find("img.shadow").stop().animate({ width: "100%", height: "41px", marginLeft: "0px", opacity: 1 }, 250);
            
            $(testo_desc).stop().fadeTo(300,0.0);
		}); 
        

      $("#prodotti_pulsante li").append('<img class="shadow" src="immagini/stile/bottone_shadow.jpg" alt="" />');
	
	
		$("#prodotti_pulsante li").hover(function() {
			var e = this;
		    $(e).find("a").stop().animate({ marginTop: "-16px" }, 250, function() {
		    	$(e).find("a").animate({ marginTop: "-10px" }, 250);
		    });
		    $(e).find("img.shadow").stop().animate({ width: "80%", height: "20px", marginLeft: "15px", opacity: 0.25 }, 250);
		},function(){
			var e = this;
		    $(e).find("a").stop().animate({ marginTop: "4px" }, 250, function() {
		    	$(e).find("a").animate({ marginTop: "0px" }, 250);
		    });
		    $(e).find("img.shadow").stop().animate({ width: "86%", height: "27px", marginLeft: "10", opacity: 1 }, 250);
		}); 
        
        //sliding homepage
        
        var padLeft = '20px';
	    var padRight = '20px';
	
	//Default Padding
	var defpadLeft = $('.lista_home li a').css('paddingLeft');
	var defpadRight = $('.lista_home li a').css('paddingRight');
		
	//Animate the LI on mouse over, mouse out
	$('.lista_home li').click(function () {	
		//Make LI clickable
		window.location = $(this).find('a').attr('href');
		
	}).mouseover(function (){
		
		//mouse over LI and look for A element for transition
		$(this).find('a')
		.animate({ paddingLeft: padLeft, paddingRight: padRight}, { queue:false, duration:100 } )
		.animate({ queue:false, duration:200 });

	}).mouseout(function () {
	
		//mouse oout LI and look for A element and discard the mouse over transition
		$(this).find('a')
		.animate( {paddingLeft: defpadLeft, paddingRight: defpadRight}, { queue:false, duration:100 } )
		.animate({ queue:false, duration:200 });
	});
    
    
    //hover homepage
    
   $("#homepage-07").append('<span class="catalogo_sopra"></span>').each(function () {
	      var $span = $('> span.catalogo_sopra', this).css('opacity', 0);
	      $span.append($(this).html());
          $(this).hover(function () {  
	         $span.stop().fadeTo(900, 1);
	      }, function () {
	         $span.stop().fadeTo(600, 0);
	      });
    });  
    
    $('#lingue a.lingua_nuova').hover(function() {
		$(this).stop().fadeTo(600,1);
		$(this).siblings().children().stop().fadeTo(600,0.3);
	    }, function() {
		$(this).stop().fadeTo(600,0.6);
		$(this).siblings().children().stop().fadeTo(600,1);
	 });   
	
    $("#visualizza_login").click(function(){
		$("#pannello_login").slideToggle("slow");
		//$(this).toggleClass("active"); return false;
	});     
    
    $("#pannello_login").blur(function(){
        $("#pannello_login").slideToggle("slow"); 
    });  

});


