<!-- Hide Javascript

// file anchclock.js
// modified 18/12/01

// this file contains code for the 50 Chess Games Clock

var mins = 0;
var secs = 0;
var secsLength = new String("");
var minsLength = new String("");
var clockStarted = new String("");
var clockGoing = new String("");

function toggleclock(){
  if(clockGoing.length==0){
    dummy = startclock();
    window.status='Timer started';
    window.setTimeout("statusreset()",1500);
    return true;
  }
  else{
    dummy=stopclock();
    window.status='Timer stopped';
    window.setTimeout("statusreset()",1500);
    return true;
  }
}

function statusreset(){
  window.status='';
  return true;
}

function keyresetclock(){
  dummy = resetclock();
  window.status='Timer reset';
  window.setTimeout("statusreset()",1500);
  return true;
}

function startclock(){
  if(clockGoing.length==0){
    dummy = startclock2();
  }
}

function startclock2(){
  document.formdisplay.displaybox.value = getClockTime();
  clockgo = window.setTimeout("startclock2()",1000);
}

function stopclock(){
  if(clockGoing.length>0){
    window.clearTimeout(clockgo);
    clockGoing = "";
  }
}

function resetclock(){
if(clockStarted.length>0){
    window.clearTimeout(clockgo);
  }
document.formdisplay.displaybox.value = "00:00";
mins=0;
secs=0;
secsLength="";
minsLength="";
clockStarted="";
clockGoing="";
}

function getClockTime(){
 clockStarted="yes";
 clockGoing="yes";
 secs++;
 if((secs<10)&&(secsLength.length==0)){
   secs= "0" + secs;
 }
 if(secs==60){
   secs="00";
   mins++;
   minsLength="";
 }
 if((mins<10)&&(minsLength.length==0)){
  mins = "0" + mins;
  minsLength="yes";
 } 
 return mins +":"+secs; 
}

// (c) Copyright Ian James Douglas MacGregor and Ian Ross MacGregor, 2001.
// All rights reserved.
// This website (including its constituent html, javascript and image files), may not be 
// copied, printed out, or ammended in any way, without the written permission of the 
// copyright holders.

// End hiding -->

