$(document).ready(function(){
	// hide all news except the first one
    var newsItems = $("#newsContainer .newsItem:gt(0)");
    $("#newsContainer .newsItem:eq(0)").addClass("active");
    newsItems.hide();
    // start cycling the news
    setInterval("fadeItems()", 8000);
});
function fadeItems() {
    var currentItem = $("#newsContainer .newsItem.active");
    var nextItem;
    currentItem.fadeOut("slow", function() {
        if ($(this).nextAll().length == 0) {
			nextItem = $(this).siblings(":first");
        } else {
            nextItem = $(this).nextAll(":first");
        }
		nextItem.fadeIn("slow");
		nextItem.addClass("active");
		currentItem.removeClass("active");
    });
}
