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")
var static_day=-1
var static_month=-1
var static_year=-1
var static_hours=-1
var static_minutes=-1
var static_seconds=-1

function getthedate()
{
	var mydate=new Date()
	var year=mydate.getYear()
	if (year < 1000)
		year+=1900
	
	var day=mydate.getDay()
	var month=mydate.getMonth()
	var daym=mydate.getDate()
	if (daym<10)
		daym="0"+daym
	
	var hours=mydate.getHours()
	var minutes=mydate.getMinutes()
	var seconds=mydate.getSeconds()
    
	if (hours==0)
		hours=12
	if (minutes<=9)
		minutes="0"+minutes
	if (seconds<=9)
		seconds="0"+seconds
        
    if( day != static_day) {
        static_day = day
        if (document.all)
		    document.all.clock_day.innerHTML=daym
	    else if (document.getElementById)
		    document.getElementById("clock_day").innerHTML=daym
    }
    if( month != static_month) {
        static_month = month
        if (document.all)
		    document.all.clock_month.innerHTML=montharray[month]
	    else if (document.getElementById)
		    document.getElementById("clock_month").innerHTML=montharray[month]
    }
    if( year != static_year) {
        static_year = year
        if (document.all)
		    document.all.clock_year.innerHTML=year
	    else if (document.getElementById)
		    document.getElementById("clock_year").innerHTML=year
    }
    if( hours != static_hours ) {
        static_hours = hours
        if (document.all)
		    document.all.clock_hour.innerHTML=hours
	    else if (document.getElementById)
		    document.getElementById("clock_hour").innerHTML=hours
    }
    if( minutes != static_minutes ) {
        static_minutes = minutes
        if (document.all)
		    document.all.clock_minute.innerHTML=minutes
	    else if (document.getElementById)
		    document.getElementById("clock_minute").innerHTML=minutes
    }
    if( seconds != static_seconds ) {
        static_seconds = seconds
        if (document.all)
		    document.all.clock_second.innerHTML=seconds
	    else if (document.getElementById)
		    document.getElementById("clock_second").innerHTML=seconds
    }


}
function goforit()
{
	if (document.all||document.getElementById)
		setInterval("getthedate()",1000)
}
window.onload=goforit
