function sm_scroller(duration,scrollrate){
	if($(".sm_scroller_item").length == 1){
		$(".sm_scroller_item").parent().append($(".sm_scroller_item").parent().html());
	}
	var headline_count;
	var headline_interval;
	var old_headline = 0;
	var current_headline = 0;
	var topHeight = $('#scroller').height();
	
	headline_count = $(".sm_scroller_item").length;
	$(".sm_scroller_item:eq("+current_headline+")").css('top','0px');
	
	headline_interval = setInterval(headline_rotate,duration);
	$('#sm_scroller').hover(function(){
		$('#sm_scroller_btns').stop().fadeTo(300,1);
		clearInterval(headline_interval);
		headline_interval = null;
	},function(e){
		e = e.relatedTarget.id;
		if(!e.match(/sm_scroller/gi)){
			$('#sm_scroller_btns').stop().fadeTo(300,0);
			if(headline_interval == null){
				headline_interval = setInterval(headline_rotate,duration);
			}
		}
	});
	
	function headline_rotate(){
		current_headline = (old_headline + 1) % headline_count; 
		var ch = current_headline;
		var oh = old_headline;
		var _hh = $('.sm_scroller_item:eq(' + oh + ')').height();
		old_headline = current_headline;
		$(".sm_scroller_item:eq(" + oh + ")").stop().animate({top: '-100%'},scrollrate,function(){
			$(this).css('top','100%');
		});
		$(".sm_scroller_item:eq(" + ch + ")").stop().css('top','100%').show().animate({top: 0},scrollrate);
	}
	function headline_rotate_reverse(){
		current_headline = (old_headline - 1)==-1?headline_count-1:(old_headline - 1);
		var ch = current_headline;
		var oh = old_headline;
		var _hh = $('.sm_scroller_item:eq(' + oh + ')').height();
		old_headline = current_headline;
		$(".sm_scroller_item:eq(" + oh + ")").stop().animate({top: '100%'},scrollrate,function(){
			$(this).css('top','100%');
		});
		$(".sm_scroller_item:eq(" + ch + ")").stop().css('top','-100%').show().animate({top: 0},scrollrate);
	}
	
	$('#sm_scroller_btn_N').click(function(){
		headline_rotate();
	});
	
	$('#sm_scroller_btn_S').click(function(){
		headline_rotate_reverse();
	});
}
