window.addEvent("domready", function() {

    $('blc_top10').setStyle('visibility', 'visible'); 
    
    if(top10NbResults<=nbShowTop)
    {
        $('top10_previous').setStyle('display', 'none');
        $('top10_next').setStyle('display', 'none');
        return;
    }
    else
    {
        
        $('top10_content').setStyle('width', top10NbResults*104*3);
    }
   
	var carousel=new iCarousel("top10_content", {		
		item: {
			klass: "top10_item",
			size: 112
		},
		animation: {
            type: 'scroll',
            transition: Fx.Transitions.Cubic.easeInOut,
			duration: 1000,
			amount: nbShowTop,
            rotate: {
                type: "auto",
                interval: 6000,
                onMouseOver: "stop"
            }
		}
	});

    
    $('top10_previous').addEvents({
    	'mouseleave' : function(){
        	if(carousel.options.animation.rotate.type=="auto"){
        		carousel._play();
        	}
        },
        'mouseenter': function(){
        	if(carousel.options.animation.rotate.type=="auto"){
        		carousel._pause();
        	}
    	},
        'click': function(){
        	carousel._previous();
    	}
    });
    
    $('top10_next').addEvents({
    	'mouseleave' : function(){
        	if(carousel.options.animation.rotate.type=="auto"){
        		carousel._play();
        	}
        },
        'mouseenter': function(){
        	if(carousel.options.animation.rotate.type=="auto"){
        		carousel._pause();
        	}
    	},
        'click': function(){
        	carousel._next();
    	}
    }); 
    
});

