window.onload=function()
{
	clock();
}


function clock()             		<!-- Set the function called clock !-->
{
now = new Date()            		<!-- Grab the current Date !-->
sec = now.getSeconds()      		<!-- Get the seconds !-->
min = now.getMinutes()      		<!-- Get the minutes !-->
hrs = now.getHours()        		<!-- Get the hours   !-->
if (sec <= 9) { sec = "0"+sec; }       	<!-- Add a 0 if less than 10 !-->
if (min <= 9) { min = "0"+min; }       	<!-- Same as above !-->
if (hrs <= 9 && hrs != 0)              	<!-- If the time is less than nine !-->
{
msg = "am";                         	<!-- Set the message to AM !-->
} 
else if (hrs > 9 && hrs < 12) {    	<!-- Set it to AM if above 10 but less than 12 !-->
msg = "am";                         	<!-- Set the message to AM !-->
} 
else if (hrs > 12) {               		<!-- If the time's greater than 12 !-->
hrs = (hrs - 12)                     	<!-- Subtract 12 from current time variable !-->
msg = "pm";                         	<!-- Set the message to PM !-->
} 
else if (hrs == 0) {               		<!-- If time equals 0 (midnight) !-->
msg = "am";                         	<!-- Set the message to AM !-->
hrs = "12";                          		<!-- Set the hour to 12 for readability !-->
}
else if (hrs ==12) {               		<!-- If time equals 0 (midnight) !-->
msg = "pm";                         	<!-- Set the message to AM !-->
hrs = "12";                          		<!-- Set the hour to 12 for readability !-->
}
else {                             		<!-- Else the hour equals the hour !-->
hrs = hrs;
}
timestring = hrs+":"+min+":"+sec+" "+msg;  <!-- Set the time string !-->
setTimeout("clock()",1000)             	<!-- Set the timeout for the function 'clock' !-->
dayName = new Array ("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat")
monName = new Array ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
now = new Date()							    
fulldate=monName[now.getMonth()] + " " +now.getDate()+", " +now.getFullYear();
var obj=document.getElementById("clockID")
if(obj)obj.innerHTML = fulldate +" "+timestring;

}
