/**
 * Makes a textarea resizeable.
 *
 * @param id The id of the textarea
 */
function ResizeableTextArea( id ) {
    
    this.domElement = document.getElementById( id ) ;
    
    this.init = function () {
        this.domElement.style.marginBottom = "0px";
        var handle = document.createElement( "div" );
        handle.className = "resize-handle";
        handle.setAttribute( "title" , "Grösse des Textfeldes anpassen" );
        var _textArea = this.domElement;
        handle.onmousedown = function (event) {
            var _this = this;
            document.body.style.cursor = "s-resize";
                _textArea.style.cursor = "s-resize";
            document.body.onmousemove = function (event) {
                var h = event.pageY - _textArea.offsetTop - 6;
                if ( h >= 60 ) {
                    _textArea.style.height = h + "px";
                }
                //_textArea.value += h + "px\n";
            };
            
            var stopResizing = function () {
                this.onmousemove = null;
                document.body.style.cursor = "auto";
                _textArea.style.cursor = "text";
            };
            document.body.onmouseup = stopResizing;
            document.body.onblur = stopResizing;
        };
        this.domElement.parentNode.appendChild( handle );
    };

    if ( this.domElement ) {
        this.init();
    }
    return this;
}
