<!--
// fill the month table with column headings
var mes="";
var dayArray=new Array();
function isAgenda(day)
{
    for(var i=0;i<dayArray.length;i++)
    {
        if(dayArray[i].toString()==day)
        {
            return true;
        }
    }
    return false;
}
function day_title(day_name){
     document.write("<TD class='tabelaHeaderDay'>"+day_name+"</TD>")
}
// fills the month table with numbers
function fill_table(month,month_length)
{ 
  mes=month;
  day=1;
  // begin the new month table
  document.write("<div style='padding-top:10px'><TABLE  CELLSPACING='1' CELLPADDING='0'><TR>")
  document.write("<TD COLSPAN=7 class='tabelaHeader' ALIGN=center><B>"+month+"   "+year+"</B><TR>")
  // column headings
  day_title("Dom")
  day_title("Seg")
  day_title("Ter")
  day_title("Qua")
  day_title("Qui")
  day_title("Sex")
  day_title("Sab")
  // pad cells before first day of month
  document.write("</TR><TR>")
  for (var i=1;i<start_day;i++){
        document.write("<TD class='tabelaHeaderDayNumber'>")
  }
  // fill the first week of days
  for (var i=start_day;i<8;i++){
        if(isAgenda(day))
        {
            document.write("<TD class='tabelaMatchDayNumber'><div class='tabelaMatchDayNumberDiv' onclick=\"openDay('"+day+"')\">"+day+"</div></TD>")
        }
        else
        {
            document.write("<TD class='tabelaHeaderDayNumber'>"+day+"</TD>")
        }
        day++;
  }

  document.write("<TR>")
  // fill the remaining weeks
  while (day <= month_length) {
     for (var i=1;i<=7 && day<=month_length;i++){
        if(isAgenda(day))
        {
             document.write("<TD class='tabelaMatchDayNumber'><div class='tabelaMatchDayNumberDiv' onclick=\"openDay('"+day+"')\">"+day+"</div></TD>")
        }
        else
        {
            document.write("<TD class='tabelaHeaderDayNumber'>"+day+"</TD>")
        }
        day++;
     }
     document.write("</TR><TR>")
     // the first day of the next month
     start_day=i
  }
  document.write("</TR></TABLE></div>")
}
// end hiding -->


// CAHNGE the below variable to the CURRENT YEAR
var d = new Date();
var year=0; 
if((d.getYear())<1000)
{
  year=1900+d.getYear();
}
else
{
  year=d.getYear();
}

// first day of the week of the new year
var today 
var start_day   // starts with 0

function fillWhat(mes)
{
    switch (mes)
    {
        case '01':
           today= new Date("January 1, "+year);
           start_day = today.getDay() + 1;
           fill_table("Janeiro",31);
        break;
        case '02':
            today= new Date("February 1, "+year);
            start_day = today.getDay() + 1;
            fill_table("Fevereiro",28);
        break;
        case '03':
            today= new Date("March 1, "+year);
            start_day = today.getDay() + 1;
            fill_table("Março",31);
        break;
        case '04':
            today= new Date("April 1, "+year);
            start_day = today.getDay() + 1;
            fill_table("Abril",30);
        break;
        case '05':
            today= new Date("May 1, "+year);
            start_day = today.getDay() + 1;
            fill_table("Maio",31);
        break;
        case '06':
            today= new Date("June 1, "+year);
           start_day = today.getDay() + 1;
            fill_table("Junho",30);
        break;
        case '07':
            today= new Date("July 1, "+year);
           start_day = today.getDay() + 1;
            fill_table("Julho",31);
        break;
        case '08':
            today= new Date("August 1, "+year);
           start_day = today.getDay() + 1;
            fill_table("Agosto",31);
        break;
        case '09':
            today= new Date("September 1, "+year);
           start_day = today.getDay() + 1;
            fill_table("Setembro",30);
        break;
        case '10':
            today= new Date("October 1, "+year);
           start_day = today.getDay() + 1;
            fill_table("Outubro",31);
        break;
        case '11':
            today= new Date("November 1, "+year);
           start_day = today.getDay() + 1;
            fill_table("Novembro",30);
        break;
        case '12':
            today= new Date("December 1, "+year);
           start_day = today.getDay() + 1;
            fill_table("Dezembro",31);
        break;
    }
}
function openDay(day)
{
    src="corpo.php?area=agenda&dia="+day+"&mes="+mes;
    document.getElementById("Frame_corpo").src=src;
}






