/* Javascript - animator.js
	Animates a variable t from 0 to 6.28 in steps of 0.01
	Sends to GGB
   Ulven 11.09.07
*/

// Global parameters to be changed:  //

	t=0;
	start=0;
	stop=6.28;
	step=0.1;
	delay=50;
	running=false;
	timer=null;

///////////////////////////////////////


function toggle() {																//Called by Run/Stop button

	if(running){
		running=false;
		setTimeout("clearInterval(timer)",0);			//Stop Timer in 0 ms, that is now
	}else{
		running=true;
		timer=setInterval("onestep()",delay);		//Timer calls onestep() every delay ms

	}//if

}//toggle()


function onestep() {													//Animates one step

	var applet=document.Animated;

	if(t<stop) {
		t=t+step;
		applet.evalCommand("t="+t);						
	}else{
		t=stop;
		
	}//if

}//onestep()



function reset() {															

	var applet=document.Animated;

	setTimeout("clearInterval(timer)",0);			//Stop Timer immediately

	running=false;
	t=0;

	applet.evalCommand("t=0");
	applet.refreshViews();

}//reset()




