function init ( )
{
  timeDisplay = document.createTextNode ( "" );
  document.getElementById("clock").appendChild ( timeDisplay );
}

function updateClock ( )
{
  var currentTime = new Date ( );

  var currentHours = currentTime.getHours ( );
  var currentMinutes = currentTime.getMinutes ( );
  var currentSeconds = currentTime.getSeconds ( );
  var currentmSeconds = currentTime.getMilliseconds ( );
  var currentFrame = Math.round(currentmSeconds / 40);

  // Pad the minutes and seconds with leading zeros, if required
  currentHours = ( currentHours < 10 ? "0" : "" ) + currentHours;	
  currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
  currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;
  currentFrame = ( currentFrame < 10 ? "0" : "" ) + currentFrame;

  // Compose the string for display
  var currentTimeString = "01:" + currentHours + ":" + currentMinutes + ":" + currentSeconds + ":" + currentFrame;


  // Update the time display
  document.getElementById("clock").firstChild.nodeValue = currentTimeString;
}
