var headline_count;
var headline_interval;
var old_headline = 0;
var current_headline = 0;
  
$(document).ready(function(){
  headline_count = $("div.headline").size();
  headline_interval = setInterval(headline_rotate,10000);
    
  $('#scrollup_wrap').hover(function() {
    clearInterval(headline_interval);
  }, function() {
    headline_interval = setInterval(headline_rotate,10000);
  });
});
  
function headline_rotate(step) {
  if (step) { var step = -1; } else { var step = 1; }
  current_headline = (old_headline + step) % headline_count;
  if (current_headline<0) { current_headline = (headline_count - 1); }
  if ($.browser.msie) {
    $("div.headline:eq(" + old_headline + ")").css('top','5px').animate({top: -245},"slow", function() {
    $(this).css('top','250px');
    });
    $("div.headline:eq(" + current_headline + ")").show().css('top','250px').animate({top: 5},"slow");
  } else {
    $("div.headline:eq("+old_headline+")").fadeOut(400);
    $("div.headline:eq("+current_headline+")").fadeIn(1000);
  }
  old_headline = current_headline;
}
  
function headline_next() {
  headline_rotate();
}
  
function headline_prev() {
  headline_rotate('1');
}