var flashingdots = 0;

function zClock()
{
	var flashingdots=1;
	var ampm = 0;
	var now = new Date();
	var hours = now.getHours();
	var minutes = now.getMinutes();
	var seconds = now.getSeconds();
	var ztime;

	if (hours < 12) ampm="am";
	else if (hours > 11) ampm="pm";

	if (hours==0) hours=hours+12; // If Midnight is coming up as Zero O'Clock, then fix it.
	else if (hours > 12) hours=hours-12; // If 1:00pm is coming up as 13 O'Clock, then fix it.

	if (minutes < 10) minutes="0"+minutes; // If 3:05 is showing up as 3:5, then fix it.

	if (seconds < 10) seconds="0"+seconds; // If 7:25:02 is showing up as 7:25:2, then fix it.

	if (flashingdots == 1) { ztime=hours+':'+minutes+':'+seconds+ampm; flashingdots=0; }
	else if (flashingdots == 0) { ztime=hours+'<span style="visibility:hidden;">:</span>'+minutes+'<span style="visibility:hidden;">:</span>'+seconds+ampm; flashingdots=1; }
	else { flashingdots=1; }

	document.getElementById("zClockID").innerHTML=ztime;

	setTimeout("zClock();", 500);
}

function xDate(disp)
{
	rightNow = new Date();
	year = rightNow.getFullYear();
	date = rightNow.getDate();
	thisDay = rightNow.getDay();
	thisMonth = rightNow.getMonth();
	allDaysLong=new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
	allDaysShort=new Array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
	allMonthsLong=new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
	allMonthsShort=new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec');
	var todayis;
	
	if (disp==30||disp==31||disp==32||disp==33) thisMonth++;

	else
	{
		if (parseInt(disp) > 19 && parseInt(disp) < 30)
		{
			allMonthsLong[thisMonth]=allMonthsLong[thisMonth].toUpperCase();
			allDaysLong[thisDay]=allDaysLong[thisDay].toUpperCase();
			allMonthsShort[thisMonth]=allMonthsShort[thisMonth].toUpperCase();
			allDaysShort[thisDay]=allDaysShort[thisDay].toUpperCase();
		}
	}

	if (disp == '0') todayis='&nbsp;';
	else if (disp == '10') todayis=allDaysLong[thisDay]+', '+allMonthsLong[thisMonth]+' '+date+', '+year;
	else if (disp == '11') todayis=allMonthsLong[thisMonth]+' '+date+', '+year;
	else if (disp == '12') todayis=allMonthsLong[thisMonth]+' '+date;
	else if (disp == '13') todayis=allDaysLong[thisDay];
	else if (disp == '14') todayis=allMonthsLong[thisMonth];
	else if (disp == '15') todayis=allDaysShort[thisDay]+', '+allMonthsShort[thisMonth]+' '+date+', '+year;
	else if (disp == '16') todayis=allMonthsShort[thisMonth]+' '+date+', '+year;
	else if (disp == '17') todayis=allMonthsShort[thisMonth]+' '+date;
	else if (disp == '18') todayis=allDaysShort[thisDay];
	else if (disp == '19') todayis=allMonthsShort[thisMonth];
	else if (disp == '20') todayis=allDaysLong[thisDay]+', '+allMonthsLong[thisMonth]+' '+date+', '+year;
	else if (disp == '21') todayis=allMonthsLong[thisMonth]+' '+date+', '+year;
	else if (disp == '22') todayis=allMonthsLong[thisMonth]+' '+date;
	else if (disp == '23') todayis=allDaysLong[thisDay];
	else if (disp == '24') todayis=allMonthsLong[thisMonth];
	else if (disp == '25') todayis=allDaysShort[thisDay]+', '+allMonthsShort[thisMonth]+' '+date+', '+year;
	else if (disp == '26') todayis=allMonthsShort[thisMonth]+' '+date+', '+year;
	else if (disp == '27') todayis=allMonthsShort[thisMonth]+' '+date;
	else if (disp == '28') todayis=allDaysShort[thisDay];
	else if (disp == '29') todayis=allMonthsShort[thisMonth];
	else if (disp == '30') todayis=thisMonth+'/'+date+'/'+year;
	else if (disp == '31') todayis=date+'/'+thisMonth+'/'+year;
	else if (disp == '32') todayis=thisMonth+'/'+date;
	else if (disp == '33') todayis=date+'/'+thisMonth;
	else if (disp == '5') todayis=date;
	else if (disp == '6') todayis=year;
	else todayis='Error: xDate(?);';

	return todayis;
}

