
var timerID = null;
var timerRunning = false;
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) ? " p.m." : " a.m."
        document.clock.face.value = timeValue;
        timerID = setTimeout("showtime()",1000);
        timerRunning = true;
}
function startclock () {
        stopclock();
        showtime();
}

<!--

function makeArray(len)
{
for (var i = 0; i < len; i++)
    this[i] = null;
    this.length = len;
}

var days = new makeArray(7)
days[0] = "domingo"
days[1] = "segunda"
days[2] = "terça"
days[3] = "quarta"
days[4] = "quinta"
days[5] = "sexta"
days[6] = "sábado"

var months = new makeArray(12)
months[0] = "janeiro"
months[1] = "fevereiro"
months[2] = "março"
months[3] = "abril"
months[4] = "maio"
months[5] = "junho"
months[6] = "julho"
months[7] = "agosto"
months[8] = "setembro"
months[9] = "outubro"
months[10] = "novembro"
months[11] = "dezembro"

var now = new Date()
var day = now.getDay()
var month = now.getMonth()
var year = now.getYear()
if(year < 2000)year += 1900;
var date = now.getDate()

var mes=months[month];

var dia=days[day];

function writeDate()
{
document.write(date) 
}

function writeMonth()
{
document.write(mes)
}

function writeYear()
{
document.write(year)
}

function writeDay()
{
document.write(dia)
}
// -->