var clock = 0;
function UpdateClock() {
if(clock) {
clearTimeout(clock);
clock = 0;
}
document.getElementById('clock').innerHTML = ReplaceNumbers(GetTime());
clock = setTimeout("UpdateClock()", 1000);
}
function StartClock() {
clock = setTimeout("UpdateClock()", 500);
}
function GetTime(){
var tDate = new Date();
hour = ''+tDate.getHours();
minutes = ''+tDate.getMinutes();
seconds = ''+tDate.getSeconds();
if(hour.length == 1){ hour = '0'+hour; }
if(minutes.length == 1){ minutes = '0'+minutes; }
if(seconds.length == 1){ seconds = '0'+seconds; }
return hour+':'+minutes+':'+seconds;
}
function ReplaceNumbers(string){
string = string.replace(/0/g,'
');
string = string.replace(/1/g,'
');
string = string.replace(/2/g,'
');
string = string.replace(/3/g,'
');
string = string.replace(/4/g,'
');
string = string.replace(/5/g,'
');
string = string.replace(/6/g,'
');
string = string.replace(/7/g,'
');
string = string.replace(/8/g,'
');
string = string.replace(/9/g,'
');
string = string.replace(/:/g,'
');
return string;
}
function KillClock() {
if(clock) {
clearTimeout(clock);
clock = 0;
}
}