//外部定义:sQQFloatCode, iQQTop 顶部距离, iQQDisplay 显示位置
//适用于HTML:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
//浮动QQ**************
var QQdelta=0.8;
var QQcollection;
var QQcloseB=false;
var iQQRightFloatWidth = 110;//在线QQ的宽度
function QQfloaters(){
this.items	= [];
this.addItem	= function(id,x,y,content){
document.write('<DIV id='+id+' style="Z-INDEX: 30; POSITION: absolute;  width:80px; height:60px;left:'+(typeof(x)=='string'?eval(x):x)+';top:'+(typeof(y)=='string'?eval(y):y)+'">'+content+'</DIV>');

var newItem = {};
newItem.object = document.getElementById(id);
newItem.x = x;
newItem.y = y;

this.items[this.items.length] = newItem;
}
this.QQplay	= function(){
QQcollection = this.items
setInterval('QQplay()',30);
 }
}
function QQplay(){
if(screen.width<=800 || QQcloseB){
for(var i=0;i<QQcollection.length;i++){
QQcollection[i].object.style.display = 'none';
}
return;
}
for(var i=0;i<QQcollection.length;i++){
var followObj = QQcollection[i].object;
var followObj_x = (typeof(QQcollection[i].x)=='string'?eval(QQcollection[i].x):QQcollection[i].x);
var followObj_y = (typeof(QQcollection[i].y)=='string'?eval(QQcollection[i].y):QQcollection[i].y);

if(followObj.offsetLeft!=(window.document.documentElement.scrollLeft+followObj_x)){
var dx=(window.document.documentElement.scrollLeft+followObj_x-followObj.offsetLeft)*QQdelta;
dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));

followObj.style.left=followObj.offsetLeft + dx + "px";
}

if(followObj.offsetTop!=(window.document.documentElement.scrollTop+followObj_y)){
var dy=(window.document.documentElement.scrollTop+followObj_y-followObj.offsetTop)*QQdelta;
dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));
followObj.style.top=followObj.offsetTop+dy+"px";//String(curY)"px";
}
followObj.style.display	= '';
 }
}	
function QQcloseBanner(){
QQcloseB=true;
return;
}
var theQQfloaters = new QQfloaters();

switch(iQQDisplay){
	case 1://左边
		if(sQQFloatCode!=''){theQQfloaters.addItem('followQQDiv2', 2, iQQTop, sQQFloatCode);}
		break;
	case 2://右边
		if(sQQFloatCode!=''){theQQfloaters.addItem('followQQDiv1', 'window.document.documentElement.clientWidth-'+(iQQRightFloatWidth+15), iQQTop, sQQFloatCode);}
		break;
}
theQQfloaters.QQplay();

