$(document).ready(function () {	
	$("ul.sf-menu").supersubs({ 
        minWidth:    9,   // minimum width of sub-menus in em units 
        maxWidth:    27,   // maximum width of sub-menus in em units 
        extraWidth:  1     // extra width can ensure lines don't sometimes turn over 
                           // due to slight rounding differences and font-family 
        }).superfish();  // call supersubs first, then superfish, so that subs are 
                         // not display:none when measuring. Call before initialising 
                         // containing tabs for same reason.
                         
        if($('#home-slides').length>0)
            setInterval( function() {
                var $active = $('#home-slides IMG.active');

                if ( $active.length == 0 ) $active = $('#home-slides IMG:last');

                var $next =  $active.next().length ? $active.next()
                    : $('#home-slides IMG:first');

                $active.addClass('last-active');

                $next.css({opacity: 0.0})
                    .addClass('active')
                    .animate({opacity: 1.0}, 1000, function() {
                        $(this).addClass('box-shadow shadow-box');
                        $active.removeClass('active last-active box-shadow shadow-box');
                    });
            }, 5000 );
            
        if($('#prodotti-slides').length>0)
            setInterval( function() {
                var $active = $('#prodotti-slides IMG.active');

                if ( $active.length == 0 ) $active = $('#prodotti-slides IMG:last');

                var $next =  $active.next().length ? $active.next()
                    : $('#prodotti-slides IMG:first');

                $active.addClass('last-active');

                $next.css({opacity: 0.0})
                    .addClass('active')
                    .animate({opacity: 1.0}, 1000, function() {
                        $active.removeClass('active last-active');
                    });
            }, 5000 );
        
        // Attivazione click sui bottoni barra laterale
        $('#cat-bar').children().each(function(){
            var url = $(this).find('a').attr('href');
            //$(this).find('a').hover(function(){$(this).css('color','#CC222D')}, function(){$(this).css('color','#FFF')});
            $(this).click(function(){
                window.location.href= url;
            });
        });
});	 


