//*** initialze the calendar to this month ***
function chal(quemesa) {
Today = new Date();
boldit=(Today.getMonth()==quemesa);
tempd = quemesa;
Today.setMonth(quemesa);
day=Today.getDate();
month=Today.getMonth();
if (month != tempd)  month=tempd;
year=Today.getFullYear();
Today.setMonth(quemesa);
Today.setDate("1");
weekday = Today.getDay();

function what(mont)
{
switch (mont){
   case 0: maxi=31; return "January";
   case 1: maxi=28; if (year % 4==0) maxi++;
    				return "Febuary";
   case 2: maxi=31; return "March";
   case 3: maxi=30; return "April";
   case 4: maxi=31; return "May";
   case 5: maxi=30; return "June";
   case 6: maxi=31; return "July";
   case 7: maxi=31; return "August";
   case 8: maxi=30; return "September";
   case 9: maxi=31; return "October";
   case 10:maxi=30; return "November";
   case 11:maxi=31; return "December";
}
}
// *****
document.write("<center><H3>"+what(month)+" "+year+"</H3></center><TABLE border=1><TR><TD align=center width=14%>Sun</TD>");
document.write("<TD align=center width=14%>Mon</TD>");
document.write("<TD align=center width=14%>Tues</TD>");
document.write("<TD align=center width=14%>Wed</TD>");
document.write("<TD align=center width=14%>Thur</TD>");
document.write("<TD align=center width=14%>Fri</TD>");
document.write("<TD align=center width=14%>Sat</TD></TR><TR>");

j=0;
for (i=0;i<=(weekday-1);i++)
{
document.write("<TD>&nbsp;</td>");
j++;
}
month++;
for (i=1;i<=maxi;i++)
{ j++;

document.write("<TD align=right");
if (boldit&&i==day) document.write(" bgcolor='cccccc'");
document.write(">");
if (!((j==1)||(j==7))) document.write("<a href='data.html?"+month+"/"+(i-j+2)+"/"+year+"' target='day'>"+i+"</a><br>"); 
else document.write(i);
if (boldit&&i==day) document.write("");
document.write("</TD>"); 
    if (j>=7){
  document.write("</tr><tr>");
  j=0;}
}
while (j<7) {
document.write("<td>&nbsp;</td>");
j++;
}
document.write("</TR></TABLE>");
}
