JavaScript floating window code in lower right corner
var winwidth = 0;
var winheight = 0;
var offsetbody=0;
function Finddimensions () {
if (window.innerwidth)
Winwidth = window.innerwidth;
else if ((document.body) && (document.body.clientWidth)
Winwidth = Document.body.clientWidth;
if (window.innerheight)
Winheight = Window.innerheight;
else if ((document.body) && (document.body.clientHeight)
Winheight = Document.body.clientHeight;
if (document.documentelement && document.documentElement.clientHeight && Document.documentElement.clientWidth) {
Winheight = Document.documentElement.clientHeight;
Winwidth = Document.documentElement.clientWidth;
}
Offsetbody=math.floor ((document.documentelement.clientwidth-document.body.clientwidth)/2)
}
Finddimensions ();
window.onresize=finddimensions;//when window adjustment is performed. Gets the height of the browser width.
var delta=0.25;
var collection;
var Closeb=false;
function Floaters (winheight) {
This.items = [];
This.additem = function (id,x,y,content) {
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> ');
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 () ', 30);
}
}
function Play () {
if (winwidth<= 950 | | closeb) {
for (var i = 0;i < collection.length;i++) {
Collection[i].object.style.display = ' None ';
}
Return
}
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.documentElement.scrollLeft + followobj_x-offsetbody)) {
var dx = (document.documentElement.scrollLeft + followobj_x-followobj.offsetleft-offsetbody) * DELTA;
DX = (dx > 0 1:-1) * Math.ceil (Math.Abs (DX));
FollowObj.style.left = (followobj.offsetleft + dx) + ' px ';
}
if (Followobj.offsettop!= (Document.documentElement.scrollTop + followobj_y)) {
var dy = (Document.documentElement.scrollTop + followobj_y-followobj.offsettop) * DELTA;
dy = (Dy > 0? 1:-1) * Math.ceil (Math.Abs (dy));
FollowObj.style.top = (followobj.offsettop + dy) + ' px ';
}
FollowObj.style.display = ';
}
}
function Closebanner () {
Closeb = true;
Return
}
var thefloaters = new Floaters (winheight);