//use window.newsitems
//use window.currentitem
$(document).ready(function(){
  setTimeout("switchNews(3)", 7500);
  });

function switchNews(toLoad) {
  var mCurrent = $('.news-current')
    .css('z-index', '12')
    .animate({'left':'-350px'}, 1200, function(){
      $(this).html(window.newsitems[toLoad])
    })
    .removeClass('news-current');
  $('.news-inactive')
    .css('z-index', '13')
    .removeClass('news-inactive')
    .addClass('news-current')
    .animate({'left':'3px'}, 1200);
  mCurrent.addClass('news-inactive');
  //shift toLoad to the next element
  toLoad = toLoad + 1;
  if (window.newsitems[toLoad] == undefined) {
    toLoad = 0;
  }
  setTimeout("switchNews("+toLoad+")", 7500);
}
