

/*
Drop Down World Clock- By JavaScript Kit (http://www.javascriptkit.com)
Portions of code by Kurt @ http://www.btinternet.com/~kurt.grigg/javascript
Modified by Harry Armadillo of www.codingforums.com
This credit notice must stay intact
*/

if (document.all||document.getElementById)
  document.write('<span id="worldclock" style="font:normal 18px Arial; margin-right:5px; color:#f58125;"></span><br>')

zone=0;
isitlocal=true;
ampm='';

function updateclock(z){
  zone=5.5;
  isitlocal=(z.options[0].selected)?true:false;
  }

function WorldClock(){
  var carry=0,now=new Date();
  var ofst=now.getTimezoneOffset();
  var secs=now.getSeconds();
  var mins=(isitlocal)?now.getMinutes():now.getMinutes() + ofst + (parseFloat(zone)-parseInt(zone))*60;
  while(mins<0){mins+=60;carry-=1};
  while(mins>=60){mins-=60;carry+=1};
  var hr=(isitlocal)?now.getHours():now.getHours() + parseInt(zone) +carry;
  if (hr < 0) hr+=24;
  if (hr > 23) hr-=24;
  statusampm = (hr > 11)?"pm":"am";
  if (hr == 0) hr=12;
  (hr < 13)?hr:hr %= 12;
  if (hr<10) hr="0"+hr

  var finaltime=hr+':'+((mins < 10)?"0"+mins:mins)+':'+((secs < 10)?"0"+secs:secs)+' '+statusampm;

  if (document.all)
    worldclock.innerHTML=finaltime
  else if (document.getElementById)
    document.getElementById("worldclock").innerHTML=finaltime
  else if (document.layers){
    document.worldclockns.document.worldclockns2.document.write(finaltime)
    document.worldclockns.document.worldclockns2.document.close()
    }
  setTimeout('WorldClock()',1000);
  }

window.onload=WorldClock
//-->


