function updateclocktime(clocktag)
{
	var thetime = new Date();
	
	var nhours=thetime.getHours();
	var nmins=thetime.getMinutes();
	var nsecn=thetime.getSeconds();
	var AorP=" ";
	
	if (nhours>=12)
	    AorP="pm";
	else
	    AorP="am";
	
	if (nhours>=13)
		nhours-=12;
	
	if (nhours==0)
		nhours=12;
	
	if (nhours<10)
		nhours="0"+nhours;
	
	if (nsecn<10)
		nsecn="0"+nsecn;
	
	if (nmins<10)
		nmins="0"+nmins;
	
	var clockoutput = document.getElementById(clocktag);
	(clockoutput==null) ? {} : clockoutput.firstChild.nodeValue=nhours+":"+nmins+":"+nsecn+" "+AorP;
	
	setTimeout('updateclocktime("'+clocktag+'")',1000);
}

function updateuptime(tag, booted)
{
	var theTime = new Date();
	var boottime = new Date(booted * 1000);
	var uptime = new Date(theTime - boottime);

	var ndays  = Math.floor(uptime / 86400000);
	var nhours = uptime.getUTCHours();
	var nmins  = uptime.getUTCMinutes();
	var nsecn  = uptime.getUTCSeconds();
	
	var output = document.getElementById(tag);
	(output==null) ? {} : output.firstChild.nodeValue = ndays + " days, " + (nhours > 9 ? "" : "0") + nhours + ":" + (nmins > 9 ? "" : "0") + nmins + ":" + (nsecn > 9 ? "" : "0") + nsecn;
	
	setTimeout('updateuptime("'+tag+'", "'+booted+'")',1000);
}

function getAge(YearOfBirth, MonthOfBirth, DateOfBirth)
{
	// Months start from 0 with the JavaScript Date object
	--MonthOfBirth;
	
	var Now = new Date();
	var MyYears, MyMonths, MyDays;
	var TheYear = Now.getFullYear();
	MyMonths = Now.getMonth()+1;

	// If we're here, TheYear is now a full 4 digit date
	MyYears = TheYear - YearOfBirth;

	// Check to see if we've passed this person's birthday, if not, they're a year younger.
	if
	(
		(Now.getDate() < DateOfBirth )
		||
		(Now.getMonth()+1 <= MonthOfBirth)
	)
	{
		MyMonths = MyMonths + ( 11 - MonthOfBirth);
		MyYears--;
	}
	else
	{
		MyMonths = MyMonths - MonthOfBirth;
	}

	var ReturnString;

	// The checks are sad I know, but I'm an obsessive for details
	if (MyYears > 0)
	{
		// Fill in the years
		ReturnString = MyYears + " year";
		if (MyYears > 1)
			ReturnString = ReturnString + "s";
		
		// Rememember your punctuation
		ReturnString = ReturnString + " and ";
		
		// Fill in the months
		ReturnString = ReturnString + MyMonths + " month";
		if (MyMonths > 1)
			ReturnString = ReturnString + "s";
			
		ReturnString = ReturnString + " old";
	}
	else
		ReturnString = "Bit of an error, as you haven't been born yet. Hmm. You might want to look into that.";

	return ReturnString;
}