// EasCMS 滑动
// 2008-11-04

window.onload=function(){
	window.setTimeout(itemFloat,300);  //执行缓冲
	window.setTimeout(showFloat,360);
}

function $(obj){return document.getElementById(obj)}
function showFloat(){$("floatdiv").style.display="block";} //显示滑动块
function getPlace(obj){	//获取参考对象绝对位置函数
	if(typeof(obj)!="object"){var obj=$(obj);}
	//this.width=obj.offsetWidth; 
	//this.height=obj.offsetHeight;  
	//this.top=obj.offsetTop;  
	this.left=obj.offsetLeft;  
	while(obj=obj.offsetParent){  
		//this.top+=obj.offsetTop;  
		this.left+=obj.offsetLeft;
	}
}

function itemFloat(){
	var _left=new getPlace("rediv").left;  //获取参考对象左侧位置
	var _top=document.documentElement.scrollTop;
	var obj=$("floatdiv");
	obj.style.left=_left+970+"px";  //滑动对象左侧位置
	var _times;
	if(!obj.style.top){
		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";
			_times=10
		}
	}
	window.setTimeout(itemFloat,_times);
}
