var day_of_week = new Array('вс','пн','вт','ср','чт','пт','сб');
var month_of_year = new Array('Январь','Февраль','Март','Апрель','Май','Июнь','Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь');
var Calendar = new Date();
var year = Calendar.getYear();
var month = Calendar.getMonth();
var today = Calendar.getDate();
var weekday = Calendar.getDay();
var DAYS_OF_WEEK = 7;
var DAYS_OF_MONTH = 31;
var cal;
Calendar.setDate(1);
Calendar.setMonth(month);
var TR_start = '<TR>';
var TR_end = '</TR>';
var highlight_start = '<TD WIDTH="25" style="background:#666666;margin:1px 1px 0 0; float:left;"><B><CENTER>';
var highlight_end   = '</CENTER></B>';
var TD_start = '<TD WIDTH="25" style="background:#333333;margin:1px 1px 0 0; float:left;"><CENTER>';
var TD_start_2 = '<TD WIDTH="25" style="background:#666666;margin:1px 1px 0 0; float:left;"><CENTER>';
var TD_end = '</CENTER></TD>';
cal =  '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD>';
cal += '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2>' + TR_start;
cal += '<TD COLSPAN="' + DAYS_OF_WEEK + '"><CENTER><B>';
cal += month_of_year[month]  + ' 2010</B>' + TD_end + TR_end;
cal += TR_start;
for(index=0; index < DAYS_OF_WEEK; index++)
{
if(weekday == index)
cal += TD_start_2 + '<B>' + day_of_week[index] + '</B>' + TD_end;
else
cal += TD_start_2 + day_of_week[index] + TD_end;
}
cal += TD_end + TR_end;
cal += TR_start;
for(index=0; index < Calendar.getDay(); index++)
cal += TD_start + '  ' + TD_end;
for(index=0; index < DAYS_OF_MONTH; index++)
{
if( Calendar.getDate() > index )
{
  week_day =Calendar.getDay();
  if(week_day == 0)
  cal += TR_start;
  if(week_day != DAYS_OF_WEEK)
  {
  var day  = Calendar.getDate();
  if( today==Calendar.getDate() )
  cal += highlight_start + day + highlight_end + TD_end;
  else
  cal += TD_start + day + TD_end;
  }
  if(week_day == DAYS_OF_WEEK)
  cal += TR_end;
  }
  Calendar.setDate(Calendar.getDate()+1);
}
cal += '</TD></TR></TABLE></TABLE>';
document.write(cal);
