// Premeo Banner Layer
// Starten: <body onload="AD_LAYER.show();">
// Beenden: AD_LAYER.close();


var AD_LAYER = {

	/* Größe des Div */
	containerSize : {w:364,h:234},
	/* End Position des Div */
	endPosition : {t:250,l:250},
	/* Inhalt des Div (HTML) */
	content : '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="364" height="234" ID="main"><PARAM NAME=Movie VALUE="banner/premeo_layerad.swf"><PARAM NAME=quality VALUE="high"><PARAM NAME=WMode VALUE="Transparent"><param NAME=menu VALUE=false><EMBED SRC="banner/premeo_layerad.swf" WIDTH=364 HEIGHT=234 QUALITY=high WMODE="Transparent" MENU=false type="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></embed></OBJECT>',
	container : null,
	posX : null,
	posY : null,
	moving : null,
	factor : 1,
	speed : 10,

	show : function () {
		this.container=this.__generateContainer();
		this.__moveIn();
	},

	close : function () {
		document.body.removeChild(this.container);
	},

	__generateContainer : function () {
		var o=document.createElement('div');
		with (o.style) {
			position='absolute';
			width=this.containerSize.w+'px';
			height=this.containerSize.h+'px';
			top=-this.containerSize.h+'px';
			left=-this.containerSize.w+'px';
			zIndex='51';
		}
		o.innerHTML=this.content;
		document.body.appendChild(o);
		return o;
	},

	__moveIn : function () {
		var o=this.container;this.posY=parseInt(o.style.top),this.posX=parseInt(o.style.left);var wayY=this.endPosition.t,wayX=this.endPosition.l;
		this.factor=wayY/wayX;this.brake=wayX/2;
		this.moving=window.setInterval(function () {
			var max=parseInt(Math.sqrt(AD_LAYER.endPosition.l))+1;
			AD_LAYER.speed=(AD_LAYER.posX>0)?parseInt(parseInt(max)-parseInt(Math.sqrt(AD_LAYER.posX))):max;
			AD_LAYER.posX+=AD_LAYER.speed;
			AD_LAYER.posY=Math.round(AD_LAYER.posX*AD_LAYER.factor);
			if (AD_LAYER.posX>=AD_LAYER.endPosition.l) {
				AD_LAYER.posX=AD_LAYER.endPosition.l;
				AD_LAYER.posY=AD_LAYER.endPosition.t;
				window.clearInterval(AD_LAYER.moving);
			}
			AD_LAYER.container.style.top=AD_LAYER.posY+'px';
			AD_LAYER.container.style.left=AD_LAYER.posX+'px';
		},1);
	}

}

