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 ( );

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

  // Choose either "AM" or "PM" as appropriate
  var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";

  // Convert the hours component to 12-hour format if needed
  //currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;

  // Convert an hours component of "0" to "12"
  currentHours = ( currentHours == 0 ) ? 12 : currentHours;

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

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

/*
var timeID=null;
var timerRunning=false;
function stopclock (){
        if(timerRunning)
                clearTimeout(timerID);
        timerRunning=false;
        }
function startclock (){
        stopclock ();
        showtime ();
        }
function showtime() {
        var now=new Date();
        var hours= now.getHours();
        var minutes= now.getMinutes();
        var seconds= now.getSeconds();
        var timeValue=""+ hours;
        timeValue += ((minutes<10) ? ":0" : ":") + minutes
        timeValue += ((seconds<10) ? ":0" : ":") + seconds

        document.clock.face.value= timeValue
        timerID = setTimeout("showtime()",1000);
        timerRunning = true;
        }
		*/
		
