<!--


//  SET ARRAYS
var day_of_week = new Array('','','','','','','');
var month_of_year = new Array('JANUARY','FEBRUARY','MARCH','APRIL','MAY','JUNE','JULY','AUGUST','SEPTEMBER','OCTOBER','NOVEMBER','DECEMBER');

//  DECLARE AND INITIALIZE VARIABLES

var Calendar = new Date();

var curDate = new Date()

var curMonth = curDate.getMonth()

var cpt_year = Calendar.getFullYear();  // Returns year
var cpt_month = Calendar.getMonth();    // Returns month (0-11)

var cpt_today = Calendar.getDate()+'|'+Calendar.getMonth();    // Returns day (1-31)
var cpt_weekday = Calendar.getDay();    // Returns day (1-31)

var DAYS_OF_WEEK = 7;    // "constant" for number of days in a week
var DAYS_OF_MONTH = 31;    // "constant" for number of days in a month
var cal; // Used for printing


function moveMonth(dir)
{
   

  if (dir.toLowerCase() == "back")
   {
    if (cpt_month !=0)
      {
    cpt_month = cpt_month - 1
      }
      else
      {
        cpt_month = 11
        cpt_year = cpt_year - 1
      }
   }  
   else
   {
    if (cpt_month==11)
       {
            cpt_year = cpt_year + 1;
            cpt_month = 0;
        }
        else
        {
           cpt_month = cpt_month + 1;
       }    
   }

  Calendar.setMonth(cpt_month);
  Calendar.setFullYear(cpt_year);
  writeCalendar();
} 


function writeCalendar(){

var curDate = new Date()
var curMonth = curDate.getMonth() 

var cpt_today = curDate.getDate()+'|'+curDate.getMonth();  // Returns day (1-31)
var cpt_weekday = curDate.getDay();    // Returns day (1-31)


Calendar.setDate(1);    // Start the calendar day at '1'


/* VARIABLES FOR FORMATTING
NOTE: You can format the 'BORDER', 'BGCOLOR', 'CELLPADDING', 'BORDERCOLOR'
      tags to customize your calendar's look. */

var TR_start = '<TR class="calendar_data" valign=top>';
var TR_end = '</TR>';
var TD_start = '<TD class="calendar_data" valign=top align=middle>';
var TD_day_start = '<TD>';
var TD_end = '</TD>';

var highlight_start = ''
highlight_start+='<td height="18" width="20" valign=top>';
highlight_start+='  <table class="calendar_link" style="width:20px;height:18px;">';
highlight_start+='    <tr>';
highlight_start+='        <td class="calendartext" style="width:20px;height:20px;color:#ffffff;font-family: Verdana, sans-serif; font-size: 8px; font-weight:normal;">';
                    
var highlight_end = ''
highlight_end+='    </a></td>';
highlight_end+='      </tr>';
highlight_end+='    </table>';
highlight_end+='  </td>';


var TD_cell_start = '';
TD_cell_start+='<td height="18" width="20" valign=top>';
TD_cell_start+='  <table class="calendar_link" style="border:1px solid #8B943B;width:20px;height:18px;background-color:#ffffff;"';
TD_cell_start+='    <tr>';
TD_cell_start+='        <td class="calendartext" style="width:20px;height:18px;color:#8B943B;font-family: Verdana, sans-serif; font-size: 8px; font-weight:normal;">';
                    
var TD_cell_end = '';                   
TD_cell_end+='     </td>';
TD_cell_end+='      </tr>';
TD_cell_end+='    </table>';
TD_cell_end+='  </td>'; 


//CALENDAR HEADER SECTION
cal = '<table class="background">';
cal +='    <tr>';
cal +='        <td colspan=7 width=180 valign="top" align="center">';
cal +='          <img src="/images/clear.gif" width="6" height="5" border=0><br /><span onclick="moveMonth(\'Back\');"><img src="/images/backarrow.gif" width="6" height="10" border=0 alt="Previous Month"></span>';
cal +='        <span style="color:#8B943B;font-weight:bold;">';
cal +='        ' + month_of_year[cpt_month] + ' ' +  cpt_year + '</span>';
cal +='        <span onclick="moveMonth(\'Forward\')";><img src="/images/nextarrow.gif" border="0" width="6" height="10" alt="Next Month"></span></td>';
cal +='    </tr>';



//   DO NOT EDIT BELOW THIS POINT  //

// LOOPS FOR EACH DAY OF WEEK

for(cpt_index=0; cpt_index < DAYS_OF_WEEK; cpt_index++)
{
// BOLD TODAY'S DAY OF WEEK
if(cpt_weekday == cpt_index && cpt_month == curMonth)
cal += TD_day_start + '<B>'  + '</B>' + TD_end;

// PRINTS WEEKDAYS
else
cal += TD_day_start + day_of_week[cpt_index] + TD_end;
}

cal += TD_end + TR_end;
cal += TR_start;

// FILL IN BLANK GAPS UNTIL TODAY'S DAY
for(cpt_index=0; cpt_index < Calendar.getDay(); cpt_index++)

cal += TD_start + '  ' + TD_end;

// LOOPS FOR EACH DAY IN CALENDAR
for(cpt_index=0; cpt_index < DAYS_OF_MONTH; cpt_index++)

{

if( Calendar.getDate() > cpt_index )
{
  // RETURNS THE NEXT DAY TO PRINT
  week_day = Calendar.getDay();


  // START NEW ROW FOR FIRST DAY OF WEEK
  if(week_day == 0)
  cal += TR_start;

  if(week_day != DAYS_OF_WEEK)
  {

  // SET VARIABLE INSIDE LOOP FOR INCREMENTING PURPOSES
  var cpt_day  = Calendar.getDate();

  var select_day = cur_days[Calendar.getDate()+'|'+Calendar.getMonth()+'|'+Calendar.getFullYear()]
  //alert(select_day);  
  
  //BOLD CURRENT DAY & LINK
  if (select_day != null && cpt_today==Calendar.getDate()+'|'+Calendar.getMonth() )
  //cal += highlight_start + '' + '<b>'+ cpt_day + '</b>' + highlight_end + TD_end;
  cal += highlight_start + '<a href="'+select_day+'" class="lnav">' + '<b>'+ cpt_day + '</b>' + highlight_end + TD_end;

  //BOLD CURRENT DAY
  else if (cpt_today==Calendar.getDate()+'|'+Calendar.getMonth() )
  cal += TD_cell_start  + '<b>'+ cpt_day + '</b>' + TD_cell_end;
    
  //LINK DAY
  else  if (select_day != null)
 // cal += highlight_start + '' + cpt_day + highlight_end + TD_end;
  cal += highlight_start + '<a href="'+select_day+'" class="lnav">' + cpt_day + highlight_end + TD_end;

   // PRINTS DAY
  else
  cal += TD_cell_start + cpt_day + TD_cell_end;
  }

  // END ROW FOR LAST DAY OF WEEK
  if(week_day == DAYS_OF_WEEK)
  cal += TR_end;
  }

  // INCREMENTS UNTIL END OF THE MONTH
  Calendar.setDate(Calendar.getDate()+1);

}// end for loop

cal += '</TD></TR></TABLE></TABLE>';


//  PRINT CALENDAR
//cpt_calendar.innerHTML=cal;
document.getElementById('cpt_calendar').innerHTML=cal;
}


//-->
