n=$teller
bewerking=bewerking1.proc
nivo_title=the 12 hour analogue clock<br> which clock is the right one?
!if $HINT=1
    hint=no hints today
!endif
!if $graad=0
    R=$teller
!else
    R=$graad
!endif        
GOED$n=!randitem 1,$aantal_vragen
style=!randitem 1,2
keuze=!randitem 1,1,1,2

!if $R=1 or $R=2
    max=12
!else
    max=24
!endif            

!for p=1 to $aantal_vragen
    uren=!randint 1,$max
    minuten=!randint 1,59
    seconden=!randint 1,59
    !if $p=$(GOED$n)
	!if $keuze=1
	    tijd_nu=$uren,$minuten,$seconden
	!else
	    tijd_nu=!date +%I,%M,%S
	    uren=!item 1 of $tijd_nu
	    minuten=!item 2 of $tijd_nu
	    seconden=!item 3 of $tijd_nu
	!endif        
    !endif
    wims_read_parm=$uren:$minuten:$seconden
    !readproc slib/draw/clock $wims_read_parm,200,$style
    klok$p=$slib_out 
!next p	    

uren=!item 1 of $tijd_nu
test=!char 1 of $uren    
!if $test=0
    uren=!char 2 of $uren
!endif
minuten=!item 2 of $tijd_nu
seconden=!item 3 of $tijd_nu 

!if $R=1 or $R=2 
    !if $uren=12
	mooizo=1
    !else
	mooizo=$[$uren+1]
    !endif    
    !if $minuten <= 15
	!if $minuten=0 
	    uur=!item $uren of $telwoorden
	    text_m=It's now exactely $uur O'clock
	    !goto KLAAR
	!endif	
	!if $minuten=15
	    uur=!item $uren of $telwoorden
	    text_m=It's now a quarter past $uur
	    !goto KLAAR
	!endif
	uur=!item $uren of $telwoorden
	min=!item $minuten of $telwoorden
	text_m=It's now $min minutes past $uur 
	!goto KLAAR    
    !endif
    !if $minuten <= 30
	!if $minuten=30
	    uur=!item $uren of $telwoorden
	    text_m=It's now exactely half past $uur
	    !goto KLAAR
	!endif
	#min=$[30-$minuten]
	uur=!item $uren of $telwoorden
	min=!item $minuten of $telwoorden
	text_m=It's now $min minutes past $uur  
	!goto KLAAR
    !endif
    !if $minuten <= 60
	!if $minuten=45
	    uur=!item $mooizo of $telwoorden
	    text_m=It's a quarter to $uur
	    !goto KLAAR
	!endif
	min=$[60-$minuten]
	min=!item $min of $telwoorden
	uur=!item $mooizo of $telwoorden
	text_m=It's now $min minutes to $uur 
    !endif

    :KLAAR    
    !if $printbaar=0
	somtekst$n=<p align="center"><b>$text_m\
	<font color=blue id="test1" onClick="this.innerHTML='(and $seconden seconds...)'"> and ... </font>\
	</b><br>which one of these clocks gives the <em>right time</em>?</b></p>
    !else
	somtekst$n=<p align="center"><b>$text_m and $seconden seconds\
	</b><br>which one of these clocks gives the <em>right time</em>?</b></p>
    !endif
!endif 

!if $R=3 
    !if $printbaar=0
	somtekst$n=<p align="center"><b>Now its $uren hours and $minuten minutes.\
	<font color=blue id="test1" onClick="this.innerHTML='(and  $seconden seconds...)'"> and ... </font>\
	</b><br>which one of these clocks gives the <em>right time</em>?</b></p>
    !else
	somtekst$n=<p align="center"><b>Now its $uren hours and $minuten minutes and  $seconden seconds.\
	</b><br>which one of these clocks gives the <em>right time</em>?</b></p>
    !endif
!endif
!if $R>3
    !if $printbaar=0
	somtekst$n=<p align="center"><b>And now its $uren<blink>:</blink>$minuten<blink>:</blink>$seconden\
	</b><br>which one of these clocks gives the <em>right time</em>?</b></p>
    !else
	somtekst$n=<p align="center"><b>And now its $uren : $minuten : $seconden\
	</b><br>which one of these clocks gives the <em>right time</em>?</b></p>
    !endif
!endif
