*** moodle19cvs/mod/quiz/jstimer.php	2007-11-02 12:19:56.000000000 -0400
--- moodle/mod/quiz/jstimer.php	2008-05-29 08:39:12.000000000 -0400
***************
*** 27,33 ****
      <td class="generalboxcontent" bgcolor="#ffffff" width="100%">
      <table class="generaltable" border="0" width="150" cellspacing="0" cellpadding="0">
      <tr>
!         <th class="generaltableheader" width="100%" scope="col"><?php print_string("timeleft","quiz");?></th>
      </tr>
      <tr>
          <td id="QuizTimer" class="generaltablecell" align="center" width="100%">
--- 27,35 ----
      <td class="generalboxcontent" bgcolor="#ffffff" width="100%">
      <table class="generaltable" border="0" width="150" cellspacing="0" cellpadding="0">
      <tr>
!         <th class="generaltableheader" width="100%" scope="col"><?php print_string("timeleft","quiz");?>
!             <a onClick="hideTimer()">(hide&nbsp;timer)</a>
!         </th>
      </tr>
      <tr>
          <td id="QuizTimer" class="generaltablecell" align="center" width="100%">
***************
*** 54,58 ****
--- 56,80 ----
  movecounter(timerbox);
  
  document.onload = countdown_clock(theTimer);
+ 
+ function hideTimer() {
+     //How many milliseconds remain in the quiz?
+     quizTimerValue = 1000 * Math.floor((ec_quiz_finish - new Date().getTime())/1000);
+     var delay;
+     if(quizTimerValue<0) { //If time has already expired, do nothing
+         return;
+     }else if(quizTimerValue<60000) { //If less than one minute remains, only hide for half that time
+         delay=quizTimerValue/2;
+     }else { //If one minute or more remains, hide for one minute
+         delay=60000;
+     }
+     timerbox.style.display='none';
+     setTimeout('showTimer()', delay);
+ }
+ 
+ function showTimer() {
+     timerbox.style.display='block';
+ }
+ 
  //]]>
  </script>
