// JavaScript Document

window.onload = showTimeDate;

function showTimeDate()
{
	var now = new Date();
	
	var theTime = "Today is " + showDate() + " - " + showHours(now.getHours()) + showMinuteSeconds(now.getMinutes()) + showMinuteSeconds(now.getSeconds()) + showAmPm();
	
	document.getElementById("time_date").innerHTML = theTime;
	setTimeout("showTimeDate()", 1000);
	
	
	function showHours(theHour)
	{
		if(theHour == 0) { return 12; }
		if(theHour < 13) { return theHour; }
		return theHour - 12;
	}
	
	function showMinuteSeconds(MinuteSeconds)
	{
		if(MinuteSeconds > 9) { return ":" + MinuteSeconds; }
		return ":0" + MinuteSeconds;	
	}
	
	function showAmPm()
	{
		if(now.getHours() < 12) { return " am"; }
		return " pm";
	}
	
	function showDate()
	{
		
		var monName = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
		var dateHere = monName[now.getMonth()] + " " + now.getDate() + ", " + now.getFullYear();
		return dateHere;
	}
	
}