
var interval,index;
$(document).ready(function() {
	var acc = $('#bloc_news').accordion({	
		header : 'div.header',
		event: false,
		change: function(event, ui){ 
			$("#whatsNew").css("background-position","0px "+(index*-301)+"px");
		}
 
	}); 

	
	function iniInterval(){	
		interval = setInterval(function(){	
			
			$('#bloc_news').accordion("activate", index+1);
			index++;
			if(index >4) index = -1;
		}, 5000);
	}
		
	$("div.header", acc).each(function(pos) {
		$(this).click(function() {
			clearInterval(interval);
			index = pos;
			$('#bloc_news').accordion("activate", index);
			iniInterval();
		});
	});
	index = 0;
	iniInterval();
});

