$(document).ready(function() {

	var headline_count;
var headline_interval;
var old_headline = 0;
var current_headline = 0;
var movetimer
 
$(document).ready(function(){
  headline_count = $("li.headline").size();
  $("li.headline:eq("+current_headline+")").css('top', '0px');
  
  setTimeout(
  function(){
  setTimeheadline_interval = setInterval(headline_rotate,6500); 
  },3000)
  $('#scrollup').hover(function() {
	$(this).addClass("scrolluphover")
	clearTimeout(movetimer)
    clearInterval(headline_interval);
  }, function() {
	
	$(this).removeClass("scrolluphover")
	 movetimer=setTimeout(function(){
	 headline_rotate();
	 clearInterval(headline_interval);
	 headline_interval = setInterval(headline_rotate,6500); 
	},400)
  });
});
 
function headline_rotate() {
  current_headline = (old_headline + 1) % headline_count; 
  $("li.headline:eq(" + old_headline + ")")
    .animate({top: -205},"slow", function() {
      $(this).css('top', '210px');
    });
  $("li.headline:eq(" + current_headline + ")")
    .animate({top: 0},"slow");  
  old_headline = current_headline;
} 
	});