var timestamp = document.getElementById("header").getElementsByTagName("div").item(2),
	leadingZero = function(i)
	{
		return (i < 10 ? '0' + i : i);
	},
	time = function()
	{
		var date = new Date();
		var hours = date.getHours(),
			minutes = date.getMinutes(),
			seconds = date.getSeconds(),
			ampm = "am";
		if (hours > 11) { ampm = "pm"; }
		if (hours > 12) { hours -= 12; }
		if (!hours) { hours = 12; }
		timestamp.removeChild(timestamp.firstChild);
		timestamp.appendChild(document.createTextNode(leadingZero(hours) + ':' + leadingZero(minutes) + ':' + leadingZero(seconds) + ampm));
		setTimeout(time, 500);
	};
time();