$(document).ready(function()
{
	var totalHeight = 0;
	var autoMoveInt;
	var $thisLi = $(".newsSL_main .newsSL_links .news_ul li");
	$thisLi.each(function(i) {	
		//alert($(this).outerHeight());													  
		$(this).css({'top':totalHeight});
		totalHeight += $(this).outerHeight();
	});
	//alert('totalHeight = ' + totalHeight);
	
	$thisLi.bind('mouseenter', function() {
		$(this).css({'backgroundColor':'#eeeeee'});							
	});
	$thisLi.bind('mouseleave', function() {
		$(this).css({'backgroundColor':'#ffffff'});							
	});
	
	function newsMoveStep() {
		//alert($(".newsSL_main .newsSL_links .news_ul").position().top);
		totalHeight = 0;
		var currentHeight = 0;
		$thisLi.each(function(i) {
			if ($(this).position().top == 0) {
				currentHeight = $(this).outerHeight();
			} 
			if ($(this).position().top >= 0) {
				totalHeight += $(this).outerHeight();
			}
		});
		//alert('totalHeight2 = ' + totalHeight);
		$thisLi.each(function(i) {
			if ($(this).position().top < 0) {
				$(this).css({'top':(totalHeight-($(this).position().top+$(this).outerHeight()))});
			}
			//var $thisTop = -0;			
			//$(this).animate({top: $thisTop}, 1800, 'easeInOutQuad');
		});
		$thisLi.each(function(i) {
			var $newTopPos = $(this).position().top - currentHeight;		  
			var animTime = currentHeight*20;
			$(this).animate({top: $newTopPos}, animTime, 'easeInOutQuad');
		});
	}
	
	function autoMoveNews() {
		//alert('setAutoInt');
		/*if (renewvalIntId>0) {
			clearInterval(renewvalIntId);
		}*/
		autoMoveInt = setInterval(newsMoveStep, 3000);
	}
	
	autoMoveNews();
	//newsMoveStep();	
});	
