// JavaScript Document
function formatTime() {
  var now = new Date();
  var hour = now.getHours();
  var minute = now.getMinutes();
  var sec = now.getSeconds();
  
  day = now.getDate();

    if (minute <= 9) {
      minute = "0" + minute;
    }
    if (sec <= 9) {
      sec = "0" + sec;
    }
    if (hour > 12) {
      hour = hour - 12;
      add = " p.m.";
    } else {
      hour = hour;
      add = " a.m.";
    }
    if (hour == 12) {
      add = " p.m.";
    }
    if (hour == 00) {
      hour = "12";
    }
	
  var today = now.getDate();
  var month = now.getMonth();
  var monthName = new Array(12)
      monthName[0]="January";
      monthName[1]="February";
      monthName[2]="March";
      monthName[3]="April";
      monthName[4]="May";
      monthName[5]="June";
      monthName[6]="July";
      monthName[7]="August";
      monthName[8]="September";
      monthName[9]="October";
      monthName[10]="November";
      monthName[11]="December";
  var year = now.getFullYear();

    document.clock.date_time.value =  today + " " + monthName[month] + ", "+ year + "  " + ((hour<=9) ? "0" + hour : hour) + ":" + minute + ":" + sec + add;

  setTimeout("formatTime()", 1000);
}

window.onload=formatTime;

