WYSIWYG Javascript Error
<p>The buttons on the WYSIWYG for my forum aren't working. I've isolated it to an error in the javascript file referencing line 12. The error firebug is throwing is:</p>

<pre><code>Uncaught TypeError: Cannot read property 'value' of undefined
</code></pre>

<p>Line 12 is part of the surroundText function, pasted below:</p>

<pre><code>// Surrounds the selected text with text1 and text2.
function surroundText(tag1, tag2, myarea)
{
    if (document.selection) //IE
    {
        myarea.focus();
        var sel = document.selection.createRange();
        sel.text = tag1 + sel.text + tag2;
    }
    else //Other Browsers
    {
        var len = myarea.value.length;
        var start = myarea.selectionStart;
        var end = myarea.selectionEnd;
        var scrollTop = myarea.scrollTop;
        var scrollLeft = myarea.scrollLeft;
        var sel = myarea.value.substring(start, end);
        var rep = tag1 + sel + tag2;
        myarea.value =  myarea.value.substring(0,start) + rep + myarea.value.substring(end,len);
        myarea.scrollTop = scrollTop;
        myarea.scrollLeft = scrollLeft;
    }
}
</code></pre>

<p>Line 12:</p>

<pre><code>var len = myarea.value.length;
</code></pre>

<p>If I comment out line 12, the error just moves onto line 13. I don't know javascript well enough to determine what the problem is. However, I was hoping I could lead smarter people as close to the problem as possible.</p>

<p>Thanks for the help!</p>
