/* ** ���井��鐚�nodelink,floatobj,x,y,main,space,locate **1��綽�蕁紫�����井���floatobj鐚�y鐚�locate, **2��絋���篏睡��html膸�����鐚���筝���荀�nodelink **3��絋���篏�臀����阪���鐚���筝���荀�main��space **4��絋���篏�臀���蕁級�≫���筝私����鰹���筝���荀�x */ var floatad = function(obj){ var mainnode = $("." + obj.main)[0]; if(obj.nodelink && (typeof obj.nodelink == "string")){ var newfloatobj = document.createelement("div"); newfloatobj.id = obj.floatobj; newfloatobj.style.position = "absolute"; newfloatobj.style.zindex = 10; newfloatobj.innerhtml = obj.nodelink; document.body.appendchild(newfloatobj); } this.ad = document.getelementbyid(obj.floatobj); this.main = document.getelementbyid(obj.main)||mainnode; this.x = obj.x; this.y = obj.y; this.locate = obj.locate; this.space = obj.space; var that = this; this.play = function(){ setinterval(function(){ that.calculate(); },10); }; } floatad.prototype = { constructor : floatad, calculate : function(){ var obj_x = this.x, obj_y = this.y, main_offsetleft = document.documentelement.scrollleft||document.body.scrollleft, main_offsettop = document.documentelement.scrolltop||document.body.scrolltop; if(this.main){ if(this.locate == "left"){ obj_x = this.main.offsetleft - this.ad.offsetwidth - this.space; }else if(this.locate == "right"){ obj_x = this.main.offsetleft + this.main.offsetwidth + this.space; } if(this.ad.offsetleft != main_offsetleft + obj_x){ var dx = (main_offsetleft + obj_x - this.ad.offsetleft)*0.08; dx = (dx > 0 ? 1 : -1)*math.ceil(math.abs(dx)); this.ad.style.left = this.ad.offsetleft + dx + "px"; } }else{ if(this.locate == "left"){ this.ad.style.left = obj_x + "px"; }else if(this.locate == "right"){ this.ad.style.right = obj_x +"px"; } } if(this.ad.offsettop != main_offsettop + obj_y){ var dy = (main_offsettop + obj_y - this.ad.offsettop)*0.08; dy = (dy > 0 ? 1 : -1)*math.ceil(math.abs(dy)); this.ad.style.top = this.ad.offsettop + dy + "px"; } } }