function NewsSlider(){
	$(document).ready(function(){
		var totHeight=0;
		var positions = new Array();
		var current_position = 0;
		var timeoutHandle;
		
		$('#news_list_style_slider .slide').each(function(i){
			positions[i]= totHeight;
			totHeight += $(this).outerHeight(true);
		});
		$('#news_list_style_slider').height(totHeight);
		$('#switches li a:first').addClass('selected');
		
		function animate(){
			$('#news_list_style_slider').stop().animate({marginTop:-positions[current_position]+'px'},450);
			$("#switches").find(".selected").removeClass('selected');
			$("#switches li:eq(" + current_position + ")").children("a").addClass('selected');
			if (current_position < positions.length - 1) {
				current_position++;
			}
			else {
				current_position = 0;
			}
		}
		
		function loop_animation() {
			animate();
			timeoutHandle = setTimeout(loop_animation, 5000);
		}
		
		$('#switches li a').click(function(e){
			clearTimeout(timeoutHandle);
			e.preventDefault();
			$('#switches').find('.selected').removeClass('selected');
			$(this).addClass('selected');

			current_position = $(this).parent().prevAll('.menuItem').length;
			
			$('#news_list_style_slider').stop().animate({marginTop:-positions[current_position]+'px'},450);
			setTimeout(loop_animation(), 5000);
		});
		
		loop_animation();
	});
}



