
    var scwDateNow = new Date(Date.parse(new Date().toDateString()));

    var scwBaseYear        = scwDateNow.getFullYear()-10;

    // How many years do want to be valid and to show in the drop-down list?

    var scwDropDownYears   = 20;

    // All language dependent changes can be made here...

    var scwToday               = 'Dzisiaj:',
        scwInvalidDateMsg      = 'Wprowadzona data nie jest prawidłowa.\n',
        scwOutOfRangeMsg       = 'Wprowadzona data jest poza zakresem.',
        scwDoesNotExistMsg     = 'Wprowadzona data nie istnieje.',
        scwInvalidAlert        = ['Niepoprawna data (',') zignorowana.'],
        scwDateDisablingError  = ['Błąd ',' nie jest obiektem daty.'],
        scwRangeDisablingError = ['Błąd ',' powinna zawierać 2 elementy.'],
        scwArrMonthNames       = ['Sty','Lut','Mar','Kwi','Maj','Cze',
                                  'Lip','Sie','Wrz','PaĽ','Lis','Gru'],
        scwArrWeekInits        = ['Nd','Pn','Wt','¦r','Cz','Pt','So'];

    var scwWeekStart       =    1;

    var scwArrDelimiters   = ['/','-','.',',',' '];

    var scwDateDisplayFormat = 'd-mm-yyyy';        // e.g. 'MMM-DD-YYYY' for the US


    var scwDateOutputFormat  = 'YYYY-MM-DD';   // e.g. 'MMM-DD-YYYY' for the US

    var scwDateInputSequence = 'YMD';

    var scwZindex          = 1;

    var scwBlnStrict       = false;

    var scwEnabledDay      = [true, true, true, true, true, true, true,
                              true, true, true, true, true, true, true,
                              true, true, true, true, true, true, true,
                              true, true, true, true, true, true, true,
                              true, true, true, true, true, true, true,
                              true, true, true, true, true, true, true];

    var scwDisabledDates   = new Array();

    var scwActiveToday = true;

    var scwOutOfRangeDisable = true;

    var scwClickToHide = false;

    var scwBackground           = '#8CBDCE';    // Calendar background
    var scwHeadText             = '#CCCCCC';    // Colour of week headings

    // If you want to "turn off" any of the highlighting then just
    // set the highlight colours to the same as the un-higlighted colours.

    // Today string
    var scwTodayText            = '#FFFFFF',
        scwTodayHighlight       = '#FFFF00';

    // Active Cell
    var scwHighlightText        = '#000000',
        scwHighlightBackground  = '#FFFF00';

    // Weekend Days
    var scwWeekendText          = '#CC6666',
        scwWeekendBackground    = '#FFFFFF';

    // Days out of current month
    var scwExMonthText          = '#999999',
        scwExMonthBackground    = '#FFFFFF';

    // Current month's weekdays
    var scwCellText             = '#000000',
        scwCellBackground       = '#FFFFFF';

    // Input date
    var scwInDateText           = '#FF0000',
        scwInDateBackground     = '#FFCCCC';

    // Disabled days
    var scwDisabledDayText       = '#993333',
        scwDisabledDayBackground = '#999999';

    document.writeln("<style>");
    document.writeln(   '.scw       {padding:2px;vertical-align:middle;}');
    document.writeln(   'iframe.scw {position:absolute;z-index:' + scwZindex    +
                                    ';top:0px;left:0px;visibility:hidden;'      +
                                    'width:1px;height:1px;}');
    document.writeln(   'table.scw  {padding:0px;visibility:hidden;'            +
                                    'position:absolute;width:200px;'            +
                                    'top:0px;left:0px;z-index:' + (scwZindex+1) +
                                    ';text-align:center;cursor:default;'        +
                                    'padding:1px;vertical-align:middle;'        +
                                    'background-color:' + scwBackground         +
                                    ';border:solid 1px #ffffff;font-size:10pt;'         +
                                    'font-family:Arial,Helvetica,Sans-Serif;'   +
                                    'font-weight:bold;}');
    document.writeln(   'td.scwHead     {padding:0px 0px;text-align:center;}');
    document.writeln(   'select.scwHead {margin:3px 1px;}');
    document.writeln(   'input.scwHead  {height:22px;width:22px;'               +
                                        'vertical-align:middle;'                +
                                        'text-align:center;margin:2px 1px;'     +
                                        'font-size:10pt;font-family:fixedSys;'  +
                                        'font-weight:bold;}');
    document.writeln(   'tr.scwWeek     {text-align:center;font-weight:bold;'   +
                                        'color:' + scwHeadText + ';}');
    document.writeln(   'td.scwWeek     {padding:0px;}');
    document.writeln(   'table.scwCells {text-align:right;font-size:8pt;'       +
                                        'width:96%;font-family:'                +
                                        'Arial,Helvetica,Sans-Serif;}');
    document.writeln(   'td.scwCells {padding:3px;vertical-align:middle;'       +
                                     'width:16px;height:16px;font-weight:bold;' +
                                     'color:' + scwCellText                     +
                                     ';background-color:' + scwCellBackground   +
                                     '}');
    document.writeln(   'td.scwFoot  {padding:0px;text-align:center;'           +
                                     'font-weight:normal;color:'                +
                                      scwTodayText + ';}');
    document.writeln("</style>");

    var scwTargetEle,
        scwSaveText,
        scwSaveBackground,
        scwMonthSum         = 0,
        scwBlnFullInputDate = false,
        scwPassEnabledDay   = new Array(),
        scwStartDate        = new Date(),
        scwSeedDate         = new Date(),
        scwParmActiveToday  = true,
        scwWeekStart        = scwWeekStart%7;

    // Add a method to format a date into the required pattern

    Date.prototype.scwFormat =
        function(scwFormat)
            {var charCount = 0,
                 codeChar  = '',
                 result    = '';

             for (var i=0;i<=scwFormat.length;i++)
                {if (i<scwFormat.length && scwFormat.charAt(i)==codeChar)
                        {// If we haven't hit the end of the string and
                         // the format string character is the same as
                         // the previous one, just clock up one to the
                         // length of the current element definition
                         charCount++;
                        }
                 else   {switch (codeChar)
                            {case 'y': case 'Y':
                                result += (this.getFullYear()%Math.pow(10,charCount)).
                                            toString().scwPadLeft(charCount);
                                break;
                             case 'm': case 'M':
                                // If we find an M, check the number of them to
                                // determine whether to get the month number or the
                                // month name.
                                result += (charCount<3)
                                            ?(this.getMonth()+1).
                                                toString().scwPadLeft(charCount)
                                            :scwArrMonthNames[this.getMonth()];
                                break;
                             case 'd': case 'D':
                                // If we find a D, get the date and format it
                                result += this.getDate().toString().scwPadLeft(charCount);
                                break;
                             default:
                                // Copy any unrecognised characters across
                                while (charCount-- > 0) {result += codeChar;}
                            }

                         if (i<scwFormat.length)
                            {// Store the character we have just worked on
                             codeChar  = scwFormat.charAt(i);
                             charCount = 1;
                            }
                        }
                }
             return result;
            }

    // Add a method to left pad zeroes

    String.prototype.scwPadLeft =
        function(padToLength)
            {var result = '';
             for (var i=0;i<(padToLength - this.length);i++) {result += '0';}
             return (result + this);
            }

    // "Escape" all the user defined date delimiters -
    // several delimiters will need it and it does no harm for the others.

    var scwExpDelimiters = new RegExp('[\\'+scwArrDelimiters.join('\\')+']','g');

    var scwExpValDay    = /^(0?[1-9]|[1-2]\d|3[0-1])$/,
        scwExpValMonth  = new RegExp("^(0?[1-9]|1[0-2]|"        +
                                     scwArrMonthNames.join("|") +
                                     ")$","i"),
        scwExpValYear   = /^(\d{1,2}|\d{4})$/;
    var moja_fun;
	 var moje_argumenty;
	 var moja_funkcja = function test(){eval(moja_fun+"(moje_argumenty)")};
	 
