
var headline_count;
var headline_interval;
var old_headline = 0;
var current_headline=0;
var headlines = new Array(); // an array of jQuery objects

$(document).ready(function(){

	headline_count = $(".scrollup").size();
	if (headline_count>0){	
		for (var i = 0; i < headline_count; i++) {
			headlines[i] = $("div.scrollup:eq("+i+")");
		}
		
		headlines[current_headline].top='5px';
		
		headline_interval = setInterval(headline_rotate,6000);
		headline_rotate();
		$('#scrollup').hover(function() {
			clearInterval(headline_interval);
		}, function() {
				headline_interval = setInterval(headline_rotate,6000);
		});
	}
	
	$("#contenu a[src^='http']").attr("target","_blank");
	$("#divNotes a[src^='http']").attr("target","_blank");
});

function headline_rotate() {
  current_headline = (old_headline + 1) % headline_count;
  headlines[old_headline].animate({top: -205},"slow", function() {
    $(this).attr("top",'210px');
    });
  headlines[current_headline].show().animate({top: 5},2000);
  old_headline = current_headline;
}
