﻿// JavaScript Document
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("<style type='text/css'>#full{background:#fff no-repeat center bottom;width:120px;overflow:hidden;text-align:center;font-size:12px;font-family:Arial;border-left:2px #2D93D2 solid;border-top:2px #2D93D2 solid;border-bottom:2px #2D93D2 solid;border-right:2px #2D93D2 solid}#full .qq_top{background:url(images/qq_top.gif) no-repeat center top;height:34px;}.qq_top a#toTop{height:34px;display:block;outline:none;blr:expression(this.onFocus=this.blur());}#full .qq_bottom{height:3px;font-size:0}#full ul{margin:0;padding:0;list-style:none}#full li{}#full span{display:block;height:15px;line-height:20px;margin-bottom:6px;}#full img{CURSOR:pointer;border:0;width:77px;height:20px;padding-bottom:10px;}</style>");
document.write("<div id=\"full\" style='right:0px;top:80px;position:absolute;z-index:1000;'>");
/*上面里面的top:180px表示滚动距离上面的初始高度，可以改动180这个值的大小来控制浮动QQ距上面的宽度*/
document.write("<ul><div class=\"qq_top\"><a id='toTop' href='#top'> </a></div>");
document.write("<li><span>Mr Yi</span><img onclick=\"javascript:window.open('tencent://message/?uin=723413712&amp;websiteName=www.qq.com','_self');\" src='http://wpa.qq.com/pa?p=1:723413712:1' alt='qq'/></li>");
document.write("<li><span>Mr Xie</span><img onclick=\"javascript:window.open('tencent://message/?uin=449065680&amp;websiteName=www.qq.com','_self');\" src='http://wpa.qq.com/pa?p=1:449065680:1' alt='qq'/></li>");

/*这一段表示的是 文字 和QQ ，如果你要添加N个QQ，就把上面的代码复制N次. 另外，上面的两个123456表示一个QQ号码，要改动QQ号码的话，两个数字都要改动*/
document.write("<div class=\"qq_bottom\"></div></ul></div>");
window.setInterval("heartBeat()",1);
/*如果QQ在线的话，它会自动的变换成亮颜色。如果不在线它会自动变成灰色。这个可以不用控制它*/

