
function timeSource(){
   x=new Date(timeNow().getUTCFullYear(),timeNow().getUTCMonth(),timeNow().getUTCDate(),timeNow().getUTCHours(),timeNow().getUTCMinutes(),timeNow().getUTCSeconds());
   x.setTime(x.getTime()+daylightSaving()-18000000);
   return x;
}
function timeNow(){
   return new Date();
}
function daylightSaving(){
   return ((timeNow().getTime()>findDay(0,3,1,1).getTime())&&(timeNow().getTime()<findDay(0,9,1,-1).getTime()))?3600000:0;
}
function findDay(d,m,h,p){
   var week=(p<0)?7*(p+1):7*(p-1),nm=(p<0)?m+1:m,x=new Date(timeNow().getUTCFullYear(),nm,1,h,0,0),dOff=0;
   if(p<0){
      x.setTime(x.getTime()-86400000);
   }
   if(x.getDay()!=d){
      dOff=(x.getDay()<d)?(d-x.getDay()):0-(x.getDay()-d);
      if(p<0&&dOff>0){
         week-=7;
      }
      if(p>0&&dOff<0){
         week+=7;
      }
      x.setTime(x.getTime()+((dOff+week)*86400000));
   }
   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(){
//    window.status=''+eval(outputTime)+'';
//    document.title=''+eval(outputTime)+'';
   if(fr==0){
      fr=1;
      document.write('<font size=2 face=Arial color=FFFFFF><span id="tP">'+eval(outputTime)+'</span></font>');
   }
   tP.innerText=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('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
var monthNames=new Array('January','February','March','April','May','June','July','August','September','October','November','December');
var fr=0;
var outputTime="twelveHour(timeSource().getHours())+':'+leadingZero(timeSource().getMinutes())+':'+leadingZero(timeSource().getSeconds())+' '+amPMsymbol(timeSource().getHours())+' '+dayNames[timeSource().getDay()]+' '+timeSource().getDate()+dateEnding(timeSource().getDate())+' '+monthNames[timeSource().getMonth()]+' '+fixYear4(timeSource().getYear())";


/*
// Use the following within your HTML to Start/display your clock
// <script language="JavaScript">displayTime();</script>

// In .js File:
// No <tags>, only comments.  Code to run the clock is included in the script assuming you call the script using <script language="JavaScript" src="path/clock.js"></script> exactly where you want the clock in the flow of your HTML. 
*/ 

