var strings = new Array(
	"Sie wollen etwas für Ihr Wohlbefinden und Ihre Beweglichkeit tun?",
  "Sie wollen sich besser kennen lernen und dafür einen körperlichen Ansatz wählen?",
  "Vielleicht haben Sie körperliche Einschränkungen oder Schmerzen und wollen etwas dagegen unternehmen?",
  "Oder Sie möchten in Ihrer sportlichen und künstlerischen Tätigkeit vorankommen und würden deshalb gern Ihr Körpergefühl verfeinern.",
  "Womöglich sind Sie einfach nur neugierig, welche Möglichkeiten noch in Ihnen schlummern?"
);

var positions = new Array( 50, 90, 130, -50, -90, -130 );

var index = 0;
var alpha = 0;
var delta = -0.025;

var angle = 0;
var posIndex = 0;

function setAngle( obj, a )
{
		var rad = 160;
		var p = document.getElementById("content");
		var x = Math.sin(a) * rad * 2;
		var y = Math.cos(a) * rad * 1.6;
		if( document.all ){
			var offx = (document.body.clientWidth-88)/2 - 145; //p.style.left + p.style.width / 2;
			var offy = (document.body.clientHeight-170)/2 - 30; //p.style.top + p.style.height / 2;
			obj.style.left = Math.floor(x + offx);
			obj.style.top = Math.floor(y + offy);
		} else {
			var offx = (window.innerWidth-88)/2 - 145; //p.style.left + p.style.width / 2;
			var offy = (window.innerHeight-170)/2 - 60; //p.style.top + p.style.height / 2;
			obj.style.left = Math.floor(x + offx) + "px";
			obj.style.top = Math.floor(y + offy) + "px";
		}
}

function nextString()
{
		index++;
  	if( index >= strings.length ) index = 0;
		var obj = document.getElementById("question");
		  		
		if( document.all ){
			obj.style.width = 290;
		} else {
			obj.style.width = "290px";
		}
		
		posIndex = Math.floor(Math.random()*positions.length);
		//posIndex = ((posIndex+7) * 317) % positions.length;
		
		angle = positions[posIndex] * (3.1415/180);
		setAngle(obj, angle);

		obj.firstChild.data = strings[index];
}

function update() {
	var obj = document.getElementById("question");
	
	var next = false;
	
	alpha += delta;
	if( alpha >= 2.5 ){
		alpha = 1;
		delta = -delta;
	} else if( alpha <= 0 ){
		next = true;
		alpha = 0;
		delta = -delta;
	}
	
	b = Math.floor((1-Math.min(alpha,1))*255);
	col = "rgb("+b+","+b+","+b+")";
	obj.style.color = col;
	
	setAngle(obj, angle);

	if( next ) nextString();

	setTimeout("update()", 50);
}


setTimeout("update()", 1000);