// *************************
// Start of Function Library
// *************************

    function showCal(scwEle,scwSourceEle)    {scwShow(scwEle,scwSourceEle);}
    function scwShow(scwEle,scwSourceEle,moja_f,moje_arg)
        {// Take any parameters that there might be from the third onwards as
         // day numbers to be disabled 0 = Sunday through to 6 = Saturday.
         if(typeof moja_f != 'undefined')
			   moja_fun = moja_f;
			else  
			   moja_fun = 'nofunction';
				
			moje_argumenty = moje_arg;
         scwParmActiveToday = true;

         for (var i=0;i<7;i++)
            {scwPassEnabledDay[(i+7-scwWeekStart)%7] = true;
             for (var j=2;j<arguments.length;j++)
                {if (arguments[j]==i)
                    {scwPassEnabledDay[(i+7-scwWeekStart)%7] = false;
                     if (scwDateNow.getDay()==i) scwParmActiveToday = false;
                    }
                }
            }

         //   If no value is preset then the seed date is
         //      Today (when today is in range) OR
         //      The middle of the date range.

         scwSeedDate = scwDateNow;

         // Strip space characters from start and end of date input
         scwEle.value = scwEle.value.replace(/^\s+/,'').replace(/\s+$/,'');

         if (scwEle.value.length==0)
            {// If no value is entered and today is within the range,
             // use today's date, otherwise use the middle of the valid range.

             scwBlnFullInputDate=false;

             if ((new Date(scwBaseYear+scwDropDownYears-1,11,31))<scwSeedDate ||
                 (new Date(scwBaseYear,0,1))                     >scwSeedDate
                )
                {scwSeedDate = new Date(scwBaseYear +
                                        Math.floor(scwDropDownYears / 2), 5, 1);
                }
            }
         else
            {// Parse the string into an array using the allowed delimiters
             scwArrSeedDate =
                 scwInputFormat(scwEle.value.split(scwExpDelimiters),
                                scwEle.value);

             // So now we have the Year, Month and Day in an array.

             //   If the year is one or two digits then the routine assumes a year
             //   belongs in the 21st Century unless it is less than 50 in which
             //   case it assumes the 20th Century is intended.

             if (scwArrSeedDate[0]<100)
                scwArrSeedDate[0] += (scwArrSeedDate[0]>50)?1900:2000;

             // Check whether the month is in digits or an abbreviation

             if (scwArrSeedDate[1].search(/\d+/)!=0)
                {month = scwArrMonthNames.join('|').toUpperCase().
                            search(scwArrSeedDate[1].substr(0,3).toUpperCase());
                 scwArrSeedDate[1] = Math.floor(month/4)+1;
                }

             scwSeedDate = new Date(scwArrSeedDate[0],
                                    scwArrSeedDate[1]-1,
                                    scwArrSeedDate[2]);
            }

         // Test that we have arrived at a valid date

         if (isNaN(scwSeedDate))
           {alert( scwInvalidDateMsg +
                    scwInvalidAlert[0] + scwEle.value +
                    scwInvalidAlert[1]);
             scwSeedDate = new Date(scwBaseYear +
                    Math.floor(scwDropDownYears/2),5,1);
             scwBlnFullInputDate=false;
            }
         else
            {// Test that the date is within range,
             // if not then set date to a sensible date in range.

             if ((new Date(scwBaseYear,0,1)) > scwSeedDate)
                {if (scwBlnStrict)  alert(scwOutOfRangeMsg);
                 scwSeedDate = new Date(scwBaseYear,0,1);
                 scwBlnFullInputDate=false;
                }
             else
                {if ((new Date(scwBaseYear+scwDropDownYears-1,11,31))<
                      scwSeedDate)
                    {if (scwBlnStrict) alert(scwOutOfRangeMsg);
                     scwSeedDate = new Date(scwBaseYear +
                                            Math.floor(scwDropDownYears)-1,
                                                       11,1);
                     scwBlnFullInputDate=false;
                    }
                 else
                    {if (scwBlnStrict && scwBlnFullInputDate &&
                          (scwSeedDate.getDate()      != scwArrSeedDate[2] ||
                           (scwSeedDate.getMonth()+1) != scwArrSeedDate[1] ||
                           scwSeedDate.getFullYear()  != scwArrSeedDate[0]
                          )
                        )
                        {alert(scwDoesNotExistMsg);
                         scwSeedDate = new Date(scwSeedDate.getFullYear(),
                                                scwSeedDate.getMonth()-1,1);
                         scwBlnFullInputDate=false;
                        }
                    }
                }
            }

         // Test the disabled dates for validity
         // Give error message if not valid.

         for (var i=0;i<scwDisabledDates.length;i++)
            {if (!((typeof scwDisabledDates[i]      == 'object') &&
                   (scwDisabledDates[i].constructor == Date)))
                {if ((typeof scwDisabledDates[i]      == 'object') &&
                     (scwDisabledDates[i].constructor == Array))
                    {var scwPass = true;

                     if (scwDisabledDates[i].length !=2)
                        {alert(scwRangeDisablingError[0] + scwDisabledDates[i] +
                               scwRangeDisablingError[1]);
                         scwPass = false;
                        }
                     else
                        {for (var j=0;j<scwDisabledDates[i].length;j++)
                            {if (!((typeof scwDisabledDates[i][j]      == 'object') &&
                                   (scwDisabledDates[i][j].constructor == Date)))
                                {alert(scwDateDisablingError[0] + scwDisabledDates[i][j] +
                                       scwDateDisablingError[1]);
                                 scwPass = false;
                                }
                            }
                        }

                     if (scwPass && (scwDisabledDates[i][0] > scwDisabledDates[i][1]))
                        {scwDisabledDates[i].reverse();}
                    }
                 else
                    {alert(scwDateDisablingError[0] + scwDisabledDates[i] +
                           scwDateDisablingError[1]);}
                }
            }

         // Calculate the number of months that the entered (or
         // defaulted) month is after the start of the allowed
         // date range.

         scwMonthSum =  12*(scwSeedDate.getFullYear()-scwBaseYear)+
                            scwSeedDate.getMonth();

         // Set the drop down boxes.

         document.getElementById('scwYears').options.selectedIndex =
            Math.floor(scwMonthSum/12);
         document.getElementById('scwMonths').options.selectedIndex=
            (scwMonthSum%12);

         // Position the calendar box

         var offsetTop =parseInt(scwEle.offsetTop ,10) +
                        parseInt(scwEle.offsetHeight,10),
             offsetLeft=parseInt(scwEle.offsetLeft,10);

//      if (scwCurrentStyle.outlineWidth) scwEle.style.outlineWidth=scwOutlineWidth;

         scwTargetEle=scwEle;

         do {scwEle=scwEle.offsetParent;
             offsetTop +=parseInt(scwEle.offsetTop,10);
             offsetLeft+=parseInt(scwEle.offsetLeft,10);
            }
         while (scwEle.tagName!='BODY' && scwEle.tagName!='HTML');

         document.getElementById('scw').style.top =offsetTop +'px';
         document.getElementById('scw').style.left=offsetLeft+'px';

         if (document.getElementById('scwIframe'))
            {document.getElementById('scwIframe').style.top=offsetTop +'px';
             document.getElementById('scwIframe').style.left=offsetLeft+'px';
             document.getElementById('scwIframe').style.width=
                (document.getElementById('scw').offsetWidth-2)+'px';
             document.getElementById('scwIframe').style.height=
                (document.getElementById('scw').offsetHeight-2)+'px';
             document.getElementById('scwIframe').style.visibility='visible';
            }

         // Display the month

         scwShowMonth(0);

         // Show it on the page

         document.getElementById('scw').style.visibility='visible';

         scwCancelPropagation(scwSourceEle);
        }

    function scwInputFormat(scwArrInput,scwEleValue)
        {var scwArrSeed = new Array();

         scwBlnFullInputDate = false;

         switch (scwArrInput.length)
            {case 1:
                {// Year only entry
                 scwArrSeed[0] = parseInt(scwArrInput[0],10);   // Year
                 scwArrSeed[1] = '6';                           // Month
                 scwArrSeed[2] = 1;                             // Day
                 break;
                }
             case 2:
                {// Year and Month entry
                 scwArrSeed[0] = parseInt(scwArrInput[scwDateInputSequence.replace(/D/i,'').search(/Y/i)],10);   // Year
                 scwArrSeed[1] = scwArrInput[scwDateInputSequence.replace(/D/i,'').search(/M/i)];                // Month
                 scwArrSeed[2] = 1;                             // Day
                 break;
                }
             case 3:
                {// Day Month and Year entry

                 scwArrSeed[0] = parseInt(scwArrInput[scwDateInputSequence.search(/Y/i)],10);   // Year
                 scwArrSeed[1] = scwArrInput[scwDateInputSequence.search(/M/i)];                // Month
                 scwArrSeed[2] = parseInt(scwArrInput[scwDateInputSequence.search(/D/i)],10);   // Day

                 scwBlnFullInputDate = true;
                 break;
                }
             default:
                {// A stuff-up has led to more than three elements in the date.
                 scwArrSeed[0] = 0;     // Year
                 scwArrSeed[1] = 0;     // Month
                 scwArrSeed[2] = 0;     // Day
                }
            }

         // Apply validation and report failures

         if (scwExpValYear.exec(scwArrSeed[0])  == null ||
             scwExpValMonth.exec(scwArrSeed[1]) == null ||
             scwExpValDay.exec(scwArrSeed[2])   == null)
             {alert(scwInvalidDateMsg  +
                    scwInvalidAlert[0] + scwEleValue + scwInvalidAlert[1]);
              scwBlnFullInputDate = false;
              scwArrSeed[0] = scwBaseYear + Math.floor(scwDropDownYears/2); // Year
              scwArrSeed[1] = '6';     // Month
              scwArrSeed[2] = 1;       // Day
             }

         // Return the  Year    in scwArrSeed[0]
         //             Month   in scwArrSeed[1]
         //             Day     in scwArrSeed[2]

         return scwArrSeed;
        }

    function scwSetOutput(scwOutputDate)
        {scwTargetEle.value = scwOutputDate.scwFormat(scwDateOutputFormat);
         scwHide();
        }

    function scwCellOutput(scwEvt)
        {var scwEle = eventTrigger(scwEvt),
             scwOutputDate = new Date(scwStartDate);

         if (scwEle.nodeType==3) scwEle=scwEle.parentNode;

         scwOutputDate.setDate(scwStartDate.getDate() +
                                 parseInt(scwEle.id.substr(8),10));

         scwSetOutput(scwOutputDate);
        }

    function scwFootOutput()
        {scwSetOutput(scwDateNow);}

    function scwCancelPropagation(scwSourceEle)
        {if (typeof event=='undefined')
                {scwSourceEle.parentNode.
                    addEventListener("click",scwStopPropagation,false);
                }
         else   {event.cancelBubble = true;}
        }

    function scwStopPropagation(scwEvt)
        {if (typeof event=='undefined')
              scwEvt.stopPropagation();
         else scwEvt.cancelBubble = true;
        }

    function scwHighlight(e)
        {var scwEle = eventTrigger(e);

         if (scwEle.nodeType==3) scwEle=scwEle.parentNode;

         scwSaveText        =scwEle.style.color;
         scwSaveBackground  =scwEle.style.backgroundColor;

         scwEle.style.color             =scwHighlightText;
         scwEle.style.backgroundColor   =scwHighlightBackground;

         return true;
        }

    function scwUnhighlight(e)
        {var scwEle = eventTrigger(e);

         if (scwEle.nodeType==3) scwEle =scwEle.parentNode;

         scwEle.style.backgroundColor   =scwSaveBackground;
         scwEle.style.color             =scwSaveText;

         return true;
        }

    function eventTrigger(e)
        {if (!e) e = event;
         return e.target||e.srcElement;
        }

    function scwCancel(e)
        {if (scwClickToHide) scwHide();
         scwStopPropagation(e);
        }

    function scwHide()
        {document.getElementById('scw').style.visibility='hidden';
         if (document.getElementById('scwIframe'))
            {document.getElementById('scwIframe').style.visibility='hidden';}
        }

    function scwFootOver()
        {document.getElementById('scwFoot').style.color=scwTodayHighlight;
         document.getElementById('scwFoot').style.fontWeight='bold';
        }

    function scwFootOut()
        {document.getElementById('scwFoot').style.color=scwTodayText;
         document.getElementById('scwFoot').style.fontWeight='normal';
        }

    function scwShowMonth(scwBias)
        {

         var scwShowDate  = new Date(Date.parse(new Date().toDateString()));

         scwSelYears  = document.getElementById('scwYears');
         scwSelMonths = document.getElementById('scwMonths');

         if (scwSelYears.options.selectedIndex>-1)
            {scwMonthSum=12*(scwSelYears.options.selectedIndex)+scwBias;
             if (scwSelMonths.options.selectedIndex>-1)
                {scwMonthSum+=scwSelMonths.options.selectedIndex;}
            }
         else
            {if (scwSelMonths.options.selectedIndex>-1)
                {scwMonthSum+=scwSelMonths.options.selectedIndex;}
            }

         scwShowDate.setFullYear(scwBaseYear + Math.floor(scwMonthSum/12),
                                 (scwMonthSum%12),
                                 1);

         if ((12*parseInt((scwShowDate.getFullYear()-scwBaseYear),10)) +
             parseInt(scwShowDate.getMonth(),10) < (12*scwDropDownYears)    &&
             (12*parseInt((scwShowDate.getFullYear()-scwBaseYear),10)) +
             parseInt(scwShowDate.getMonth(),10) > -1)
            {scwSelYears.options.selectedIndex=Math.floor(scwMonthSum/12);
             scwSelMonths.options.selectedIndex=(scwMonthSum%12);

             scwCurMonth = scwShowDate.getMonth();

             scwShowDate.setDate((((scwShowDate.getDay()-scwWeekStart)<0)?-6:1)+
                                 scwWeekStart-scwShowDate.getDay());

             scwStartDate = new Date(scwShowDate);

             var scwFoot = document.getElementById('scwFoot');

             if (scwDisabledDates.length==0)
                {if (scwActiveToday && scwParmActiveToday)
                    {scwFoot.onclick     =scwFootOutput;
                     scwFoot.onmouseover =scwFootOver;
                     scwFoot.onmouseout  =scwFootOut;
                     scwFoot.style.cursor=(document.getElementById('scwIframe'))
                                            ?'hand':'pointer';
                    }
                 else
                    {scwFoot.onclick     =null;
                     if (document.addEventListener)
                            {scwFoot.addEventListener('click',scwStopPropagation, false);}
                     else   {scwFoot.attachEvent('onclick',scwStopPropagation);}
                     scwFoot.onmouseover =null;
                     scwFoot.onmouseout  =null;
                     scwFoot.style.cursor='default';
                    }
                }
             else
                {for (var k=0;k<scwDisabledDates.length;k++)
                    {if (!scwActiveToday || !scwParmActiveToday ||
                         ((typeof scwDisabledDates[k] == 'object')                      &&
                             (((scwDisabledDates[k].constructor == Date)                &&
                               scwDateNow.valueOf() == scwDisabledDates[k].valueOf()
                              ) ||
                              ((scwDisabledDates[k].constructor == Array)               &&
                               scwDateNow.valueOf() >= scwDisabledDates[k][0].valueOf() &&
                               scwDateNow.valueOf() <= scwDisabledDates[k][1].valueOf()
                              )
                             )
                         )
                        )
                        {scwFoot.onclick     =null;
                         if (document.addEventListener)
                                {scwFoot.addEventListener('click',scwStopPropagation, false);}
                         else   {scwFoot.attachEvent('onclick',scwStopPropagation);}
                         scwFoot.onmouseover =null;
                         scwFoot.onmouseout  =null;
                         scwFoot.style.cursor='default';
                         break;
                        }
                     else
                        {scwFoot.onclick     =scwFootOutput;
                         scwFoot.onmouseover =scwFootOver;
                         scwFoot.onmouseout  =scwFootOut;
                         scwFoot.style.cursor=(document.getElementById('scwIframe'))
                                                ?'hand':'pointer';
                        }
                    }
                }

             var scwCells = document.getElementById('scwCells');

             for (i=0;i<scwCells.childNodes.length;i++)
                {var scwRows = scwCells.childNodes[i];
                 if (scwRows.nodeType==1 && scwRows.tagName=='TR')
                    {for (j=0;j<scwRows.childNodes.length;j++)
                        {var scwCols = scwRows.childNodes[j];
                         if (scwCols.nodeType==1 && scwCols.tagName=='TD')
                            {scwRows.childNodes[j].innerHTML=
                                    scwShowDate.getDate();

                             var scwCellStyle=scwRows.childNodes[j].style,
                                 scwDisabled = (scwOutOfRangeDisable &&
                                                 (scwShowDate < (new Date(scwBaseYear,0,1)) ||
                                                  scwShowDate > (new Date(scwBaseYear+scwDropDownYears-1,11,31))
                                                 ))?true:false;

                             for (var k=0;k<scwDisabledDates.length;k++)
                                {if ((typeof scwDisabledDates[k]      == 'object')  &&
                                     (scwDisabledDates[k].constructor == Date)      &&
                                     scwShowDate.valueOf() == scwDisabledDates[k].valueOf())
                                    {scwDisabled = true;}
                                 else
                                    {if ((typeof scwDisabledDates[k]      == 'object') &&
                                         (scwDisabledDates[k].constructor == Array)    &&
                                         scwShowDate.valueOf() >= scwDisabledDates[k][0].valueOf() &&
                                         scwShowDate.valueOf() <= scwDisabledDates[k][1].valueOf())
                                        {scwDisabled = true;}
                                    }
                                }

                             if (scwDisabled ||
                                 !scwEnabledDay[j+(7*((i*scwCells.childNodes.length)/6))] ||
                                 !scwPassEnabledDay[(j+(7*((i*scwCells.childNodes.length)/6)))%7]
                                )
                                {scwRows.childNodes[j].onclick     =null;
                                 scwRows.childNodes[j].onmouseover =null;
                                 scwRows.childNodes[j].onmouseout  =null;
                                 scwRows.childNodes[j].style.cursor='default';
                                 scwCellStyle.color=scwDisabledDayText;
                                 scwCellStyle.backgroundColor=
                                     scwDisabledDayBackground;
                                }
                             else
                                {scwRows.childNodes[j].onclick      =scwCellOutput;
                                 scwRows.childNodes[j].onmouseover  =scwHighlight;
                                 scwRows.childNodes[j].onmouseout   =scwUnhighlight;
                                 scwRows.childNodes[j].style.cursor =(document.getElementById('scwIframe'))
                                                                        ?'hand':'pointer';

                                 if (scwShowDate.getMonth()!=scwCurMonth)
                                    {scwCellStyle.color=scwExMonthText;
                                     scwCellStyle.backgroundColor=
                                         scwExMonthBackground;
                                    }
                                 else if (scwBlnFullInputDate &&
                                          scwShowDate.toDateString()==
                                          scwSeedDate.toDateString())
                                    {scwCellStyle.color=scwInDateText;
                                     scwCellStyle.backgroundColor=
                                         scwInDateBackground;
                                    }
                                 else if (scwShowDate.getDay()%6==0)
                                    {scwCellStyle.color=scwWeekendText;
                                     scwCellStyle.backgroundColor=
                                         scwWeekendBackground;
                                    }
                                 else
                                    {scwCellStyle.color=scwCellText;
                                     scwCellStyle.backgroundColor=
                                         scwCellBackground;
                                    }
                                }

                             scwShowDate.setDate(scwShowDate.getDate()+1);
                            }
                        }
                    }
                }
            }
        }
   function nofunction(){};
    document.write(
     "<!--[if IE]>" +
        "<iframe class='scw' src='javascript:void(0);' " +
                "id='scwIframe' name='scwIframe' " +
                "frameborder='0'>" +
        "</iframe>" +
     "<![endif]-->" +
     "<table id='scw' class='scw'>" +
       "<tr class='scw'>" +
         "<td class='scw'>" +
           "<table class='scwHead' id='scwHead' " +
                    "cellspacing='0' cellpadding='0' width='100%'>" +
            "<tr class='scwHead'>" +
                "<td class='scwHead'>" +
                    "<input class='scwHead' type='button' value='<' " +
                            "onclick='scwShowMonth(-1);'  /></td>" +
                 "<td class='scwHead'>" +
                    "<select id='scwMonths' class='scwHead' " +
                            "onChange='scwShowMonth(0);'>");

    for (i=0;i<scwArrMonthNames.length;i++)
        document.write(   "<option>" + scwArrMonthNames[i] + "</option>");

    document.write("   </select>" +
                 "</td>" +
                 "<td class='scwHead'>" +
                    "<select id='scwYears' class='scwHead' " +
                            "onChange='scwShowMonth(0);'>");

    for (i=0;i<scwDropDownYears;i++)
        document.write(   "<option>" + (scwBaseYear+i) + "</option>");

    document.write(   "</select>" +
                 "</td>" +
                 "<td class='scwHead'>" +
                    "<input class='scwHead' type='button' value='>' " +
                            "onclick='scwShowMonth(1);' /></td>" +
                "</tr>" +
              "</table>" +
            "</td>" +
          "</tr>" +
          "<tr class='scw'>" +
            "<td class='scw'>" +
              "<table class='scwCells' align='center'>" +
                "<thead class='scwWeek'>" +
                  "<tr  class='scwWeek'>");

    for (i=0;i<scwArrWeekInits.length;i++)
        document.write( "<td class='scwWeek' id='scwWeekInit" + i + "'>" +
                          scwArrWeekInits[(i+scwWeekStart)%scwArrWeekInits.length] +
                        "</td>");

    document.write("</tr>" +
                "</thead>" +
                "<tbody class='scwCells' id='scwCells'>");

    for (i=0;i<6;i++)
        {document.write(
                    "<tr class='scwCells'>");
         for (j=0;j<7;j++)
            {document.write(
                        "<td class='scwCells' id='scwCell_" + (j+(i*7)) +
                        "'></td>");
            }

         document.write(
                    "</tr>");
        }

    document.write(
                "</tbody>");

    if ((new Date(scwBaseYear + scwDropDownYears, 11, 32)) > scwDateNow &&
        (new Date(scwBaseYear, 0, 0))                      < scwDateNow)
        {document.write(
                  "<tfoot class='scwFoot'>" +
                    "<tr class='scwFoot'>" +
                      "<td class='scwFoot' id='scwFoot' colspan='7'>" +
                        scwToday + " " +
                        scwDateNow.scwFormat(scwDateDisplayFormat) +
                      "</td>" +
                    "</tr>" +
                  "</tfoot>");
        }

    document.write(
              "</table>" +
            "</td>" +
          "</tr>" +
        "</table>");
   
    if (document.addEventListener)
        {document.addEventListener('click',scwHide, false);
         document.getElementById('scw').addEventListener('click',scwCancel,false);
         document.getElementById('scwHead').addEventListener('click',scwStopPropagation,false);
         document.getElementById('scwCells').addEventListener('click',scwStopPropagation,false);
			document.getElementById('scwCells').addEventListener('click',moja_funkcja,false);
        }
    else
        {document.attachEvent('onclick',scwHide);
         document.getElementById('scw').attachEvent('onclick',scwCancel);
         document.getElementById('scwHead').attachEvent('onclick',scwStopPropagation);
         document.getElementById('scwCells').attachEvent('onclick',scwStopPropagation);
		   document.getElementById('scwCells').attachEvent('onclick',moja_funkcja);
        }


