﻿//Used with clock


function startTime()
{
var today=new Date()
var d=today.toDateString()
var h=today.getHours()
    {
   if ( h > 12)
        nh=h-12;
   else if ( h == 0 )
        nh=12;
   else
        nh=h; 
     }  
var m=today.getMinutes()
var s=today.getSeconds()
// add a zero in front of numbers<10
m=checkTime(m)
s=checkTime(s)
    {
    if ( h < 12 ) // hour is in 24-hour format
        document.getElementById('topbar').innerHTML=nh+":"+m+" am, "+d
    else
         document.getElementById('topbar').innerHTML=nh+":"+m+" pm, "+d
      }
t=setTimeout('startTime()',500)
}

function checkTime(i)
{
if (i<10) 
  {i="0" + i}
  return i
}