// EasCMS 对联条
// 双边或单边均可，目前已右侧为基准位置
// 滚动块样式及关闭按钮在页面中定义
// 2008-11-04

window.onload=function(){ //页面打开后缓冲多长时间执行，单位毫秒
	window.setTimeout(itemRoll,100);
}

function itemRoll(){
	var _top=document.documentElement.scrollTop;
	var obj=document.getElementById("roll_r");
	var _obj=document.getElementById("roll_l");
	var _times;
	if(!obj.style.top){
		obj.style.top=50+_top+"px"; //右侧位置，数字可自己定义,右侧为基准，左侧更据右侧值定位置。
		_obj.style.top=50+_top+"px"; //左侧位置
		_times=500;
	}else{
		var obj_top=parseInt(obj.style.top)-50; //根据右侧位置，确定基准值
		_times=100;
		if(obj_top!=_top){
			var yOffset = Math.ceil(Math.abs(obj_top - _top) / 20);
			if(obj_top>_top){
				yOffset=-yOffset;
			}
			obj.style.top=parseInt(obj.style.top,10)+yOffset+"px";
			_obj.style.top=parseInt(_obj.style.top,10)+yOffset+"px";
			_times=10
		}
	}
	window.setTimeout(itemRoll,_times);
}