$(document).ready(function () {
    $('#rotator').each(function () {
        var $container = $(this);
        // Set up the rotator.
        var currentItem = 0, oldItem = 0;
        var hiddenPosition = $container.height() + 10;
        //$('div.item').eq(currentItem).css('top', 0);	

        $('div.item').eq(currentItem).fadeIn(0);
        var itemCount = $('div.item').length;
        var pause;
        // Perform the rotation.
        var itemRotate = function () {
            currentItem = (oldItem + 1) % itemCount;
            // Fadein / Fadeout
            $('div.item').eq(oldItem).fadeOut(600);
            $('div.item').eq(currentItem).fadeIn(300, function () {
                pause = setTimeout(itemRotate, 12000);
            });

            /*  
            // Scroll
            $('div.headline').eq(oldHeadline).animate(
            {top: -hiddenPosition}, 'slow', function() {
            $(this).css('top', hiddenPosition) ;
            }) ;
            $('div.headline').eq(currentHeadline).animate(
            {top: 0}, 'slow', function() {
            pause = setTimeout(headlineRotate, 5000) ;
            }) ;
            */


            oldItem = currentItem;
        };
        pause = setTimeout(itemRotate, 12000);
    });
});