// Sunday, August 14, 1987
function runclock()
{
var mydate= new Date()
var theyear=mydate.getFullYear()
var themonth=mydate.getMonth()+1
var thetoday=mydate.getDate()
var thehour=mydate.getHours()
var theday=mydate.getDay()

if(theday==0) theday = "Sunday";
if(theday==1) theday = "Monday";
if(theday==2) theday = "Tuesday";
if(theday==3) theday = "Wednesday";
if(theday==4) theday = "Thursday";
if(theday==5) theday = "Friday";
if(theday==6) theday = "Saturday";

if(themonth==1) themonth = "January";
if(themonth==2) themonth = "February";
if(themonth==3) themonth = "March";
if(themonth==4) themonth = "April";
if(themonth==5) themonth = "May";
if(themonth==6) themonth = "June";
if(themonth==7) themonth = "July";
if(themonth==8) themonth = "August";
if(themonth==9) themonth = "September";
if(themonth==10) themonth = "October";
if(themonth==11) themonth = "November";
if(themonth==12) themonth = "December";


if(thehour > 12) { thehour = thehour - 12;
ampm = "PM";
}
else {
ampm = "AM";
}
if(thehour == 0) thehour = 12;

var theminute=mydate.getMinutes()
var thesecond=mydate.getSeconds()


if (theminute<=9)
theminute="0"+theminute
if (thesecond<=9)
thesecond="0"+thesecond
theclock.innerHTML = "<i>"+theday+", "+themonth+" "+thetoday+", "+theyear+" "+thehour+":"+theminute+":"+thesecond+" "+ampm+"</i>";
setTimeout("runclock()",1000)
}
var theclock = document.getElementById("clock");
runclock();
