function IfZero(num) {
return ((num <= 9) ? ("0" + num) : num);
}
function check24(hour) {
return (hour >= 24) ? hour - 24 : hour;
}

function displaydatetime() {
if (!document.layers && !document.all)	return;
  
  //clock value
  var dt = new Date();
  var zone=-05;
  var def = dt.getTimezoneOffset()/60;
  var gmt = (dt.getHours() + def);
  var ending = ":" + IfZero(dt.getMinutes()) + ":" +  IfZero(dt.getSeconds());
  var kok =check24(((gmt +zone ) > 24) ? ((gmt +zone ) - 24) : (gmt + zone));
  var time=IfZero(kok) + ending;

  // display part
  if (document.layers) {
    document.layers.clockLocal.document.write(time);
    document.layers.clockLocal.document.close();
	}
  else if (document.all) {
  clockLocal.innerHTML = time;
  }
  setTimeout("displaydatetime()", 500)
}
  window.onload = displaydatetime;
