      var headline_count;
      var headline_interval;
      var old_headline = 0;
      var current_headline = 0;
      var message_bar_direction = true;
      $(document).ready(function(){
        headline_count = $("div.headline").size();
        $("div.headline:eq("+current_headline+")").css('top', '2px');
        headline_interval = setInterval(headline_rotate,8000);

       

      });
      
      function Change_Message_Bar_Direction(aDirection)
      {
          
          if (!aDirection)
            headline_rotate_forward();
          else
            headline_rotate_back();
          
          message_bar_direction = true;
      }
      
      function headline_rotate() {
          if (message_bar_direction)
            headline_rotate_forward();
          else
            headline_rotate_back()
      }
      
      function headline_rotate_forward() {
        current_headline = (old_headline + 1) % headline_count;
        
        $("div.headline:eq(" + old_headline + ")")
          .animate({top: -25},"slow", function() {
            $(this).css('top', '30px');
          });

        $("div.headline:eq(" + current_headline + ")")
          .animate({top: 2},"slow"); 

        old_headline = current_headline;

      }
      
      function headline_rotate_back() {
          if (current_headline == 0)
          {
            current_headline = headline_count-1;
            old_headline = 0;
          }
          else
          current_headline -= 1;
     
        $("div.headline:eq(" + old_headline + ")")
          .animate({top: -25},"slow", function() {
            $(this).css('top', '30px');
          });

        $("div.headline:eq(" + current_headline + ")")
          .animate({top: 2},"slow"); 
        
        old_headline = current_headline;
        

      }     