// JavaScript Document

// Calculate four digit year.
function fourdigits(number)	{
	return (number < 1000) ? number + 1900 : number;
}

function showTime() {
	
	// Get today's current date.
	var now = new Date();
		
	// Array list of months.
	var months = new Array('JANUARY','FEBRUARY','MARCH','APRIL','MAY','JUNE','JULY','AUGUST','SEPTEMBER','OCTOBER','NOVERMBER','DECEMBER');
	
	// Calculate the number of the current day in the month.
	var date =  now.getDate();
	
	
	
	var time = "";
	var mm = " AM";
	var hours = now.getHours();
	
	if (hours >= 12) {
		hours = (hours == 12) ? 12 : hours - 12; mm = " PM";
	} else {
		hours = (hours == 0) ? 12 : hours;
	}
	
	var minutes = now.getMinutes();
	if (minutes < 10) {
		time = hours + ":0" + minutes + " " + mm;
	}
	else {
		time = hours + ":" + minutes + " " + mm;
	};
	
	// Join it all together
	today =  months[now.getMonth()] + " " +
			 date + ", " +
			 (fourdigits(now.getYear())) + " | " + time ;
	
	// Print out the data.
//	document.write(today);
    document.getElementById("datestamp").firstChild.nodeValue = today;
}

