// JScript source code

var arrImages = new Array();
var arrNumbers = new Array();
function Clock()
{
	var booStop = new Boolean(false);
	
	
	//Set default graphics for numbers
	arrNumbers['0'] = 'gfx/numbers/0.gif';
	arrNumbers['1'] = 'gfx/numbers/1.gif';
	arrNumbers['2'] = 'gfx/numbers/2.gif';
	arrNumbers['3'] = 'gfx/numbers/3.gif';
	arrNumbers['4'] = 'gfx/numbers/4.gif';
	arrNumbers['5'] = 'gfx/numbers/5.gif';
	arrNumbers['6'] = 'gfx/numbers/6.gif';
	arrNumbers['7'] = 'gfx/numbers/7.gif';
	arrNumbers['8'] = 'gfx/numbers/8.gif';
	arrNumbers['9'] = 'gfx/numbers/9.gif';
	arrNumbers[':'] = 'gfx/numbers/col.gif';
			
	this.start = start;
	this.images = arrImages;
	this.numbers = arrNumbers;

	function start()
	{
		var strTime = new String();
		var datDate = new Date();
		
		//Hour
		if(datDate.getHours() < 10)
			strTime += '0';
		strTime += datDate.getHours();
		
		strTime += ':';
		
		//Minutes
		if(datDate.getMinutes() < 10)
			strTime += '0';
		strTime += datDate.getMinutes();

		var strTest = new String()
		
		
		
		//Set images to the time		
		for(i=0;i<=4;i++)
		{
			
			if(arrImages[i].src.indexOf(arrNumbers[strTime.charAt(i)]) == -1)
				arrImages[i].src = arrNumbers[strTime.charAt(i)];
		}
		if(booStop == false)
			setTimeout(start,1000);
	}
	
	function stop()
	{
		booStop = true;
	}

}

