
function timeSource(){
   x=new Date();
   x.setTime(x.getTime());
   return x;
}
function leadingZero(x){
   return (x>9)?x:'0'+x;
}
function twelveHour(x){
   if(x==0){
      x=12;
   }
   return (x>12)?x-=12:x;
}
function dateEnding(x){
   if(x==1||x==21||x==31){
      return 'st';
   }
   if(x==2||x==22){
      return 'nd';
   }
   if(x==3||x==23){
      return 'rd';
   }
   return 'th';
}
function displayTime(){
   if(fr==0){
      fr=1;
      document.write('<span id="tP">'+eval(outputTime)+'</span>');
   }
   document.getElementById("tP").innerHTML=eval(outputTime);
   setTimeout("displayTime()",1000);
}
function amPMsymbol(x){
   return (x>11)?'PM':'AM';
}
function fixYear4(x){
   return (x<500)?x+1900:x;
}
var dayNames=new Array('Sun','Mon','Tue','Wed','Thur','Fri','Sat');
var monthNames=new Array('Jan','Feb','March','April','May','June','July','Aug','Sept','Oct','Nov','Dec');
var fr=0;
var outputTime="dayNames[timeSource().getDay()]+','+' '+monthNames[timeSource().getMonth()]+' '+timeSource().getDate()+dateEnding(timeSource().getDate())+','+' '+fixYear4(timeSource().getYear())+' '+' '+' '+' '+' '+' '+' '+twelveHour(timeSource().getHours())+':'+leadingZero(timeSource().getMinutes())+' '+amPMsymbol(timeSource().getHours())";





