
/* 
Er zijn vier identieke lagen 'hoppers', die ieder in een beeldlaag staan;
Br				is de breedte van elke beeldlaag;
L1...L4		zijn hun resp x0 of left waarde; de een volgt de ander
L1				start bij 0;
periode		is de staptijd in ms;
stap			is de afstand per periode;
*/
periode=80;
Br=600;
L1=0;
L2=L1+Br;
L3=L2+Br;
L4=L3+Br;
Br2=Br+Br;
Br3=Br2+Br;

function rol(){
	L1+=stap;
	L2+=stap;
	L3+=stap;
	L4+=stap;
	STIJL('hoppers1').left=L1.toString()+'px';
	STIJL('hoppers2').left=L2.toString()+'px';
	STIJL('hoppers3').left=L3.toString()+'px';
	STIJL('hoppers4').left=L4.toString()+'px';
	if(L1>Vbr)L1=L2-Br		//hoppers1 van helemaal rechts net buiten beeld helemaal links net buiten beeld vóór hoppers4 zetten
	if(L2>Vbr)L2=L3-Br		//idem hoppers2 van rechts naar links vóór hoppers1 plaatsen
	if(L3>Vbr)L3=L4-Br		//idem hoppers3 van rechts naar links vóór hoppers2 plaatsen
	if(L4>Vbr)L4=L1-Br		//idem hoppers4 van rechts naar links vóór hoppers3 plaatsen
	klok=setTimeout("rol()",periode)
}
function Afst(x){
	stap=x;		//horizontale verplaatsing
	HopIncr=-Math.ceil(stap/3); 
}

HopNiveauRef0=130;						//bovenkant hoppers-lagen t.o.v. hopgroep
HopNiveauRef=HopNiveauRef0;		//HopNiveauRef wordt afh. winnen aangepast
HopIncrtot=40;
HopNiveauNu=HopNiveauRef+HopIncrtot;		//HopNiveauNu is + of - hop t.o.v. HopNiveauRef
gewonnen=0;

periodehop=50;

function hop(){
	STIJL('hoppers1').top=HopNiveauNu.toString()+'px';
	STIJL('hoppers2').top=HopNiveauNu.toString()+'px';
	STIJL('hoppers3').top=HopNiveauNu.toString()+'px';
	STIJL('hoppers4').top=HopNiveauNu.toString()+'px';
	klok=setTimeout("hop()",periodehop);
	Y=HopNiveauNu-HopNiveauRef
	Yabs=Math.abs(Y);
	if(Yabs>HopIncrtot&&Y<0&&HopIncr<0)HopIncr=-HopIncr;	//zo 'moeilijk' gemaakt voor
	if(Yabs>HopIncrtot&&Y>0&&HopIncr>0)HopIncr=-HopIncr;	//gladdere overgang bij win
	HopNiveauNu+=HopIncr;
}


