var nr_timer;
var nr_current=0;
var nr_current_position = 0;
var nr_num_stories;
var nr_delay_time = 6000;

function createNewsRoller(){
	
	nr_num_stories = $('.news-panel').children().length;
	first = $('.news-panel').children().eq(0).clone();
	second = $('.news-panel').children().eq(1).clone();
	$('.news-panel').append(first);
	$('.news-panel').append(second);

	nr_timer = setTimeout("nextStory()", nr_delay_time);
}

function nextStory(){
	move = $('.news-panel').children().eq(nr_current++).height();
	new_position = nr_current_position - (move+12);
	$('.news-panel').animate({'margin-top':new_position+'px'}, 'fast', function(){
		if (nr_current == nr_num_stories){
			nr_current = 0;
			nr_current_position = 0;
			$('.news-panel').css('margin-top', '0px');
		}
	});
	nr_current_position = new_position;
	nr_timer = setTimeout("nextStory()", nr_delay_time);	
}


