var timerID = null;
var timerRunning = false;
function stopclock (){
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;}
function startclock () {
stopclock();
showtime();}
function showtime () {
var now = new Date();
var hkhours = now.getHours();
var tkhours = now.getHours() +2;
var ldhours = now.getHours() -8;
var nkhours = now.getHours() -13;
//var zjghours = now.getHours() -14;
var minutes = now.getMinutes();
var seconds = now.getSeconds();
var hktimeValue = "" +((hkhours <= 12 ) ? "香港" : " 香港" )
hktimeValue += (hkhours )
hktimeValue += ((minutes < 10) ? ":0" : ":") + minutes
hktimeValue += ((seconds < 10) ? ":0" : ":") + seconds
tktimeValue += ((hkhours >=23) ? hkhours -23  :hkhours +1)
var tktimeValue = "" +((tkhours <= 12) ? " 東京" : " 東京" )
tktimeValue += ((hkhours >=23) ? hkhours -23  :hkhours +1)
tktimeValue += ((minutes < 10) ? ":0" : ":") + minutes
tktimeValue += ((seconds < 10) ? ":0" : ":") + seconds
var ldtimeValue = "" +((hkhours -8 >= 12 ) ? " 倫敦" : " 倫敦" )
ldtimeValue += ((hkhours >=8) ? hkhours -8 :hkhours +16)
ldtimeValue += ((minutes < 10) ? ":0" : ":") + minutes
ldtimeValue += ((seconds < 10) ? ":0" : ":") + seconds
var nktimeValue = "" +((hkhours >= 12) ? " 紐約" : " 紐約" )
nktimeValue += ((hkhours >=13) ? hkhours -13 :hkhours +11)
nktimeValue += ((minutes < 10) ? ":0" : ":") + minutes
nktimeValue += ((seconds < 10) ? ":0" : ":") + seconds
//var zjgtimeValue = "" +((hkhours >= 12) ? "芝加哥時間 " : "芝加哥時間 " )
//zjgtimeValue += ((hkhours >=14) ? hkhours -14 :hkhours +10)
//zjgtimeValue += ((minutes < 10) ? ":0" : ":") + minutes
//zjgtimeValue += ((seconds < 10) ? ":0" : ":") + seconds
document.getElementById("clock1").innerHTML=hktimeValue;
document.getElementById("clock2").innerHTML=tktimeValue;
document.getElementById("clock3").innerHTML=ldtimeValue;
document.getElementById("clock4").innerHTML=nktimeValue;
//document.getElementById("clock5").innerHTML=zjgtimeValue;
timerID = setTimeout("showtime()",1000);
timerRunning = true;}
