var timerID = null;
var timerRunning = false;
function convertToUnicode(s)
{
	return s.replace(/0/g, '\u06F0').replace(/1/g, '\u06F1').replace(/2/g, '\u06F2').replace(/3/g, '\u06F3').replace(/4/g, '\u06F4').replace(/5/g, '\u06F5').replace(/6/g, '\u06F6').replace(/7/g, '\u06F7').replace(/8/g, '\u06F8').replace(/9/g, '\u06F9');
}
function stopclock ()
{
	if(timerRunning) 
	{
		clearTimeout(timerID);
	}
    timerRunning = false;
}

function startclock (containerID) 
{
	stopclock();
	showtime(containerID);
}

function showtime (containerID) 
{
	var now = new Date();
	var hours = now.getHours();
	var minutes = now.getMinutes();
    var seconds = now.getSeconds();
	var timeValue = "" + hours;
	if (seconds % 2 == 0)
	{
		timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
	}
	else
	{
		timeValue += ((minutes < 10) ? " 0" : " ") + minutes;
	}
	
	var container = MM_findObj(containerID);
	if (container)
	{
		container.innerHTML = convertToUnicode(timeValue);
		timerID = setTimeout("showtime('" + containerID + "')", 1000);
		timerRunning = true;
	}
}
