function runClock()

{

	var autoupdate	= 1;	// 0 = STATIC CLOCK, 1 = DYNAMIC CLOCK

	var timesystem	= 1;	// 0 = USER'S TIME, 1 = UNIVERSAL TIME (GMT/UTC)

	var twelvehour	= 1;	// 0 = 24 HOUR CLOCK, 1 = 12 HOUR CLOCK

	var padhours	= 0;	// 0 = DO NOT ZERO-PAD HOURS (EG. 6), 1 = ZERO PAD HOURS (EG. 06)

	var offset		= 10;	// NUMBER OF HOURS TO OFFSET THE TIME



	// DISPLAY TEXT FOR WEEKDAYS AND MONTHS:

	var days		= new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");

	var months		= new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");



	// TEMPLATE FOR THE DATE AND TIME DISPLAY:

	// {day} {date} {suffix} {month} {year} {hours} {minutes} {seconds} {ampm}

	var template	= "{day}, {date}{suffix} {month}, {year} {hours}:{minutes}:{seconds} {ampm}";







	// NO CONFIGURATION OPTIONS BELOW THIS POINT

	

	var currentTime = new Date((new Date()).valueOf() + (offset*60*60*1000))

	if (timesystem)

	{

		var hours	= currentTime.getUTCHours();

		var minutes	= currentTime.getUTCMinutes();

		var seconds	= currentTime.getUTCSeconds();

		var day		= days[currentTime.getUTCDay()];

		var date	= currentTime.getUTCDate();

		var month	= months[currentTime.getUTCMonth()];

		var year	= currentTime.getUTCFullYear();

	} else {

		var hours	= currentTime.getHours();

		var minutes	= currentTime.getMinutes();

		var seconds	= currentTime.getSeconds();

		var day		= days[currentTime.getDay()];

		var date	= currentTime.getDate();

		var month	= months[currentTime.getMonth()];

		var year	= currentTime.getFullYear();

	}

	template = template.replace(/\{ampm\}/g, (hours > 11) ? "PM" : "AM");

	if (hours > 12 && twelvehour) { hours = hours - 12; }

	template = template.replace(/\{hours\}/g, padhours ? padder(hours) : hours);

	template = template.replace(/\{minutes\}/g, padder(minutes));

	template = template.replace(/\{seconds\}/g, padder(seconds));

	template = template.replace(/\{day\}/g, day);

	template = template.replace(/\{date\}/g, date);

	template = template.replace(/\{suffix\}/g, dateSuffix(date));

	template = template.replace(/\{month\}/g, month);

	template = template.replace(/\{year\}/g, year);

	document.getElementById('itronclock').innerHTML = template;

	if (autoupdate) { setTimeout("runClock()",1000); }

}



function padder(num)

{

	return (num < 10) ? "0" + num : num;

}



function dateSuffix(n) 

{ 

	return ["th","st","nd","rd"][(!( ((n%10) >3) || (Math.floor(n%100/10)==1)) ) * (n%10)];  

}  

