:: crossfit_north_record
<<set $here = 'crossfit_north_record'>>
<<set $ARGS = $location_var[$here]>>
<<set $menu_off = 1>>
<<if $location_var[$here][0] == 'view_records'>>
	<<gs 'crossfit_north_record' 'update_box_records'>>
	<center><img <<$set_imgh>> src="<<$crossfit_north_image_dir>>records.jpg"></center>
	You look at the board outlining the personal records
	<center><table border=1><tr><th>Workout</th><th>Personal Best</th><th>Box Record (Women)</th><th>Box Record Holder</th></tr>
	<<set $record_table_counter = 0>>
	<<warn 'JUMP MARKER ENCOUNTERED: :recordloop'>>
	<<if $record_table_counter < ARRSIZE('$crossfit_wods')>>
		<<set $crossfit_wod = $crossfit_wods[$record_table_counter]>>
		<tr><td><<$crossfit_wod>></td><td>' & setup.func('crossfit_north_record', 'recordstring', $crossfit_wod, personal_wod_record[$crossfit_wod]) & '</td><td>' & setup.func('crossfit_north_record', 'recordstring', $crossfit_wod, box_wod_record[$crossfit_wod])  & '</td><td> <<$box_wod_record_holder[$crossfit_wod]>></td></tr>
		<<set $record_table_counter += 1>>
		<<warn 'JUMP COMMAND ENCOUNTERED: jump recordloop'>>
	<</if>>
	</table></center>
	<<set $record_table_counter to null>>
	<<set $crossfit_wod to null>>
	<<actCLA 'Go back'>>
		<<gt $location>>
	<</actCLA>>
<</if>>
<<if $location_var[$here][0] == 'recordstring'>>
	<<if $location_var[$here][2] == 0>>
		<<set $result = 'No score yet'>>
	<<else>>
		<<set $wod_score = $wod_min_score[$location_var[$here][1]] + ($wod_max_score[$location_var[$here][1]] - $wod_min_score[$location_var[$here][1]]) * $ARGS[2] / 100>>
		<<if $wod_type[$location_var[$here][1]] == 'for_time'>>
			<<set $result = 'wod_score/60 minutes and wod_score - ($wod_score / 60)*60 seconds'>>
		<</if>>
		<<if $wod_type[$location_var[$here][1]] == 'for_rounds'>>
			<<set $result = 'wod_score/100 rounds and wod_score - ($wod_score / 100)*100% of the last one'>>
		<</if>>
	<</if>>
<</if>>
<<if $location_var[$here][0] == 'update_box_records'>>
	<<if getvar("$last_box_record_update") == 0 or $last_box_record_update + 30 < $time.daystart>>
		<<set $number_of_box_record_updates = 30>>
	<<else>>
		<<set $number_of_box_record_updates = $time.daystart - $last_box_record_update>>
	<</if>>
	<<set $last_box_record_update = $time.daystart>>
	<<set $current_record_update_count = 0>>
	<<warn 'JUMP MARKER ENCOUNTERED: :recordupdateloop'>>
	<<if $current_record_update_count < $number_of_box_record_updates>>
		<<gs 'crossfit_north_record' 'box_records'>>
		<<set $current_record_update_count += 1>>
		<<warn 'JUMP COMMAND ENCOUNTERED: jump recordupdateloop'>>
	<</if>>
	<<set $current_record_update_count to null>>
	<<set $number_of_box_record_updates to null>>
<</if>>
<<if $location_var[$here][0] == 'box_records'>>
	<<set $crossfit_record_it = 0>>
	<<warn 'JUMP MARKER ENCOUNTERED: :recordgeneratorloop'>>
	<<if $crossfit_record_it < ARRSIZE('$crossfit_wods')>>
		<<set $crossfit_wod = $crossfit_wods[$crossfit_record_it]>>
		<<set $new_record_wod_time = Math.max(1,(100 - (100 * (rand(40,100) + rand(0,100) + rand(0,100) + rand(0,100)) / 400)))>>
		<<if getvar("$box_wod_record["+$crossfit_wod+"]") == 0 or $box_wod_record[$crossfit_wod] > $new_record_wod_time>>
			<<setinit $box_wod_record[$crossfit_wod] = $new_record_wod_time>>
			<!-- !! record holder changes only in 1/3rd of the cases from previous holder, or if sveta is record holder-->
			<<if rand(1,3) == 1 OR $box_wod_record_holder[$crossfit_wod]>>
				<<gs 'npcrnamefile' 'rusFemale'>>
				<<setinit $box_wod_record_holder[$crossfit_wod] = $npctempgn[1]>>
			<</if>>
		<</if>>
		<<set $crossfit_record_it += 1>>
		<<warn 'JUMP COMMAND ENCOUNTERED: jump recordgeneratorloop'>>
	<</if>>
	<<set $crossfit_record_it to null>>
	<<set $new_record_wod_time to null>>
	<<set $crossfit_wod to null>>
<</if>>
