 var num_articles;
 var interval;
 var previousArticles = 0;
 var currentArticles = 0;

 $(document).ready(function(){
   num_articles = $("div.articlestext").size();
   $("div.articlestext:eq("+currentArticles+")").css('top','5px');

   interval = setInterval(articlestext_rotate,5000); 
   $('#articles').hover(function() {
     clearInterval(interval);
   }, function() {
     interval = setInterval(articlestext_rotate,5000); 
     articlestext_rotate();
   });
 });

 function articlestext_rotate() {
   currentArticles = (previousArticles + 1) % num_articles;
   $("div.articlestext:eq(" + previousArticles + ")").animate({top: -205},"slow", function() {
     $(this).css('top','210px');
   });
   $("div.articlestext:eq(" + currentArticles + ")").show().animate({top: 5},"slow");
   previousArticles = currentArticles;
 }
