Tijdlijn=function(){
	var t=this;
	var Timeout=null;
	var MSec=null;
	var IsActief=false;
	var DoeStap=function(){
		try{
			if (IsActief){
				t.Actie();
				if (t.Teller==t.Eerste&&t.NaEerste) t.NaEerste();
				else if (t.Teller==t.Laatste&&t.NaLaatste&&t.Stap>0) t.NaLaatste();
				var GaDoor;
				if (t.PingPong){
					if (t.Teller==t.Laatste) t.Stap=-t.Stap;
					GaDoor=t.Stap>0 || t.Teller>t.Eerste;
				}
				else GaDoor=t.Teller<t.Laatste;
				if (GaDoor){
					t.Teller+=t.Stap;
					Timeout=setTimeout(DoeStap,MSec);
				}
				else{
					if (t.Herhaling<t.Herhaal || t.Herhaal<0){
						t.Herhaling++;
						if (t.PingPong){
							t.Stap=-t.Stap;
							t.Teller=t.Eerste+t.Stap;
						}
						else t.Teller=t.Eerste;
						Timeout=setTimeout(DoeStap,MSec);
					}
					else{
						t.Stop();
						t.Herhaling=0;
						t.Teller=t.Eerste;
						if (t.NaAfloop) t.NaAfloop();
					}
				}
			}
		}
		catch(e){/*IE 5.0 verliest alle omgevingsvariabelen soms, oorzaak onbekend, vandaar deze try-and-catch*/}
	}
	t.Start=function(){
		if (t.Actie && !IsActief){
			IsActief=true;
			if (t.Teller==undefined) t.Teller=t.Eerste;
			MSec=1000/t.Frequentie;
			DoeStap();
		}
	}
	t.Stop=function(){
		clearTimeout(Timeout);
		IsActief=false;
	}
	t.Pauzeer=function(Tellen){
		t.Stop();
		var p=new Tijdlijn;
		p.Frequentie=t.Frequentie;
		p.Laatste=Tellen;
		p.Actie=function(){};
		p.NaAfloop=t.Start;
		p.Start();
	}
	t.IsActief=function(){return IsActief};
	t.Frequentie=25;
	t.Herhaal=t.Herhaling=t.Eerste=t.Laatste=0;
	t.Stap=1;
	t.NaEerste=t.NaLaatste=t.NaAfloop=t.Actie=null;
	t.PingPong=false;
}