	// Layer rotieren im Kreis um beliebigen Punkt
	// Autor: Felix Brandt
	// Copyright (c) 02.03.2004 by Felix Brandt

var anz=8;
var winkel=new Array();
var back=new Array(91,91,91,91,91,91,91,91);
var schritt=0.01;
var startwinkel=0, rotieren=0;
var pi=3.141592;
var mouse_x=0, mouse_y=0;
var dif_x=0, dif_y=0;

function show(wer, x, y){
	//eval("document.all.dr"+(wer)+".style.left="+x+";");
	//eval("document.all.dr"+(wer)+".style.top="+y+";");
}

function init(){
	for(x=0;x<anz;x++) winkel[x]=2*pi*(x+1)/anz;
	show(0);
}

function sin(x){ return Math.sin(x)*191;}	//maximale Auslenkung vertikal
function cos(x){ return Math.cos(x)*299;}	//maximale Auslenkung horizontal

function move(Ereignis){
	return
	if(!schieben) return;

	mouse_x_old = mouse_x;
	mouse_y_old = mouse_y;

	catch_pos(Ereignis);

	d_x = mouse_x_old - mouse_x;
	d_y = mouse_y_old - mouse_y;

	if(d_x < 0) d_x*=-1;
	if(d_y < 0) d_y*=-1;

	if(d_x+d_y<30){
		show(schieben, mouse_x-91, mouse_y-34);
	}
	else schieben = 0;
}

	//Mausposition einfangen
function catch_pos(Ereignis){
	if (document.layers) {
		mouse_x = Ereignis.screenX;
		mouse_y = Ereignis.screenX;
	}
	else{
		mouse_x = window.event.clientX;
		mouse_y = window.event.clientY;
	}
}

function catch_on(rubrik){
	schieben = 0;
	return;
	schieben = rubrik;

	eval("dif_x=document.all.dr"+(rubrik)+".style.left;");
	eval("dif_y=document.all.dr"+(rubrik)+".style.top;");

	catch_pos();
	show(schieben, mouse_x-91, mouse_y-34);
}

function catch_off(){
	schieben = 0;
}

function get_winkel (now_x, now_y, base_x, base_y){
	now_x+=dif_x;
	now_y+=dif_y;

	if(now_x==base_x){
		if(now_y>base_y) return 90;
		else return 270;
	}
	else{
		return Math.round(Math.atan((base_y-now_y)/(base_x-now_x))*(360/(2*pi)) + ((now_x<base_x)?180:((now_y<base_y)?360:0)));
	}
}

function change(name, url){
	if(name=="") return;
	eval("document[\""+name+"\"].src=\"images/"+url+"\";");
}

function ch_on(name){
	change(name, "t_"+name+"2.gif");
}

function ch_off(name){
	change(name, "t_"+name+".gif");
}

