﻿//平滑滚动到顶部
toTop = {
	init:function(){
		document.getElementById("toTop").onclick=function(e){
			toTop.set();
			return false;
		}		
	},
	waitTimer:null,
	set:function(){
		var d_st=document.documentElement.scrollTop;
		if(window.navigator.userAgent.indexOf("MSIE")>=1){
			for (var i=d_st; i>10; i-=Math.floor(i/6)){
			window.scrollTo(0,i);
			}
			window.scrollTo(0,10);
		}
		else{
		window.scrollTo(0,Math.floor(d_st / 2));
		
		 if(d_st>10){
				 waitTimer=setTimeout("toTop.set()",40);
		  }
			else{
				  clearTimeout(waitTimer);
			}
		}
	}
}
window.onload = function(){toTop.init();}


lastScrollY=0;
function heartBeat(){ 
var diffY;
if (document.documentElement && document.documentElement.scrollTop)
    diffY = document.documentElement.scrollTop;
else if (document.body)
    diffY = document.body.scrollTop
else
    {/*Netscape stuff*/}

percent=.1*(diffY-lastScrollY); 
if(percent>0)percent=Math.ceil(percent); 
else percent=Math.floor(percent); 
document.getElementById("full").style.top=parseInt(document.getElementById("full").style.top)+percent+"px";

lastScrollY=lastScrollY+percent; 
}

document.write("<div id=\"full\" style='right:40px;top:180px;position:absolute;z-index:1000;'>");
/*上面里面的top:180px表示滚动距离上面的初始高度，可以改动180这个值的大小来控制浮动QQ距上面的宽度，或者是自己写样式进去*/
document.write("<div class=\"qq_top\"><a id='toTop' href='#top'> </a></div>");
document.write("<ul><li><img onclick=\"javascript:window.open('tencent://message/?uin=44996460&amp;websiteName=www.89ds.com','_self');\" src='/images/qq1.gif' /></li></ul>");
document.write("<ul><li><img onclick=\"javascript:window.open('tencent://message/?uin=55471775&amp;websiteName=www.89ds.com','_self');\" src='/images/qq2.gif' /></li></ul>");
/*这一段表示的是 文字 和QQ ，如果你要添加N个QQ，就把上面的代码复制N次. 另外，上面的两个123456表示一个QQ号码，要改动QQ号码的话，两个数字都要改动*/
document.write("<div class=\"qq_bottom\"></div></div>");
window.setInterval("heartBeat()",1);
/*如果QQ在线的话，它会自动的变换成亮颜色。如果不在线它会自动变成灰色。这个可以不用控制它。
    所有的样式都在第一个“document.write”里面，可以在里面更改所有的样式。
*/
