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 xnhours = now.getHours() +3;

var fkhours = now.getHours() -7;

var prhours = now.getHours() -7;

var minutes = now.getMinutes();

var seconds = now.getSeconds();

var hktimeValue = "" +((hkhours <= 12 ) ? "<b>Hong Kong</b> " : "<b>Hong Kong </b>" )

hktimeValue += (hkhours +1)

hktimeValue += ((minutes < 10) ? ":0" : ":") + minutes

hktimeValue += ((seconds < 10) ? ":0" : ":") + seconds



var bjtimeValue = "" +((hkhours <= 12 ) ? "<b>Ha Noi</b> " : "<b>Ha Noi </b>" )

bjtimeValue += (hkhours )

bjtimeValue += ((minutes < 10) ? ":0" : ":") + minutes

bjtimeValue += ((seconds < 10) ? ":0" : ":") + seconds



var tktimeValue = "" +((tkhours <= 12) ? "<b>Tokyo</b> " : "<b>Tokyo </b>" )

tktimeValue += ((hkhours >=23) ? hkhours -23  :hkhours +2)

tktimeValue += ((minutes < 10) ? ":0" : ":") + minutes

tktimeValue += ((seconds < 10) ? ":0" : ":") + seconds

var ldtimeValue = "" +((hkhours -7 >= 12 ) ? "<b>GMT </b>" : "<b>GMT </b>" )

ldtimeValue += ((hkhours >=7) ? hkhours -7 :hkhours +16)

ldtimeValue += ((minutes < 10) ? ":0" : ":") + minutes

ldtimeValue += ((seconds < 10) ? ":0" : ":") + seconds

var nktimeValue = "" +((hkhours >= 12) ? "<b>New York </b>" : "<b>New York </b>" )

nktimeValue += ((hkhours >=11) ? hkhours -11 :hkhours +11)

nktimeValue += ((minutes < 10) ? ":0" : ":") + minutes

nktimeValue += ((seconds < 10) ? ":0" : ":") + seconds

var xntimeValue = "" +((hkhours +3 <= 12) ? "Sydney " : "<b>Sydney </b>" )

xntimeValue += ((hkhours >=20) ? hkhours -20 :hkhours +3)

xntimeValue += ((minutes < 10) ? ":0" : ":") + minutes

xntimeValue += ((seconds < 10) ? ":0" : ":") + seconds

var fktimeValue = "" +((hkhours -5 <= 12) ? "<b>London</b> " : "<b>London </b>" )

fktimeValue += ((hkhours >=6) ? hkhours -6  :hkhours +17)

fktimeValue += ((minutes < 10) ? ":0" : ":") + minutes

fktimeValue += ((seconds < 10) ? ":0" : ":") + seconds
var dbtimeValue = "" +((hkhours -5 <= 12) ? "Dubai " : "<b>Dubai </b>" )

dbtimeValue += ((hkhours >=3) ? hkhours -3  :hkhours +17)

dbtimeValue += ((minutes < 10) ? ":0" : ":") + minutes

dbtimeValue += ((seconds < 10) ? ":0" : ":") + seconds
var bltimeValue = "" +((hkhours -5 <= 12) ? "Berlin " : "<b>Berlin </b>" )

bltimeValue += ((hkhours >=5) ? hkhours -5  :hkhours +19)

bltimeValue += ((minutes < 10) ? ":0" : ":") + minutes

bltimeValue += ((seconds < 10) ? ":0" : ":") + seconds
var cctimeValue = "" +((hkhours -5 <= 12) ? "Chicago" : "<b>Chicago</b>" )

cctimeValue += ((hkhours >=12) ? hkhours -12  :hkhours +19)

cctimeValue += ((minutes < 10) ? ":0" : ":") + minutes

cctimeValue += ((seconds < 10) ? ":0" : ":") + seconds


document.getElementById("clock").innerHTML = hktimeValue;
document.getElementById("clock1").innerHTML = tktimeValue;
document.getElementById("clock2").innerHTML = ldtimeValue;
document.getElementById("clock3").innerHTML = nktimeValue;
//document.getElementById("clock4").innerHTML = xntimeValue;
document.getElementById("clock5").innerHTML = fktimeValue;
document.getElementById("clock6").innerHTML = bjtimeValue;
//document.getElementById("clock7").innerHTML = dbtimeValue;
//document.getElementById("clock8").innerHTML = bltimeValue;
//document.getElementById("clock9").innerHTML = cctimeValue;

timerID = setTimeout("showtime()",1000);

timerRunning = true;}
