

floatX=10;

floatY=40;

floatX2=10;

floatY2=10;

layerwidth=100;

layerheight=130;

align="left";

valign="center";

delayspeed=3;



NS6=false;



IE4=(document.all);



if (!IE4) {

	NS6=(document.getElementById);

}



NS4=(document.layers);



/**************************************************/



if ((IE4)){

	//alert("internet explorer");	

}



/**************************************************/



function adjust() {

	if ((NS4) || (NS6)) {

		if (lastX==-1 || delayspeed==0){

			lastX=window.pageXOffset + floatX;

			lastY=window.pageYOffset + floatY;

		}

		if (lastX2==-1 || delayspeed==0){

			lastX2=window.pageXOffset + floatX2;

			lastY2=window.pageYOffset + floatY2;		

		}

		else{

			dx=Math.abs(window.pageXOffset+floatX-lastX);

			dy=Math.abs(window.pageYOffset+floatY-lastY);

			

			dx2=Math.abs(window.pageXOffset+floatX2-lastX2);

			dy2=Math.abs(window.pageYOffset+floatY2-lastY2);

			

			d2=Math.sqrt(dx2*dx2+dy2*dy2);

			c2=Math.round(d2/10);

			

			d=Math.sqrt(dx*dx+dy*dy);

			c=Math.round(d/10);

			

			if (window.pageXOffset+floatX>lastX) {lastX=lastX+delayspeed+c;}

			if (window.pageXOffset+floatX<lastX) {lastX=lastX-delayspeed-c;}

			if (window.pageYOffset+floatY>lastY) {lastY=lastY+delayspeed+c;}

			if (window.pageYOffset+floatY<lastY) {lastY=lastY-delayspeed-c;}

			

			if (window.pageXOffset+floatX2>lastX2) {lastX2=lastX2+delayspeed+c2;}

			if (window.pageXOffset+floatX2<lastX2) {lastX2=lastX2-delayspeed-c2;}

			if (window.pageYOffset+floatY2>lastY2) {lastY2=lastY2+delayspeed+c2;}

			if (window.pageYOffset+floatY2<lastY2) {lastY2=lastY2-delayspeed-c2;}

		}



		if (NS4){

			document.layers['tools'].pageX = lastX;

			document.layers['tools'].pageY = lastY;

			document.layers['tools2'].pageX = lastX2;

			document.layers['tools2'].pageY = lastY2;

		}

		if (NS6){

			document.getElementById('tools').style.left=lastX;

			document.getElementById('tools').style.top=lastY;

		}

	}

	else if (IE4){

		if (lastX==-1 || delayspeed==0){

			lastX=document.body.scrollLeft + floatX;

			lastY=document.body.scrollTop + floatY;

		}

		else{

			dx=Math.abs(document.body.scrollLeft+floatX-lastX);

			dy=Math.abs(document.body.scrollTop+floatY-lastY);

			d=Math.sqrt(dx*dx+dy*dy);

			c=Math.round(d/10);

			if (document.body.scrollLeft+floatX>lastX) {lastX=lastX+delayspeed+c;}

			if (document.body.scrollLeft+floatX<lastX) {lastX=lastX-delayspeed-c;}

			if (document.body.scrollTop+floatY>lastY) {lastY=lastY+delayspeed+c;}

			if (document.body.scrollTop+floatY<lastY) {lastY=lastY-delayspeed-c;}

		}

		document.all['tools'].style.posLeft = lastX;

		document.all['tools'].style.posTop = lastY;

	}

	setTimeout('adjust()',50);

}



function define(){

	if ((NS4) || (NS6)){

		if (align=="left") {

			floatX=ifloatX; 

			floatX2=ifloatX2

		}

		

		//if (align=="right") {floatX=window.innerWidth-ifloatX-layerwidth-20;};

		//if (align=="center") {floatX=Math.round((window.innerWidth-20)/2)-Math.round(layerwidth/2)};

		//if (valign=="top") {floatY=ifloatY};

		//if (valign=="bottom") {floatY=window.innerHeight-ifloatY-layerheight};

		

		if (valign=="center") {

			floatY=Math.round((window.innerHeight-20)/2)-Math.round(layerheight/2);

			floatY2=Math.round((window.innerHeight-20)/2)-Math.round(layerheight/2);}

	}

	if (IE4){

		if (align=="left") {

			floatX=ifloatX

		}

		

		//if (align=="right") {floatX=document.body.offsetWidth-ifloatX-layerwidth-20}

		//if (align=="center") {floatX=Math.round((document.body.offsetWidth-20)/2)-Math.round(layerwidth/2)}

		//if (valign=="top") {floatY=ifloatY};

		//if (valign=="bottom") {floatY=document.body.offsetHeight-ifloatY-layerheight}

		

		if (valign=="center") {

			floatY=Math.round((document.body.offsetHeight-20)/2)-Math.round(layerheight/2)

		}

	}

}





