function init ( ) {
  timeDisplay = document.createTextNode ( "" );
  document.getElementById("clock").appendChild ( timeDisplay );
}

function updateClock ( ) {
    var currentTime = new Date ( );
    
    var currentHours = currentTime.getHours ( );
    var currentMinutes = currentTime.getMinutes ( );
    var currentSeconds = currentTime.getSeconds ( );
    
    // Pad the minutes and seconds with leading zeros, if required
    currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
    currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;
    
    // Choose either "AM" or "PM" as appropriate
    var timeOfDay = ( currentHours < 12 ) ? "am" : "pm";
    
    // Convert the hours component to 12-hour format if needed
    currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
    
    // Convert an hours component of "0" to "12"
    currentHours = ( currentHours == 0 ) ? 12 : currentHours;
    
    // Compose the string for display
    var currentTimeString = currentHours + ":" + currentMinutes + " " + timeOfDay;
    
    // Update the time display
    document.getElementById("clock").firstChild.nodeValue = currentTimeString;
}

function GetDay(intDay) {
    
    var DayArray = new Array("Sun", "Mon", "Tue", "Wen", 
                         "Thu", "Fri", "Sat");
    
    return DayArray[intDay]
}

function GetMonth(intMonth) {
    
    var MonthArray = new Array("01", "02", "03",
                               "04", "05", "06",
                               "07", "08", "09",
                               "10", "11", "12");
                               
    return MonthArray[intMonth] 	  	 
}

function getDateStrWithDOW() {
    var today = new Date()
    var year = today.getYear()
    if(year<1000) year+=1900
    
    var todayStr = GetDay(today.getDay()) + ", " ;
    todayStr += today.getDate() + "/" + GetMonth(today.getMonth());
    todayStr += "/" + year ;
    return todayStr
}