var timerID = null;
var timerRunning = false;
var TimeShowArea;

function stopclock ()
{
  if(timerRunning)
  clearTimeout(timerID);
  timerRunning = false;
}

function showtime () 
{
  var now = new Date();
  var hours = now.getHours();
  var minutes = now.getMinutes();
  var seconds = now.getSeconds()

  var timeValue = "" + ((hours >12) ? hours -12 :hours)
  timeValue += ((minutes < 10) ? ":0" : ":") + minutes
  timeValue += ((seconds < 10) ? ":0" : ":") + seconds
  timeValue += (hours >= 12) ? " PM" : " AM"
  TimeShowArea.innerHTML = timeValue;
  

// you could replace the above with this
// and have a clock on the status bar:
// window.status = timeValue;

  timerID = setTimeout("showtime()",1000);
  timerRunning = true;
}

function startclock () 
{
// Make sure the clock is stopped
  stopclock();
  showtime();
}



function GetDate(DatePanel)
{
var date = new Date();
var d  = date.getDate();
var day = (d < 10) ? '0' + d : d;
var m = date.getMonth() + 1;
var month = (m < 10) ? '0' + m : m;
var yy = date.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;
DatePanel.innerHTML = day + "/" + month + "/" + year;
}
