$(document).ready(function() {

	
	/*elimino l'ultimo margine del 4rto prodotto*/
	$('.pannello a:nth-child(4n)').css('marginRight','0px');
	
	/*elimino il testo alternative*/
	$('.pannello img').attr('alt','');
	
	/*creo rollover*/
	$('.pannello a').hover(function(){
			$(this).find('img').animate({opacity:0.3},500);
		},function(){
			$(this).find('img').animate({opacity:1},500);
		});
	
	/*nuovo il sotto menù*/
	$(window).scroll(function() {
		if($(window).height() > 600){
    		var $moveTo = $(this).scrollTop() + 250;
    		$('#subnav').css('top', $moveTo + "px");
    	}
	});

	/*footer position*/
	var $amount = $(document).height() - 300;
	$('#foot').css('marginTop',$amount+'px');
	
	/*scrolling*/
	$('a[href*=#]').click(function() {
    
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') 
        && location.hostname == this.hostname) {
        
            var $target = $(this.hash);
            
            $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
            
            if ($target.length) {
            
                var targetOffset = $target.offset().top;
                
                $('html,body').animate({scrollTop: targetOffset}, 1000);
                    
                return false;
                
            }
            
        }
        
    });
});

