var flg=0;
today=new Date();
M=new Array("Jan","Feb","March","April","May","June","July","August","Sept","Oct","Nov","Dec");
D=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");

function xGetElementById(e) {
    if(typeof(e)!='string') return e;
    if(document.getElementById) e=document.getElementById(e);
    else if(document.all) e=document.all[e];
    else e=null;
    return e;
}
function tick() {
  var hours, minutes, seconds, ap;
  var intHours, intMinutes, intSeconds;
  var today;

  today = new Date();

  intHours = today.getHours();
  intMinutes = today.getMinutes();
  intSeconds = today.getSeconds();

  if (intHours == 0) {
	 hours = "12:";
	 ap = "Midnight";
  } else if (intHours < 12) { 
	 hours = intHours+":";
	 ap = "a.m.";
  } else if (intHours == 12) {
	 hours = "12:";
	 ap = "Noon";
  } else {
	 intHours = intHours - 12
	 hours = intHours + ":";
	 ap = "p.m.";
  }

  if (intMinutes < 10) {
	 minutes = "0"+intMinutes+" ";
  } else {
	 minutes = intMinutes+" ";
  }

  if (intSeconds < 10) {
	 seconds = "0"+intSeconds+" ";
  } else {
	 seconds = intSeconds+" ";
  } 

  timeString = hours+minutes+ap; //+seconds

  xGetElementById('clock').innerHTML = timeString;

  window.setTimeout("tick();", 59000);
}