//左边
var left_img="<DIV id='LeftDIV' style='Z-INDEX: 100; left: 3px; POSITION: absolute; TOP: 201px;'>"+ 
"<iframe style='position:absolute;z-index:-1;width:expression(this.nextSibling.offsetWidth);height:expression(this.nextSibling.offsetHeight-20);top:expression(this.nextSibling.offsetTop+20);left:expression(this.nextSibling.offsetLeft);' frameborder='0'> </iframe><TABLE cellSpacing=0 cellPadding=0 width=89 style='border-left:0px solid #333333;border-top:0px solid #333333;border-right:0px solid #333333;font-size:12px;color:#ffffff'>"+
"<TR ><TD height=20> </TD><TD style='CURSOR: hand' onclick=CloseDiv('LeftDIV')  width=30>"+CloseText+"</TD></TR>"+
"<TR bgcolor=#2E6287><TD height=20 colspan=2>"+Left_AD+"</TD></TR>"+
"</TABLE></DIV>";

//右边
var right_img="<DIV id=RightDIV style='Z-INDEX: 100; right: 1px; POSITION: absolute; TOP: 201px;'>"+
"<iframe style='position:absolute;z-index:-1;width:expression(this.nextSibling.offsetWidth);height:expression(this.nextSibling.offsetHeight-20);top:expression(this.nextSibling.offsetTop+20);left:expression(this.nextSibling.offsetLeft);' frameborder='0'> </iframe><TABLE cellSpacing=0 cellPadding=0 width=89 style='border-left:0px solid #333333;border-top:0px solid #333333;border-right:0px solid #333333;font-size:12px;color:#ffffff'>"+
"<TR ><TD height=20> </TD><TD style='CURSOR: hand;padding-right:4px;' onclick=CloseDiv('RightDIV')  align='right'>"+CloseText+"</TD></TR>"+
"<TR bgcolor=#2E6287><TD height=20 colspan=2>"+
Right_AD+
"</TD></TR>"+
"</TABLE></DIV>";

 var delta=0.05
 var collection;
 function floaters() {
  this.items = [];
  this.addItem = function(id,x,y,content)//id为对应的div的ID,x已没用,y为div初始化时的top值
      {
     //document.write('<DIV id='+id+' style="Z-INDEX: 10; POSITION: absolute; left:'+(typeof(x)=='string'?eval(x):x)+';top:'+(typeof(y)=='string'?eval(y):y)+'">'+content+'</DIV>');
	 document.write (content);
     
     var newItem    = {};
     newItem.object   = document.getElementById(id);
     newItem.x    = x;
     newItem.y    = y;

     this.items[this.items.length]  = newItem;
      }
  this.play = function()
      {
     collection    = this.items
     setInterval('play()',10);
      }
  }
  function play()
  {

   for(var i=0;i<collection.length;i++)
   {
    var followObj  = collection[i].object;
    var followObj_x  = (typeof(collection[i].x)=='string'?eval(collection[i].x):collection[i].x);
    var followObj_y  = (typeof(collection[i].y)=='string'?eval(collection[i].y):collection[i].y);

    /*if(followObj.offsetLeft!=(document.body.scrollLeft+followObj_x)) {
     var dx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*delta;
     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)*delta;
     dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));
     followObj.style.top=followObj.offsetTop+dy;
     }
    followObj.style.display = '';
   }
  } 
  
function CloseDiv(Div)
{
document.getElementById(Div).style.visibility='hidden';
}
  
 var theFloaters  = new floaters();
 theFloaters.addItem('RightDIV','document.body.clientWidth-110',201,''+right_img+'');//加载右对联
 theFloaters.addItem('LeftDIV',0,201,''+left_img+'');//加载左对联
 theFloaters.play();
