
/* Returns the "st", "nd", "rd" or "nth" for a date x */

function nth(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";
   }


/* Inserts the local date in English in the id="theLocalDateIs" tag */

function getTheLocalDate () {

   var d = new Date()
   var weekday = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
   var monthname = new Array("January","February","March","April","May","June","July","August","September","October","November","December")

   var theDay   = weekday[d.getDay()];
   var theDate  = d.getDate();
   var theMonth = monthname[d.getMonth()];
   var theYear  = d.getFullYear();

   document.getElementById("theLocalDateIs").innerHTML = theDay + " the " + theDate + "<sup>" + nth(theDate) + "</sup>" + " of " + theMonth + " " +theYear;

   document.getElementById("thisYear").innerHTML = theYear;

   setTimeout("getTheLocalDate()",60000);
   }

