var my12_hour = 1;
var old = "";

if (document.all||document.getElementById) 
{ 
  document.write('<span id="LiveClockIE"></span>'); 
}
else 
  if (document.layers) 
  { 
    document.write('<ilayer id="ClockPosNS"><layer id="LiveClockNS"></layer></ilayer>'); 
  }
  else 
  { 
    old = "true"; 
    show_clock(); 
  }

  function show_clock() 
  {
    //show clock in NS 4
    if (document.layers)
    {
      document.ClockPosNS.visibility="show"
    }
    if (old == "die") 
    { 
      return; 
    }

    var Digital = new Date();
    var hours = Digital.getHours();
    var minutes = Digital.getMinutes();
    var seconds = Digital.getSeconds();

    if (my12_hour) 
    {
      var dn = "am";

      if (hours > 12) 
      { 
        dn = "pm"; 
        hours = hours - 12; 
      }

      if (hours == 0) 
      { 
        hours = 12; 
      }
    } 
    else 
    {
	 dn = "";
    }

    if (hours <= 9) 
    { 
      hours = "0"+hours; 
    }

    if (minutes <= 9) 
    { 
      minutes = "0"+minutes; 
    }

    if (seconds <= 9) 
    { 
      seconds = "0"+seconds; 
    }

    myclock = hours+':'+minutes+':'+seconds+dn;

    if (old == "true") 
    {
      document.write(myclock);
      old = "die"; 
      return;
    }

    if (document.layers) 
    {
      clockpos = document.ClockPosNS;
      liveclock = clockpos.document.LiveClockNS;
      liveclock.document.write(myclock);
      liveclock.document.close();
    } 
    else 
    if (document.all) 
    {
      LiveClockIE.innerHTML = myclock;
    } 
    else 
    if (document.getElementById) 
    {
      document.getElementById("LiveClockIE").innerHTML = myclock;
    }

    setTimeout("show_clock()",1000);
}