function leapYear()
{
 year=new Date().getYear()
 leap = (year - Math.floor(year/4)*4 == 0)
 centuryYear = (year - Math.floor(year/100)*100 == 0)
 if(centuryYear && leap){if ((year - Math.floor(year/400)*400) != 0)leap =!leap}
 if(leap)return 1
 return 0
}

function createArray(n) { this.length = n }   // create an array object

theMonth = new createArray(12)
theMonth[0]  = 31
theMonth[1]  = 28+leapYear()
theMonth[2]  = 31
theMonth[3]  = 30
theMonth[4]  = 31
theMonth[5]  = 30
theMonth[6]  = 31
theMonth[7]  = 31
theMonth[8]  = 30
theMonth[9]  = 31
theMonth[10] = 30
theMonth[11] = 31

function dayNumber(datex){  // count the days to Date
  lday = datex.getDate()     // date of the month (1-31)
  month = datex.getMonth()  // month of the year (0-11)
  dayno = 0
  for (i=0; i<month; i++)
  { dayno=dayno+theMonth[i] }
  return dayno+lday
}

thisday = new Date()

thisMonth = thisday.getMonth()+1    // 1-12
thisdayNo = dayNumber(thisday)

// Invariant dates ---------------------------------------------- //

// Independence Day
independenceDayDate = new Date("July 4, 2000 0:0:0")

// Assumption
assumptionDate = new Date("August 15, 2000 0:0:0")

// Immaculate Conception
immaconceptionDate = new Date("December 8, 2000 0:0:0")

// Christmas Eve
christmasDate = new Date("December 25, 2000 0:0:0")

// New Year's Day
newyearsDate = new Date("January 1, 2001 0:0:0")

// Variable dates =============================================

ashWedDate = new Date("February 28, 2001 0:0:0")
easterDate = new Date("April 15, 2001 0:0:0")
pentecostDayDate = new Date("June 3, 2001 0:0:0")
mothersDayDate = new Date("May 13, 2001 0:0:0")
memorialDayDate = new Date("May 28, 2001 0:0:0")
fathersDayDate = new Date("June 17, 2001 0:0:0")
trinitySunday = new Date("June 10, 2001 0:0:0")
corpuschristiDayDate = new Date("June 17, 2001 0:0:0")
laborDayDate = new Date("September 3, 2001 0:0:0")
thanksgivingDayDate = new Date("November 22, 2001 0:0:0")
adventDayDate = new Date("December 2, 2001 0:0:0")

easterDayNo = dayNumber(easterDate)
ashWedDayNo = dayNumber(ashWedDate)
pentecostDayNo = dayNumber(pentecostDayDate)
memorialDayNo = dayNumber(memorialDayDate)
laborDayNo = dayNumber(laborDayDate)
independenceDayNo = dayNumber(independenceDayDate)
mothersDayNo = dayNumber(mothersDayDate)
fathersDayNo = dayNumber(fathersDayDate)
trinitySundayNo = dayNumber(trinitySunday)
assumptionDayNo = dayNumber(assumptionDate)
immaconceptionDayNo = dayNumber(immaconceptionDate)
newyearsDayNo = dayNumber(newyearsDate)
corpuschristiDayNo = dayNumber(corpuschristiDayDate)
thanksgivingDayNo = dayNumber(thanksgivingDayDate)
adventDayNo = dayNumber(adventDayDate)
christmasDayNo = dayNumber(christmasDate)