function calc_good_friday(y)
{
   var m, d;
   var FirstDig, Remain19, temp;
   var tA, tB, tC, tD, tE;

   FirstDig = Math.floor(y / 100);
   Remain19 = y % 19;

   // calculate Pascal Full Moon date
   temp = Math.floor((FirstDig - 15) / 2) + 202 - 11 * Remain19;


   if ([21, 24, 25, 27, 28, 29, 30, 31, 32, 34, 35, 38].indexOf(FirstDig) > -1)
   {temp = temp - 1;}
   else if ([33, 36, 37, 39, 40].indexOf(FirstDig) > -1)
   {temp = temp - 2;}

   temp = temp % 30;
   tA = temp + 21;

   if (temp == 29)
   {tA = tA - 1;}

   if (temp == 28 && Remain19 > 10)
   {tA = tA - 1;}

   // find the next Sunday
   tB = (tA - 19) % 7;
   tC = (40 - FirstDig) % 4;

   if (tC == 3)
   {tC = tC + 1;}

   if (tC > 1)
   {tC = tC + 1;}

   temp = y % 100;
   tD = (temp + Math.floor(temp / 4)) % 7;
   tE = ((20 - tB - tC - tD) % 7) + 1;
   d = tA + tE;

   // we want Good friday, not Easter (Sunday)
   d -= 2;

   if (d > 31)
   {d -= 31;
    m = 4;}
   else
   {m = 3;}
   return [m, d];
}