function timeNow()
{
	seconds = seconds+1;
	if (seconds>59)
	{
		seconds=seconds-60;
		minutes=minutes+1;
		if (minutes>59)
		{
			minutes=0;
			hours=hours+1;

			if (hours==24)
			{
				document.location.href=document.location.href;
			}
		}
	}

	if (hours>11)
	{
		ampm='PM';
	}

	if (hours>12)
	{
		showhours=hours-12;
	}
	else if(hours==0)
	{
		showhours=12;
	}
	else
	{
		showhours=hours;
	}

	timeStr = showhours;
	timeStr  += ((minutes < 10) ? ":0" : ":") + minutes;
	timeStr  += ((seconds < 10) ? ":0" : ":") + seconds + ' ' + ampm;

	if (document.layers)
	{
		document.ClockTag.document.write(timeStr);
		document.ClockTag.document.close();
	}
	else
	{
		document.getElementById('ClockTag').innerHTML = timeStr;
	}
}

setInterval("timeNow()",997)