///滚动轮显
///id: div的id
///rotatorHeight: 每一次滚动的高度(单位px)
///interval: 轮流显示停留时间(单位 秒)
function RotatorDiv(id, rotatorHeight, interval)
{
	var obj = document.getElementById(id);
	if(!obj) return;
	obj.scrollTop = 0;
	obj.style.overflow = "hidden";
	obj.originalHeight = obj.scrollHeight;//原始高度
	
	obj.currentRotatorHeight = 0;//当前滚动到的高度
	obj.rotatorInterval = interval;
	var oldHtml = obj.innerHTML;
	obj.innerHTML = obj.innerHTML + obj.innerHTML;
	obj.originalHeight = obj.scrollHeight/2;//原始高度
	if(obj.originalHeight < obj.clientHeight)
	{
		obj.innerHTML  = oldHtml;
		return;
	}
	obj.isMouseOn = false;
	obj.onmouseover = function(){this.isMouseOn = true;};
	obj.onmouseout = function(){this.isMouseOn = false;};
	
	window["scroll_interval_"+id] = setInterval(rotatorScroll(id,rotatorHeight,oldHtml),50)
}
function rotatorScroll(id,rotatorHeight,oldHtml)
{
	return function()
	{
		var obj = document.getElementById(id);
		if(!obj) return;
		if(obj.isMouseOn) return;
		var step = parseInt(rotatorHeight/10);
		if(obj.currentRotatorHeight<rotatorHeight && obj.currentRotatorHeight+step>rotatorHeight)
		{
			
			step = rotatorHeight - obj.currentRotatorHeight;
			obj.currentRotatorHeight = rotatorHeight;
		}
		else
		{
			
			obj.currentRotatorHeight = obj.currentRotatorHeight+step;
		}
		if(obj.currentRotatorHeight > rotatorHeight)
		{
			obj.currentRotatorHeight = 0;
			clearInterval(window["scroll_interval_"+id]);
			setTimeout(function(id,rotatorHeight){return function(){window["scroll_interval_"+id] = setInterval(rotatorScroll(id,rotatorHeight),50)}}(id,rotatorHeight),obj.rotatorInterval*1000);
			return;
		}
		var ct = obj.scrollTop;
		ct+=step;
		obj.scrollTop = ct;
		if(obj.scrollTop >= obj.originalHeight)
		{
			obj.scrollTop = 0;
		}
	}
}
