function newsScroll() {
	var _hold = $('#main .news .row');
	_hold.each(function(){
		var _this = $(this);
		var _d = 900;
		var _t= null;
		var _autoswich = 7000;
		var _list = _this.children();
		var _pause = false;
		var _step = _this.outerWidth(true);
		_this.css({positoin: 'relative'});
		var _cur = _a = 0;
		_list.hide().css({
			position: 'absolute',
			left:0,
			top:0
		}).eq(_a).show();

		_this.mouseenter(function(){
			_pause = true;
			if(_t) clearTimeout(_t);
		}).mouseleave(function(){
			_pause = false;
			autorotate();
		});
		autorotate();
		function autorotate(){
			if(_autoswich && !_pause){
				_t = setTimeout(function(){
					_a =_cur;
					if(_a < _list.length-1) _cur++;
					else _cur=0;
					changeEl(_cur);
				},_autoswich);
			};
		};

		function changeEl(next){
			if(_t) clearTimeout(_t);
			if(_a == next) return false;
			_list.eq(_a).animate({left: -_step},_d/2,function(){
				_list.eq(next).css({display: 'block', left: _step}).animate({left: 0}, _d/2, function(){
					autorotate();
				});
			});
		};
	});
}


$(document).ready(function(){
	newsScroll();
});
