4 // Provides a counter that keeps track how much
5 // time user have left to check in started quiz.
7 function countdown_clock(theTimer) {
10 quizTimerValue = Math.floor((ec_quiz_finish - new Date().getTime())/1000);
12 if(quizTimerValue <= 0) {
13 clearTimeout(timeout_id);
14 document.getElementById('timeup').value = 1;
15 var ourForm = document.getElementById('responseform');
16 if (ourForm.onsubmit) {
24 var hours = Math.floor(now/3600);
25 now = now - (hours*3600);
26 var minutes = Math.floor(now/60);
27 now = now - (minutes*60);
31 t += ((minutes < 10) ? ":0" : ":") + minutes;
32 t += ((seconds < 10) ? ":0" : ":") + seconds;
33 window.status = t.toString();
35 if(hours == 0 && minutes == 0 && seconds <= 15) {
36 //go from fff0f0 to ffe0e0 to ffd0d0...ff2020, ff1010, ff0000 in 15 steps
37 var hexascii = "0123456789ABCDEF";
38 var col = '#' + 'ff' + hexascii.charAt(seconds) + '0' + hexascii.charAt(seconds) + 0;
39 theTimer.style.backgroundColor = col;
41 document.getElementById('time').value = t.toString();
42 timeout_id = setTimeout("countdown_clock(theTimer)", 1000);
45 function movecounter(timerbox) {
48 if (window.innerHeight) {
49 pos = window.pageYOffset
50 } else if (document.documentElement && document.documentElement.scrollTop) {
51 pos = document.documentElement.scrollTop
52 } else if (document.body) {
53 pos = document.body.scrollTop
62 timerbox.style.top = pos + 'px';
65 temp = setTimeout('movecounter(timerbox)',100);