var FloatAds = {
	pageW : window.innerWidth?window.innerWidth:(document.compatMode.toLowerCase()!="backcompat"?document.documentElement.clientWidth:document.body.offsetWidth),
	pageH : window.innerHeight?window.innerHeight:(document.compatMode.toLowerCase()!="backcompat"?document.documentElement.clientHeight:document.body.offsetHeight),
	xbody : document.compatMode.toLowerCase()!="backcompat"?document.documentElement:document.body,
	"Ads" : new Array(),
	"NewFloatAd" : function(AdText, left, top)
	{
		var ad = document.createElement("div");
		ad.DirV = true;
		ad.DirH = true;
		ad.AutoMove = true;
		ad.innerHTML = AdText;
		ad.Seed = this.Ads.length;
		ad.style.zIndex = 10 + ad.Seed;
		ad.Timer = setInterval("FloatAds.Float(" + ad.Seed + ")", 50);
		this.Ads[ad.Seed] = ad;
		ad.style.position = "absolute";
		ad.onmouseover = function(){this.AutoMove = false;}
		ad.onmouseout = function(){this.AutoMove = true;}
		document.body.appendChild(ad);
		if(left === undefined)ad.style.left = parseInt((this.pageW-ad.offsetWidth)*Math.random()) + "px";
		else ad.style.left = parseInt(left) + "px";
		if(top === undefined)ad.style.top = parseInt((this.pageW-ad.offsetHeight)*Math.random()) + "px";
		else ad.style.top = parseInt(top) + "px";
		return ad;
	},
	"Float" : function(floatId)
	{
		var ad = this.Ads[floatId];
		if(ad.AutoMove)
		{
			var curLeft = parseInt(ad.style.left);
			var curTop = parseInt(ad.style.top);
			if(ad.offsetWidth + curLeft > this.pageW + this.xbody.scrollLeft - 1)
			{
				curLeft = this.xbody.scrollLeft + this.pageW - ad.offsetWidth;
				ad.DirH = false;
			}
			if(ad.offsetHeight + curTop > this.pageH + this.xbody.scrollTop - 1)
			{
				curTop = this.xbody.scrollTop + this.pageH - ad.offsetHeight;
				ad.DirV = false;
			}
			if(curLeft < this.xbody.scrollLeft)
			{
				curLeft = this.xbody.scrollLeft;
				ad.DirH = true;
			}
			if(curTop < this.xbody.scrollTop)
			{
				curTop = this.xbody.scrollTop;
				ad.DirV = true;
			}
			ad.style.left = curLeft + (ad.DirH ? 1 : -1) + "px";
			ad.style.top = curTop + (ad.DirV ? 1 : -1) + "px";
		}
	}
}