
function calctime()
{
var currenttime = new Date();
var hours = currenttime.getHours();
var minutes = currenttime.getMinutes();
var seconds = currenttime.getSeconds();
var timesuffix = "am";
if (hours > 11)
{
timesuffix = "pm";
hours = hours - 12;
}
if (hours == 0)
{
hours = 12;
}
if (hours < 10)
{
hours = "0" + hours;
}
if (minutes < 10)
{
minutes = "0" + minutes;
}
if (seconds < 10)
{
seconds = "0" + seconds;
}

var clocklocation = document.getElementById('clock');
if (clocklocation) clocklocation.innerHTML = hours + ":" + minutes + ":" + seconds + " " + timesuffix;

window.setTimeout("calctime()", 1000);
}
calctime();

