My JavaScript seems to crash when I instantiate a new Date Object
<p>I am new to JavaScript with this being my first little app. I am working on this Calendar / Date Time Picker program. I seem to have entered a nightmare scenario where the app crashes and I cannot figure out what is doing the crashing. After some primitive sleuthing (ie successive document.writes to pinpoint the line which kills it, I seem to have narrowed in on a very innocent line of code:</p>

<pre><code>month_start = new Date(this.Year, this.Month, 1);
</code></pre>

<p>this.Year and this.Month are attributes of the class/parent function. I checked them and they both contain valid values at this point. I placed a document.write before this line and it displays, but immediately following this line the program is not responsive and does not display a document.write.</p>

<p>Is there some kind of JavaScript 101 mistake I am making here?</p>

<p>This line is inside a pretty small function. The whole function looks like this:</p>

<pre><code>function Display_Calendar_Week(x, month_days){
ds = '';
d=0;
//for the first day of the month, start at the appropriate day of the week
if(x==1)
{
    //first date of current month and year

    month_start = new Date(this.Year, this.Month, 1);

    d = month_start.getDay();
}
for(j=0;j&lt;7;j++)
{
    if( (j&lt;d) || (x &gt; month_days))
    {
        ds +=('&lt;div class="Calendar_Day_Square_Empty"&gt;&lt;/div&gt;');
    }
    else
    {
        if((x==RightNow_Date) &amp;&amp; (RightNow_Month==this.Month) &amp;&amp; (RightNow_Year==this.Year))
        {

            ds +=('&lt;div class="Calendar_Day_Square_Today" onClick="'+this.InstanceName+'.Select_Date(\''+ this.PageElement +'\', '+ this.Year +', '+ this.Month +', '+ x +');"&gt;' + x + '&lt;/div&gt;');
        }
        else if((x==this.Selected_Date) &amp;&amp; (this.Selected_Month==this.Month) &amp;&amp; (this.Selected_Year==this.Year))
        {
            ds +=('&lt;div class="Calendar_Day_Square_Selected" onClick="'+this.InstanceName+'.Select_Date(\''+ this.PageElement +'\', '+ this.Year +', '+ this.Month +', '+ x +');"&gt;' + x + '&lt;/div&gt;');
        }
        else
            ds +=('&lt;div class="Calendar_Day_Square" onClick="'+this.InstanceName+'.Select_Date(\''+ this.PageElement +'\', '+ this.Year +', '+ this.Month +', '+ x +');"&gt;' + x + '&lt;/div&gt;');
        x++;
    }
}
return [x, ds];
</code></pre>

<p>}</p>
