<!--

function numDaysIn(mth,yr) {
 if (mth==3 || mth==5 || mth==8 || mth==10) return 30;
 else if ((mth==1) && leapYear(yr)) return 29;
 else if (mth==1) return 28;
 else return 31;
}
function leapYear(yr) {
 if (((yr % 4 == 0) && yr % 100 != 0) || yr % 400 == 0)
  return true;
 else
  return false;
}
// fixes a Netscape 2 and 3 bug
function getFullYear(d) { // d is a date object
 yr = d.getYear();
 if (yr < 1000)
  yr+=1900;
 return yr;
}
function arr() {
 for (n=0;n<arr.arguments.length;n++) {
  this[n] = arr.arguments[n];
 }
}

//weekdays = new arr("Sun.","Mon.","Tues.","Wed.",
// "Thurs.","Fri.","Sat.");
// *** comment out the one you don't want to use ***
weekdays = new arr("Sunday","Monday","Tuesday","Wednesday",
 "Thursday","Friday","Saturday");

//months = new arr("Jan.","Feb.","Mar.","Apr.","May",
// "June","July","Aug.","Sep.","Oct.","Nov.","Dec.");
// *** comment out the one you don't want to use ***
months = new arr("January","February","March","April","May",
 "June","July","August","September","October","November","December");


var flg=0;
var today = new Date();

/* You control the size of this calendar
   by specifying the font size (from 1
   through 7) in the var fs below. */
var fs=4;

/* The events array - E - below uses an
     array element for each month from
     Jan thru Dec. The string for each
     month is indexed with a tilde (~), the
     date and a space, followed by the
     event description.  Substitute the
     events you wish here. Use two lines
     (with <BR>) for each. */
E=new arr("","","","","","","","","","","","");
E[0]="~9 Men's Installation Mtg~10 1st Reconciliation<BR>Parents' Mtg.~12 Council Day<BR>of Reflection~22 Potluck confirmatin<BR>Candidates &amp; Sponsors~24 1st Communion<BR>Parents' Mtg.~27 Ecumenical<BR>Service~";
E[2]="~2 World Day<BR>of Prayer<BR>-----<BR>Lenten Fish Fry~4 1st Day of Lent<BR>-----<BR>Rite of<BR>Enrollment &amp;<BR>Election~6 Confirmation Sponsors<BR>Potluck~7 Souper<BR>Supper~9 Lenten Fish<BR>Fry~10 SJNWO Mystery<BR>Trip~11 2nd Sunday<BR>of Lent<BR>-----<BR>Penitential Rite~14 Souper<BR>Supper~16 Lenten Fish<BR>Fry~17 Reconciliation<BR>Retreat~18 3rd Sunday<BR>of Lent<BR>----<BR>Scruntiny~20 First<BR>Reconciliation~21 Souper<BR>Sunday~22 First<BR>Reconciliation~23 Lenten Fish<BR>Fry~24 RCIA Retreat<BR>-----<BR>Catholic Men's<BR>Conference~25 4th Sunday<BR>of Lent<BR>-----<BR>Scrutiny<BR>-----<BR>Confirmation Fellowship~27 Parish Council~28 Souper<BR>Supper~30 Lenten Fish<BR>Fry~31 Confirmation Retreat~";
E[3]="~1 Scrutiny<BR> ----- <BR>Parish<BR>Reconciliation~6 Lenten Fish Fry~7 SJNWO Egg Hunt~8 Palm Sunday~10 Chrism Mass~12 Holy Thursday<BR> ----- <BR>Parish Office Closed~13 Good Friday~14 Easter Vigil~15 Easter Sunday~28 First Communion Retreat~";
E[4]="~2 SJWO Install Dinner<BR>   -----   <BR>1st Communion Practice~4 1st Communion Practice~5 First Communion~6 First Communion~10 Neumann News Deadline~11 Jr. Hi Dance~15 SBCS Parent Meeting~17 Pass on the Faith<BR>@ SBCS~19 Confirmation Practice~20 Men's Golf Outing~24 Confirmation~27 Ascension<BR>   -----   <BR>Stewardship Sunday~28 Memoral Day<BR>   -----   <BR>Parish Office Closed~~";
E[5]="~1 SBCS Graduation Breakfast<BR>   -----   <BR>Parish Picnic~3 Pentecost~4 SBCS Graduation~6 Parish Day<BR>of Fast &amp; Prayer~8 Closed Mass<BR>at SBCS~9 Women's Golf<BR>Outing~10 Trinity<BR>Sunday~12 Body &amp; Blood<BR>of Christ~19 Birth of<BR>John the Baptist<BR> ----- <BR>Father Rob's<BR>Farewell~26 Parish Council~30 Reception for<BR>Sr. Adria~";
E[6]="~1 Fr. Rob's<BR>Last Mass~";
E[7]="~5 Godspell~15 Feast of<BR>Assumption~31 Festival~";
E[8]="~1 Festival~2 Festival~3 Festival<BR>Clean-UP~";
E[9]="~~";
E[10]="~~";
E[11]="~~";


