﻿//平滑滚动到顶部
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 url(images/middle.gif) repeat-y center bottom;width:110px;overflow:hidden;text-align:center;font-size:12px;color:#00f;}#full .qq_top{background:url(images/qq_top.gif) no-repeat center top;height:35px;}.qq_top a#toTop{display:block;outline:none;blr:expression(this.onFocus=this.blur());}#full .qq_bottom{width:110px;height:49px;background:url(images/qq_bottom.gif) no-repeat center bottom;}#full ul{margin:0;padding:0;list-style:none}#full li{text-aglin:left;}#full span{display:block;height:20px;line-height:20px; color:#000;}#full img{CURSOR:pointer;border:0;width:77px;height:23px;padding-right:5px;}</style>");
document.write("<div id=\"full\" style='right:10px;top:80px;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><span>客服(1)</span><img onclick=\"javascript:window.open('tencent://message/?uin=191550716&amp;websiteName=www.qq.com','_self');\" src='http://wpa.qq.com/pa?p=1:191550716:1' /></li></ul>");
document.write("<ul><li><span>客服(2)</span><img onclick=\"javascript:window.open('tencent://message/?uin=77341420&amp;websiteName=www.qq.com','_self');\" src='http://wpa.qq.com/pa?p=1:77341420:1' /></li></ul>");

/*这一段表示的是 文字 和QQ ，如果你要添加N个QQ，就把上面的代码复制N次. 另外，上面的两个123456表示一个QQ号码，要改动QQ号码的话，两个数字都要改动*/
document.write("<div class=\"qq_bottom\"></div></div>");
window.setInterval("heartBeat()",1);
/*如果QQ在线的话，它会自动的变换成亮颜色。如果不在线它会自动变成灰色。这个可以不用控制它。
    所有的样式都在第一个“document.write”里面，可以在里面更改所有的样式。
*/
