var headline2_count;
var headline2_interval;
var old_headline2 = 0;
var current_headline2 = 0;

$(document).ready(function(){
  headline2_count = $("div.headline2").size();
  $("div.headline2:eq("+current_headline2+")").css('top','1px');
  
  headline2_interval = setInterval(headline2_rotate,7000); //time in milliseconds
  $('#scrollup2').hover(function() {
    clearInterval(headline2_interval);
  }, function() {
    headline2_interval = setInterval(headline2_rotate,7000); //time in milliseconds
    headline2_rotate();
  });
});

function headline2_rotate() {
  current_headline2 = (old_headline2 + 1) % headline2_count; 
  $("div.headline2:eq(" + old_headline2 + ")").animate({top: -219},"slow", function() {
    $(this).css('top','220px');
    });
  $("div.headline2:eq(" + current_headline2 + ")").show().animate({top: 1},"slow");  
  old_headline2 = current_headline2;
}
