//外部定义:sQQFloatCode, iQQTop 顶部距离, iQQDisplay 显示位置
//浮动QQ**************
var QQdelta=0.8;
var QQcollection;
var QQcloseB=false;
var iQQRightFloatWidth = 120;//在线QQ的宽度
function QQfloaters() {
this.items	= [];
this.addItem	= function(id,x,y,content)
{
document.write('<DIV id='+id+' style="Z-INDEX: 10; 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!=(document.body.scrollLeft+followObj_x)) {
var dx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*QQdelta;
dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));
followObj.style.left=followObj.offsetLeft+dx;
}

if(followObj.offsetTop!=(document.body.scrollTop+followObj_y)) {
var dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*QQdelta;
dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));
followObj.style.top=followObj.offsetTop+dy;
}
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', 'document.body.clientWidth-'+(iQQRightFloatWidth+2), iQQTop, sQQFloatCode);}
		break;
}
theQQfloaters.QQplay();
//End浮动QQ**************