/* You can hard code the year by setting
   hard_code_year to true and then setting the
   hard_yr variable to the year you want */
hard_code_year = true; // change to true if desired
hard_yr = 2002; // specify your hard coded year if desired

/* You can hard code the month by setting
   hard_code_date to true and then setting the
   hard_mo variable to the month you want */
hard_code_date = true; // change to true if desired
hard_mo = 0; // 0=Jan, 1=Feb, etc.

function Calendar(){
 mo=today.getMonth();
 rd=today.getDate();
 yr=getFullYear(today);
 if (location.search.length > 1) {
  mon = parseInt(location.search.substring(1,location.search.length));
  if (((""+mon).length<=2) && (mon >= 0) && (mon <= 11)) {
   mo = mon;
   rd = -99; // so current day doen't get highlighted
  }
 }
 if (hard_code_year) {
  yr = hard_yr;
  rd = -99; // so current day doen't get highlighted
 }
 if (hard_code_date) {
  mo = hard_mo;
  rd = -99; // so current day doen't get highlighted
 }
 bgn=new Date(months[mo]+" 1,"+yr);
 dy=bgn.getDay();
 ld=numDaysIn(mo,yr);
 document.write("<TABLE BORDER=2"
 +" BGCOLOR='#FFFFCC'><TR valign=top><TD ALIG"
 +"N=CENTER COLSPAN=7><FONT SIZE="
 +fs+"><B>"+months[mo]+" "+yr+"</B></FONT></TD>"
 +"</TR><TR valign=top>");
 for (var i=0;i<7;i++){
  document.write("<TD ALIGN=CENTER WIDTH=14%>"
  +"<FONT SIZE=1>"+weekdays[i]+"</FONT></TD>");
 }
 document.write("</TR><TR valign=top>");
 ctr=0;
 for (var i=0;i<7;i++) {
  /* If the ctr is less than the day of the
     week determined to be the first day
     of the month, print a space in
     this cell of the table. */
  if (i<dy){
   document.write("<TD ALIGN=CENTER>"
   +"<FONT SIZE="+fs+">&nbsp;</FONT>"
   +"</TD>");
  }
  /* Otherwise, write date and the event,
     if any, in this cell of the table. */
  else {
   ctr++;
   di=i; // carry var i outside this routine
   dupWrt();
  }
 }
 document.write("</TR>");
 while (ctr<ld){
  document.write("<TR valign=top>");
  for (var i=0;i<7;i++){
   ctr++;
   /* If the ctr is greater than the last
      day of the month, print a space in
      this cell of the table. */
   if (ctr>ld){
    document.write("<TD ALIGN=CENTER>"
    +"&nbsp;</TD>");
   }
   /* Otherwise, write date and the event,
      if any, in this cell of the table. */
   else{
    di=i; // carry var i outside this routine
    dupWrt();
   }
  }
  document.write("</TR>");
 }
 jump = "";
 if (mo > 0)
  jump += '<a href="calendar.htm?'+(mo-1)+'">&lt;-- View '+months[mo-1]+'</a>';
 if ((mo > 0) && (mo < 11))
  jump += " &nbsp; | &nbsp; ";
 if (mo < 11)
  jump += '<a href="calendar.htm?'+(mo+1)+'">View '+months[mo+1]+' --&gt;</a>';
 if (hard_code_date)
  jump = "";
 document.write("<TR valign=top><TD colspan=7 align=center>"+jump+"</TD></TR></TABLE>\n");
}

function dupWrt() {
 document.write("<TD ALIGN=CENTER>"
 +"<FONT SIZE="+fs);
 blue=0;
 if (di==0){
  /* Change color to whatever color you wish
     for Sundays to be differentiated on
     screen.  I used red here.  */
  document.write(" COLOR='red'");
  blue=1;
 }
 if (ctr==rd){
  /* Change color to whatever color you wish
     for the current date to be differentiated on
     screen.  I used green here.  */
  document.write(" COLOR='green'");
  blue=1;
 }
 /* For dates without an event, an HTML padder
    that will align dates properly with dates
    having an event. Here, space break space. */
 tmp="&nbsp;<BR>&nbsp;";
 /* Then check for event in this month's events
    array for this date. If present, rewrite the
    tmp variable to contain the event. */
 pos=E[mo].indexOf("~"+ctr+" ");
 if (pos>-1){
  tmp=E[mo].substring(pos+3,E[mo].length);
  pos=tmp.indexOf("~");
  tmp=tmp.substring(0,pos);
  if (blue!=1){
   /* Change color to whatever color you wish
      for the events to be differentiated on
      screen.  I used blue here.  */
   document.write(" COLOR='blue'");
   }
  }
 document.write("><B>"+ctr+"</B></FONT><BR><FO"
 +"NT SIZE=2>"+tmp+"</TD>");
 }

// -->
