// Set varible to the current date
var right_now=new Date();

// set variable to current month number (0-11)
var month_num = right_now.getMonth()

// set varible to the current day value (1-31)
var thedate=right_now.getDate()

//create event array
daySchedule = new Array
daySchedule[1] = "Birthday - Donna Bilbrey"
daySchedule[2] = "Birthday - Bill Warren"
daySchedule[3] = "Birthday - DeLisa Cox - Ladies Class - 10:00 AM"
daySchedule[4] = ""
daySchedule[5] = ""
daySchedule[6] = ""
daySchedule[7] = "Visitation Team 1"
daySchedule[8] = ""
daySchedule[9] = ""
daySchedule[10] = "Ladies Class - 10:00 AM"
daySchedule[11] = "Birthday - Martha Estes, Mildred Smith"
daySchedule[12] = ""
daySchedule[13] = "90th Birthday Party for Mildred Smith @ Family Center, come and go 1-5PM"
daySchedule[14] = "Visitation Team 2 - Daylight Savings time begins"
daySchedule[15] = "Birthday-Lynn Duncan - Spring Break Week AISD"
daySchedule[16] = "Wedding Anniversary - R & S Hogue - Spring Break Week AISD - Singles 39+ Potluck 6:30 PM in the Family Center"
daySchedule[17] = "St. Patrick's Day - Spring Break Week AISD - Ladies Bible Class 10:00"
daySchedule[18] = "Spring Break Week AISD"
daySchedule[19] = "Spring Break Week AISD"
daySchedule[20] = ""
daySchedule[21] = "Birthday - Joey Clement - Visitation Team 3"
daySchedule[22] = ""
daySchedule[23] = ""
daySchedule[24] = "Wedding Anniversary - M & D Foster - Ladies Class - 10:00 AM"
daySchedule[25] = ""
daySchedule[26] = "Wedding Anniversary - D & A Garrison - Birthday - Roy Martindale"
daySchedule[27] = ""
daySchedule[28] = "Visitation Team 4 - Key to the Kingdom and Luncheon"
daySchedule[29] = "Birthday - Brittany Daffern"
daySchedule[30] = ""
daySchedule[31] = "Birthday - Ladelle Dunaway - Ladies Bible Class 10:00"

// create an array for the month name
var month_name = new Array (
"January ",
"February ",
"March ",
"April ",
"May ",
"June ",
"July ",
"August ",
"September ",
"October ",
"November ",
"December ");

// Create a varible right_year with the current year
var right_year=right_now.getYear();
if (right_year < 2000) 
right_year = right_year + 1900; 

// create a varible to specify what the
// last day for the current month is
var theday = 0;
if (
month_num == 0 || 
month_num == 2 || 
month_num == 4 || 
month_num == 6 || 
month_num == 7 || 
month_num == 9 || 
month_num == 11)
{ 
endofmonth=31;
}
if (
month_num == 3 || 
month_num == 5 || 
month_num == 8 || 
month_num == 10)
{ 
endofmonth=30;
}

if (month_num == 1)
{ 
// This will check for a leap year
// If the year is evenly divisible by four
// or in the case of a new century evenly divisible
// by 400 then the end of the February month should be the 29th

right_year_divided=right_year/4;
right_year_divided_string= new String(right_year_divided);
var is_decimal = right_year_divided_string.indexOf('.');
if (is_decimal != -1)
{ endofmonth=28; }
else
{ endofmonth=29; }

right_year_string= new String(right_year);
var the_century=new String(right_year_string.charAt(2)) 
the_century= the_century + new String(right_year_string.charAt(3));
if (the_century == "00")
{ 
right_year_divided=right_year/400;
right_year_divided_string= new String(right_year_divided);
var is_decimal = right_year_divided_string.indexOf('.');
if (is_decimal != -1)
{endofmonth=28;}
else
{endofmonth=29;}
}
}

function showDate(theday)
  {
    document.Calendar.dateInfo.value = daySchedule[theday]
  }

// Start building the table
document.write("<table <font CELLSPACING=0 CELLPADDING=0 BORDER=1 ><align=left></font>");
document.write("<caption><b>");

// Place a caption with the month name and year
document.write(month_name[month_num]);
document.write(right_year );
document.write("</b></caption>");

// Write the table header row
document.write("<tr <font CELLSPACING=0 CELLPADDING=0 BORDER=1 BGCOLOR=#CCFFCC><th>Sun</th><th>Mon</th><th>Tue</th><th>Wed</th>");
document.write("<th>Thu</th><th>Fri</th><th>Sat</th></tr></font><tr>");

// Figure out which day of the week the 1st of the 
// current month belongs to
first_day = new Date(right_year,month_num,1)


// Write the first row in the calendar with dates
// Check which date of the month is the first to
// fill it into the appropriate day of the week
for (counter = 0; counter < 7; counter++)
{ 

// Check the counter aganst the first day of the month value (0 - 6)

if (counter >= first_day.getDay() ) 
{ 

// Start counter for the calendar days
theday=theday+1;

// Check if the current day is in the first week if so, place bold text
if (theday == thedate) 
  if (daySchedule[theday] > "")
     {document.write("<td <font BGCOLOR=DEDEFF><CENTER><b><a href=javascript:showDate("+theday+")>"+ theday +"</a></b></font></td>");}
  else
     {document.write("<td <font BGCOLOR=DEDEFF><CENTER><b>" + theday + "</b></font></td>");}
else 
// If it's not the current date output without bold text
  if (daySchedule[theday] > "")
       {document.write("<td <font BGCOLOR=FFFFFF><CENTER><a href=javascript:showDate("+theday+")>"+ theday +"</a></font></td>");}
  else
     {document.write("<td <font BGCOLOR=FFFFFF><CENTER>" + theday + "</font></td>");}
} 
else 
// if there is no day yet output an empty cell
{document.write("<td></td>"); }
}

// End row for the first week of the month
document.write("</tr>"); 

// Loop for the rest fo the weeks in the month 
for (weeks = 0; weeks < 5; weeks++)
{ 
document.write("<tr>"); 
// loop for the days with the remaining weeks
for (week = 0; week < 7; week++)
{

// counter for the day of the month
theday=theday+1

// if the counter = the current date display in bold 
if (theday == thedate) 
  if (daySchedule[theday] > "")
     {document.write("<td <font BGCOLOR=DEDEFF><CENTER><b><a href=javascript:showDate("+theday+")>"+ theday +"</a></b></font></td>");}
  else
    {document.write("<td <font BGCOLOR=DEDEFF><CENTER><b>" + theday + "</b></font></td>");}
else 
{ 

// if the counter is higher then than the number of days
// in the month then display a blank cell
if (theday > endofmonth) 
{document.write("<td></td>");}
else 

// If it's not the cureent day display the date wioth bold type
  if (daySchedule[theday] > "")
       {document.write("<td <font BGCOLOR=FFFFFF><CENTER><a href=javascript:showDate("+theday+")>"+ theday +"</a></font></td>");}
  else
       {document.write("<td <font BGCOLOR=FFFFFF><CENTER>" + theday + "</font></td>"); }
}
}
document.write("</tr>");
}
document.write("</table>");
//-->