//   Sumo Forum Dual-time Clock v1.3
//    for www.sumoforum.net by Exil
// Some rights reserved (cc-by-sa/2.5)

function c_init() {
 msgstr = '<br />See more time zones @ <a href="http://www.timeanddate.com/worldclock/" target="_blank">World Clock</a>';

 if (document.getElementById) {
  document.getElementById("note").innerHTML = msgstr;
 } else if (document.all) {
  note.innerHTML = msgstr;
 }

 c_update();
}

function c_format(t) {
 t -= 0;
 t = parseInt(t / 1000);
 var s = t % 60;
 var m = parseInt(t / 60) % 60;
 var h = parseInt(t / 3600) % 24;

 return (h < 10 ? '0' + h : h) + ':' + (m < 10 ? '0' + m : m) + ':' + (s < 10 ? '0' + s : s);
}

function c_update() {
 var local = new Date();
 var japan = local - (60000 * 60 * -9);
 local -= (local.getTimezoneOffset() * 60000);

 if (document.getElementById) {
  document.getElementById("zulu").innerHTML = 'Local: ' + c_format(local) + ' &middot; ';
  document.getElementById("jst").innerHTML = 'JST: ' + c_format(japan);
 } else if (document.all) {
  zulu.innerHTML = 'Local: ' + c_format(local) + ' ';
  jst.innerHTML = 'JST: ' + c_format(japan);
 }

 setTimeout('c_update()', 1000);
}
