
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
function getthedate(){
var mydate=new Date()
var year=mydate.getFullYear()
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
var hours=mydate.getHours()
var minutes=mydate.getMinutes()
var seconds=mydate.getSeconds()

var offset=mydate.getTimezoneOffset()/60
if (offset==0)
offset=""

var num="th."
if (daym==1)
num="st."
if (daym==2)
num="nd."
if (daym==3)
num="rd."
if (daym==21)
num="st."
if (daym==22)
num="nd."
if (daym==23)
num="rd."
if (daym==31)
num="st."


//if 12 hour clock uncomment the next 8 lines and see note below
var dn="am"
if (hours>=12)
dn="pm"
if (hours>12){
hours=hours-12
}
if (hours==0)
hours=12

//if 24hour clock uncomment the next 2 lines
//if (hours<=9)
//hours="0"+hours

if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
//if 12 hour clock uncomment next line
var cdate="<font face='Arial' size='-3'><nobr>"+dayarray[day]+", "+daym+num+" "+montharray[month]+" "+year+"  "+hours+":"+minutes+":"+seconds+" "+dn+"</nobr></font>"
//if 24 hour clock uncomment next line
//var cdate="Today is "+dayarray[day]+", "+daym+num+" "+montharray[month]+" "+year+"  "+hours+":"+minutes+":"+seconds+" (GMT"+offset+")"
if (document.all)
document.all.clock.innerHTML=cdate
else if (document.getElementById)
document.getElementById("clock").innerHTML=cdate
else
document.write(cdate)
}
if (!document.all&&!document.getElementById)
getthedate()
function goforit(){
if (document.all||document.getElementById)
setInterval("getthedate()",1000)
}
window.onload=goforit