function calendar(date)
         {
         //If no parameter is passed use the current date.
         if(date == null)
            date = new Date();
         
         day = date.getDate();
         month = date.getMonth();
         year = date.getFullYear();
         
         months = new Array('Styczeń',
                            'Luty',
                            'Marzec',
                            'Kwiecień',
                            'Maj',
                            'Czerwiec',
                            'Lipiec',
                            'Sierpień',
                            'Wrzesień',
                            'Październik',
                            'Listopad',
                            'Grudzień');
         
         this_month = new Date(year, month, 0);
         next_month = new Date(year, month + 1, 0);
         
         //Find out when this month starts and ends.         
         first_week_day = this_month.getDay();
         days_in_this_month = Math.floor((next_month.getTime() - this_month.getTime()) / (1000 * 60 * 60 * 24));
         
         calendar_html = '<table cellpadding="0" cellspacing="1" color="ffffff">';
         
         calendar_html += '<tr><td colspan="7" align="center" color="000000">' + 
                          months[month] + ' ' + year + '</td></tr>'
         
         calendar_html += '<tr align="center"><td bgcolor="#4D1B00"><font color="white">pn</font></td><td bgcolor="#4D1B00"><font color="white">wt</font></td><td bgcolor="#4D1B00"><font color="white">śr</font></td><td bgcolor="#4D1B00"><font color="white">czw</font><td bgcolor="#4D1B00"><font color="white">pt</font></td><td bgcolor="#4D1B00"><font color="white">so</font></td><td bgcolor="#4D1B00"><font color="white">nie</font></td></tr>'
		 
		 calendar_html += '<tr>';
          
         //Fill the first week of the month with the appropriate number of blanks.       
         for(week_day = 0; week_day < first_week_day; week_day++)
            {
            calendar_html += '<td>&nbsp;</td>';   
            }
            
         week_day = first_week_day;
         for(day_counter = 1; day_counter <= days_in_this_month; day_counter++)
            {
            week_day %= 7;
            
            if(week_day == 0)
               calendar_html += '</tr><tr>';
            
            //Do something different for the current day.
            if(day == day_counter)  
               calendar_html += '<td align="center" bgcolor="white" ><font color="green"><b>' + day_counter + '</b></font></td>';
			   			
			//Color weekends 
			 else if(week_day == 5) 
			   calendar_html += '<td align="center" bgcolor="#E9EDD3"><font color="#DD7200"><b>&nbsp;' + day_counter + '&nbsp;</b></font></td>';
			 
			 else if(week_day == 6)
			   calendar_html += '<td align="center" bgcolor="#E9EDD3"><font color="#DD7200"><b>&nbsp;' + day_counter + '&nbsp;</b></font></td>';
			
			 else
               calendar_html += '<td align="center" background-color="9999cc" color="000000">&nbsp;' + 
                                day_counter + '&nbsp;</td>';
            
            week_day++;
            }
            
         calendar_html += '</tr>';
         calendar_html += '</table>';
         
         //Display the calendar.     
         document.write(calendar_html);                  
         }