/*****  this was his code :-)  *********************************************************************************/





if ((IE4) || (NS6)) {

	

	document.write('<div id="tools" style="position:absolute; left:'+floatX+'; top:'+floatY+';">');

	document.writeln ("<table border=0>");

	

	document.writeln ("<tr id='set1'>");

	document.writeln ("<td align=center>");

	document.writeln ("<a href='#' class=toolbar><img src='images/up.gif' border=0 alt='Top'></br>Top</a>");

	document.writeln ("</td>");

	document.writeln ("</tr>");

		

	document.writeln ("<tr id='set2'>");

	document.writeln ("<td align=center>");

	document.writeln ("<a href='index.htm' class=toolbar><img src='images/home.gif' border=0 alt='Homepage'></br>Startseite</a>");

	document.writeln ("</td>");

	document.writeln ("</tr>");

	

	document.writeln ("<tr>");

	document.writeln ("<td align=center>");

	document.writeln ("<a href='kontakt.htm' class=toolbar><img src='images/kontakt.gif' border=0 alt='Kontakt'></br>Kontakt</a></td>");

	document.writeln ("</tr>");

	document.writeln ("</table>");

	document.write('</DIV>');

}



if (NS4) {

	

	document.write('<LAYER NAME="tools2" LEFT="'+floatX2+'" TOP="'+floatY2+'" z-index="2">');

	document.writeln ("<table border=0><tr><td align=center>");

	document.writeln ("<a href='#' class=toolbar><img src='images/up.gif' border=0 alt='Top'></br>Top</a>");

	document.writeln ("</br><a href='index.htm' class=toolbar><img src='images/home.gif' border=0 alt='Homepage'></br>Startseite</a>");

	document.writeln ("</td></tr></table>");

	document.write('</LAYER>');

	

	document.write('<LAYER NAME="tools" LEFT="'+floatX+'" TOP="'+floatY+'" z-index="1">');

	document.writeln ("</br></br></br></br></br></br>");

	document.writeln ("<table border=0><tr><td align=center>");

	document.writeln ("<a href='kontakt.htm' class=toolbar><img src='images/kontakt.gif' border=0 alt='Kontakt'></br>Kontakt</a>");

	document.writeln ("</td></tr></table>");

	document.write('</LAYER>');

	

}





ifloatX=floatX;

ifloatY=floatY;

ifloatX2=floatX2;

ifloatY2=floatY2;



define();

window.onresize=define;



lastX=-1;

lastY=-1;

lastX2=-1;

lastY2=-1;



adjust();





document.onmousemove=drags;



if(document.layers) {



 document.captureEvents(Event.MOUSEMOVE);

 document.onmousemove=drags;



}



/* EXPLORER / MOZILLY do scrolltop & NETSCAPE does pageoffset */ 



function drags(){



	if (window.pageYOffset > 100) {

		if (NS4){

			//window.status=window.pageYOffset+" :: Netscape";

			document.layers.tools2.visibility = "show";

		}

		

	}

	else {

		if (NS4){

			//window.status=window.pageYOffset+" :: Netscape";

			document.layers.tools2.visibility = "hide";

		}

	}

	

	if (document.body.scrollTop > 100) {

		if (IE4){

			//window.status=document.body.scrollTop+" :: IE";

			document.getElementById("set1").style.display = "block";

			document.getElementById("set2").style.display = "block";

		}

		

	}

	else {

		if (IE4){

			//window.status=document.body.scrollTop+" :: IE";

			document.getElementById("set1").style.display = "none";

			document.getElementById("set2").style.display = "none";

		}

	}



}





/**********  this is it * ********************************************************************************/












