//Display current day with appropriate Calendar entry by RJ Bigg (c)2002-3 robert.bigg@esmerk.com
// Easter Calculation modified from code by GM Arts 1997-1999 http://users.chariot.net.au/~gmarts/index.html
function intDiv (numr, divr)
// performs integer division numr/divr
{
   var negate = false;
   var result = 0;

   if (divr == 0)
      return null;
   else {
      if (numr * divr < 0 )
         negate = true;
      if (numr < 0)
         numr = -numr;
      if (divr < 0)
         divr = -divr;
      result = ((numr - (numr % divr)) / divr);
      if (negate)
         return -result;
      else
         return result;
   }
}
function EasterSunday(year)
{
   var g = 0;
   var c = 0;
   var h = 0;
   var i = 0;
   var j = 0;
   var p = 0;
   var d;
   var m;
   g = year % 19;
   c = intDiv(year, 100);
   h = (c - intDiv(c, 4) - intDiv(8 * c + 13, 25) + 19 * g + 15) % 30;
   i = h - intDiv(h, 28) * (1 - intDiv(h, 28) * intDiv(29, h + 1) * intDiv(21 - g, 11));
   j = (year + intDiv(year, 4) + i + 2 - c + intDiv(c, 4)) % 7;
   p = i - j + 28;

   d = p;
   m = 4;
   if (p > 31) {
      d = p - 31;
   } else {
      m = 3;
   }
   esm=m;
   esd=d
}
//Get Today's date
var td=new Date();
var nd;
var nm;
var nh="";
var gt="";
var dm=td.getMonth()+1;
var dd=td.getDate();
//Now calculate Easter & related moveable days
var y=td.getFullYear();
var esm;
var esd;
EasterSunday(y)
var es=new Date();
es.setMonth(esm-1);
es.setDate(esd);
es.setYear(y);
//Easter Sunday
sed=esd+"/"+esm;
//Ascension Day
es.setUTCMilliseconds(es.getUTCMilliseconds()+39*1000*60*60*24);
sad=es.getDate() + "/" + (es.getMonth()+1);
//Pentecost
es.setUTCMilliseconds(es.getUTCMilliseconds()+10*86400000);
sws=es.getDate() + "/" + (es.getMonth()+1);
//Trinity Sunday - added Feb 2007
es.setUTCMilliseconds(es.getUTCMilliseconds()+7*86400000);
sts=es.getDate() + "/" + (es.getMonth()+1);
//Corpus Christi
es.setUTCMilliseconds(es.getUTCMilliseconds()+4*86400000);
scc=es.getDate() + "/" + (es.getMonth()+1);
//goback to Easter day - adjusted from 49 days due to Corpus Christi addition
es.setUTCMilliseconds(es.getUTCMilliseconds()-60*86400000);
//goback to Easter day
//es.setUTCMilliseconds(es.getUTCMilliseconds()-49*86400000);
//Good Friday
es.setUTCMilliseconds(es.getUTCMilliseconds()-2*86400000);
sgf=es.getDate() + "/" + (es.getMonth()+1);
//Maundy Thursday
es.setUTCMilliseconds(es.getUTCMilliseconds()-1*86400000);
smt=es.getDate() + "/" + (es.getMonth()+1);
//Palm Sunday
es.setUTCMilliseconds(es.getUTCMilliseconds()-4*86400000);
sps=es.getDate() + "/" + (es.getMonth()+1);
//Mothering Sunday
es.setUTCMilliseconds(es.getUTCMilliseconds()-14*86400000);
sms=es.getDate() + "/" + (es.getMonth()+1);
//Ash Wednesday
es.setUTCMilliseconds(es.getUTCMilliseconds()-25*86400000);
saw=es.getDate() + "/" + (es.getMonth()+1);
//additional section for remainder of Holy Week & Easter Week - added April 2003
//Monday is +25 +14 +1
es.setUTCMilliseconds(es.getUTCMilliseconds()+40*86400000);
shm=es.getDate() + "/" + (es.getMonth()+1);
es.setUTCMilliseconds(es.getUTCMilliseconds()+86400000);
sht=es.getDate() + "/" + (es.getMonth()+1);
es.setUTCMilliseconds(es.getUTCMilliseconds()+86400000);
shw=es.getDate() + "/" + (es.getMonth()+1);
es.setUTCMilliseconds(es.getUTCMilliseconds()+3*86400000);
shs=es.getDate() + "/" + (es.getMonth()+1);
es.setUTCMilliseconds(es.getUTCMilliseconds()+2*86400000);
sem=es.getDate() + "/" + (es.getMonth()+1);
es.setUTCMilliseconds(es.getUTCMilliseconds()+86400000);
setu=es.getDate() + "/" + (es.getMonth()+1);
es.setUTCMilliseconds(es.getUTCMilliseconds()+86400000);
sew=es.getDate() + "/" + (es.getMonth()+1);
es.setUTCMilliseconds(es.getUTCMilliseconds()+86400000);
seth=es.getDate() + "/" + (es.getMonth()+1);
es.setUTCMilliseconds(es.getUTCMilliseconds()+86400000);
sef=es.getDate() + "/" + (es.getMonth()+1);
es.setUTCMilliseconds(es.getUTCMilliseconds()+86400000);
ses=es.getDate() + "/" + (es.getMonth()+1);
//That's it
switch(td.getDay()) {
case 0:
	nd="Sunday";
	break;
case 1:
	nd="Monday";
	break;
case 2:
	nd="Tuesday";
	break;
case 3:
	nd="Wednesday";
	break;
case 4:
	nd="Thursday";
	break;
case 5:
	nd="Friday";
	break;
default:
	nd="Saturday";
	break;
}
switch (dm) {
case 1:
	nm="January";
	break;
case 2:
	nm="February";
	break;
case 3:
	nm="March";
	break;
case 4:
	nm="April";
	break;
case 5:
	nm="May";
	break;
case 6:
	nm="June";
	break;
case 7:
	nm="July";
	break;
case 8:
	nm="August";
	break;
case 9:
	nm="September";
	break;
case 10:
	nm="October";
	break;
case 11:
	nm="November";
	break;
case 12:
	nm="December";
	break;
}
//Work out named days according to Lectionary Calendar, check for moveable days first
//does not allow for moved feast days, but Holy Week and Easter Week will take precedence
//http://www.cofe.anglican.org/commonworship/calendar/holydays.html
//and as revised by Fr John, May 2002
switch(dd+"/"+dm) {
case saw:
	nh="<span style='color: red;'><b>Ash Wednesday</b></span>";
	break;
case sms:
	nh="Mothering Sunday";
	break;
case sps:
	nh="<span style='color: red;'><b>Palm Sunday</b></span>";
	break;
case shm:
	nh="Monday in <span style='color: red;'>Holy Week</span>,";
	break;
case sht:
	nh="Tuesday in <span style='color: red;'>Holy Week</span>,";
	break;
case shw:
	nh="Wednesday in <span style='color: red;'>Holy Week</span>,";
	break;
case smt:
	nh="<span style='color: red;'><b>Maundy Thursday</b></span>";
	gt="";
	break;
case sgf:
	nh="<span style='color: red;'><b>Good Friday</b></span>";
	break;
case shs:
	nh="<span style='color: red;'>Holy</span> Saturday, Easter Eve";
	break;
case sed:
	nh="<span style='color: red;'><b>Easter Sunday</b></span>";
	gt="Happy Easter, Christ is Risen!";
	break;
case sem:
	nh="Monday in <span style='color: red;'>Easter Week</span>";
	gt="Happy Easter, Christ is Risen!";
	break;
case setu:
	nh="Tuesday in <span style='color: red;'>Easter Week</span>";
	gt="Happy Easter, Christ is Risen!";
	break;
case sew:
	nh="Wednesday in <span style='color: red;'>Easter Week</span>";
	gt="Happy Easter, Christ is Risen!";
	break;
case seth:
	nh="Thursday in <span style='color: red;'>Easter Week</span>";
	gt="Happy Easter, Christ is Risen!";
	break;
case sef:
	nh="Friday in <span style='color: red;'>Easter Week</span>";
	gt="Happy Easter, Christ is Risen!";
	break;
case ses:
	nh="Saturday in <span style='color: red;'>Easter Week</span>";
	gt="Happy Easter, Christ is Risen!";
	break;
case sad:
	nh="<span style='color: red;'><b>Ascension Day</b></span> "+nd;
	break;
case sws:
	nh="<span style='color: red;'>Pentecost</span> "+nd;
	break;
case sts:
	nh="<span style='color: red;'><b>Trinity Sunday</b></span> "+nd;
	break;
case scc:
	nh="<span style='color: red;'>Corpus Christi</span> "+nd;
	break;
case "1/1":
	nh="<span style='color: red;'>The Naming and Circumcision of Jesus</span> "+nd;
	gt="Happy New Year";
	break;
case "2/1":
	nh="SS Basil &amp; Gregory "+nd;
	gt="Happy New Year";
	break;
case "6/1":
	nh="<span style='color: red;'><b>The Epiphany</b></span> "+nd;
	gt="";
	break;
case "12/1":
	nh="St Aelred of Hexham "+nd;
	break;
case "13/1":
	nh="St Hilary "+nd;
	break;
case "17/1":
	nh="St Antony of Egypt "+nd;
	break;
case "19/1":
	nh="St Wulfstan "+nd;
	break;
case "21/1":
	nh="St Agnes "+nd;
	break;
case "24/1":
	nh="St Francis de Sales "+nd;
	break;
case "25/1":
	nh="<span style='color: red;'>The Conversion of Paul</span> "+nd;
	break;
case "26/1":
	nh="SS Timothy &amp; Titus "+nd;
	break;
case "28/1":
	nh="St Thomas Aquinas "+nd;
	break;
case "30/1":
	nh="St Charles, King & Martyr "+nd;
	break;
case "2/2":
	nh="<span style='color: red;'><b>The Presentation of Christ in the Temple</b> (Candlemas)</span> "+nd;
	break;
case "3/2":
	nh="St Anskar "+nd;
	break;
case "14/2":
	nh="SS Cyril &amp; Methodius "+nd;
	break;
case "17/2":
	nh="St Janani Luwum "+nd;
	break;
case "23/2":
	nh="St Polycarp "+nd;
	break;
case "27/2":
	nh="George Herbert "+nd;
	break;
case "1/3":
	nh="St David's Day "+nd;
	break;
case "2/3":
	nh="St Chad "+nd;
	break;
case "7/3":
	nh="SS Perpetua, Felicity and their Companions "+nd;
	break;
case "8/3":
	nh="Edward King "+nd;
	break;
case "17/3":
	nh="St Patrick's Day "+nd;
	break;
case "19/3":
	nh="<span style='color: red;'>St Joseph of Nazareth</span> "+nd;
	gt="";
	break;
case "20/3":
	nh="St Cuthbert "+nd;
	break;
case "21/3":
	nh="Thomas Cranmer "+nd;
	break;
case "25/3":
	nh="<span style='color: red;'><b>The Annunciation</b> of Our Lord to the Blessed Virgin Mary</span> "+nd;
	break;
case "10/4":
	nh="William Law "+nd;
	break;
case "19/4":
	nh="St Alphege "+nd;
	gt="";
	break;
case "21/4":
	nh="St Anselm "+nd;
	break;
case "23/4":
	nh="<span style='color: red;'>St George's Day</span> "+nd;
	break;
case "25/4":
	nh="<span style='color: red;'>St Mark the Evangelist</span> "+nd;
	break;
case "29/4":
	nh="St Catherine of Siena "+nd;
	break;
case "1/5":
	nh="<span style='color: red;'>SS Philip &amp; James, Apostles</span> "+nd;
	break;
case "2/5":
	nh="St Athanasius "+nd;
	break;
case "4/5":
	nh="English Saints and Martyrs of the Reformation Era "+nd;
	break;
case "8/5":
	nh="St Julian of Norwich "+nd;
	break;
case "14/5":
	nh="<span style='color: red;'>St Matthias the Apostle</span> "+nd;
	break;
case "19/5":
	nh="St Dunstan "+nd;
	break;
case "20/5":
	nh="St Alcuin of York "+nd;
	break;
case "25/5":
	nh="St Bede the Venerable "+nd;
	break;
case "26/5":
	nh="St Augustine "+nd;
	break;
case "31/5":
	nh="<span style='color: red;'>The Visit of the Blessed Virgin Mary to Elizabeth</span> "+nd;
	break;
case "1/6":
	nh="St Justin "+nd;
	break;
case "5/6":
	nh="St Boniface "+nd;
	break;
case "9/6":
	nh="St Columba "+nd;
	break;
case "11/6":
	nh="<span style='color: red;'>St Barnabas the Apostle</span> "+nd;
	break;
case "16/6":
	nh="St Richard "+nd;
	break;
case "22/6":
	nh="St Alban "+nd;
	break;
case "23/6":
	nh="St Etheldreda "+nd;
	break;
case "24/6":
	nh="<span style='color: red;'>The Birth of John the Baptist</span> "+nd;
	break;
case "28/6":
	nh="St Irenĉus "+nd;
	break;
case "29/6":
	nh="<span style='color: red;'>SS Peter &amp; Paul, Apostles</span> "+nd;
	break;
case "3/7":
	nh="<span style='color: red;'>St Thomas the Apostle</span> "+nd;
	break;
case "11/7":
	nh="St Benedict of Nursia "+nd;
	break;
case "14/7":
	nh="John Keble "+nd;
	break;
case "15/7":
	nh="St Swithun "+nd;
	break;
case "19/7":
	nh="St Gregory of Nyssa "+nd;
	break;
case "22/7":
	nh="<span style='color: red;'>St Mary Magdalene</span> "+nd;
	break;
case "25/7":
	nh="<span style='color: red;'>St James the Apostle</span> "+nd;
	break;
case "26/7":
	nh="SS Anne &amp; Joachim "+nd;
	break;
case "29/7":
	nh="SS Mary, Martha &amp; Lazarus "+nd;
	break;
case "5/8":
	nh="St Oswald "+nd;
	break;
case "6/8":
	nh="<span style='color: red;'>The Transfiguration of our Lord</span> "+nd;
	break;
case "8/8":
	nh="St Dominic "+nd;
	break;
case "10/8":
	nh="St Laurence "+nd;
	break;
case "11/8":
	nh="St Clare of Assisi "+nd;
	break;
case "15/8":
	nh="<span style='color: red;'>The Blessed Virgin Mary</span> "+nd;
	break;
case "20/8":
	nh="St Bernard "+nd;
	break;
case "24/8":
	nh="<span style='color: red;'>St Bartholomew the Apostle</span> "+nd;
	break;
case "27/8":
	nh="St Monica "+nd;
	break;
case "28/8":
	nh="St Augustine of Hippo "+nd;
	break;
case "29/8":
	nh="The Beheading of John the Baptist "+nd;
	break;
case "31/8":
	nh="St Aidan "+nd;
	break;
case "3/9":
	nh="St Gregory the Great "+nd;
	break;
case "8/9":
	nh="The Birth of the Blessed Virgin Mary "+nd;
	break;
case "13/9":
	nh="St John Chrysostom "+nd;
	break;
case "14/9":
	nh="<span style='color: red;'>Holy Cross Day</span> "+nd;
	break;
case "15/9":
	nh="St Cyprian "+nd;
	break;
case "16/9":
	nh="St Ninian "+nd;
	break;
case "17/9":
	nh="St Hildegard of Bingen "+nd;
	break;
case "21/9":
	nh="<span style='color: red;'>St Matthew, Apostle and Evangelist</span> "+nd;
	break;
case "25/9":
	nh="Lancelot Andrewes "+nd;
	break;
case "27/9":
	nh="St Vincent de Paul "+nd;
	break;
case "29/9":
	nh="<span style='color: red;'>St Michael and All Angels</span> "+nd;
	break;
case "4/10":
	nh="St Francis of Assisi "+nd;
	break;
case "10/10":
	nh="St Paulinus "+nd;
	break;
case "12/10":
	nh="St Wilfred of Ripon "+nd;
	break;
case "13/10":
	nh="St Edward the Confessor "+nd;
	break;
case "15/10":
	nh="St Teresa of Avila "+nd;
	break;
case "17/10":
	nh="St Ignatius "+nd;
	break;
case "18/10":
	nh="<span style='color: red;'>St Luke the Evangelist</span> "+nd;
	break;
case "26/10":
	nh="St Alfred the Great "+nd;
	break;
case "28/10":
	nh="<span style='color: red;'>SS Simon &amp; Jude, Apostles</span> "+nd;
	break;
case "1/11":
	nh="<span style='color: red;'><b>All Saints' Day</b></span> "+nd;
	break;
case "2/11":
	nh="All Souls' Day "+nd;
	break;
case "7/11":
	nh="St Willibrord of York "+nd;
	break;
case "8/11":
	nh="The Saints &amp; Martyrs of England "+nd;
	break;
case "10/11":
	nh="St Leo the Great "+nd;
	break;
case "11/11":
	nh="St Martin "+nd;
	break;
case "16/11":
	nh="St Margaret "+nd;
	break;
case "17/11":
	nh="St Hugh "+nd;
	break;
case "18/11":
	nh="St Elizabeth of Hungary "+nd;
	break;
case "19/11":
	nh="St Hilda "+nd;
	break;
case "20/11":
	nh="St Edmund "+nd;
	break;
case "23/11":
	nh="St Clement "+nd;
	break;
case "30/11":
	nh="<span style='color: red;'>St Andrew's Day</span> "+nd;
	break;
case "6/12":
	nh="St Nicholas "+nd;
	break;
case "7/12":
	nh="St Ambrose "+nd;
	break;
case "8/12":
	nh="The Conception of the Blessed Virgin Mary "+nd;
	break;
case "13/12":
	nh="St Lucy "+nd;
	break;
case "14/7":
	nh="St John of the Cross "+nd;
	break;
case "24/12":
	nh="Christmas Eve "+nd;
	break;
case "25/12":
	nh="<span style='color: red;'><b>Christmas Day</b></span> "+nd;
	gt="Happy Christmas";
	break;
case "26/12":
	nh="<span style='color: red;'>St Stephen's Day</span> "+nd;
	gt="Happy Christmas";
	break;
case "27/12":
	nh="<span style='color: red;'>St John, Apostle and Evangelist</span> "+nd;
	gt="Happy Christmas";
	break;
case "28/12":
	nh="<span style='color: red;'>The Holy Innocents</span> "+nd;
	gt="Happy Christmas";
	break;
case "29/12":
	nh="St Thomas Becket "+nd;
	gt="Happy Christmas";
	break;
case "30/12":
	nh=""+nd;
	gt="Happy Christmas";
	break;
case "31/12":
	nh=""+nd;
	gt="Happy Christmas";
	break;
default:
	nh=nd;
	break;
}
document.write(nh+" "+dd+" "+nm+" "+td.getFullYear()+" "+gt);
