// textarea control functions

// generates and returns the HTML code for the control
function textareaControlGenerageHtml( formId, controlDescription )
{
  var output = "";
  
  if ( controlDescription['caption'] )
    output += controlDescription['caption'];
    
  output += "<div class=\"multilinetextinput\"><textarea id=\""+getInternalControlId( formId, controlDescription )+"\" value=\"\" "+ ( controlDescription['maxLength'] ? "maxlength=\""+ controlDescription['maxLength'] +"\" " : "" ) +"onkeyup=\"javascript: saveControlValue('"+formId+"', '"+controlDescription['id']+"', this.value);\" onblur=\"javascript: saveControlValue('"+formId+"', '"+controlDescription['id']+"', this.value);\" onmouseup=\"javascript: saveControlValue('"+formId+"', '"+controlDescription['id']+"', this.value);\"></textarea></div>"
  
  return output;
}

// Sets the properties of the control to the ones, set in control description
function textareaControlPopulateProperties( formId, controlDescription )
{
  textControlPopulateProperties( formId, controlDescription );
}

//   Adds the new textarea control description to the form, given
// and returns updated form
//   The form must be a valid form
//   If there already is a control with ID, given, it will be replaced
// with new
function textareaControlAddToForm( id, defaultValue, caption, maxLength )
{
  this.addBaseControl( id, defaultValue );
  
  this['fields'][id]['type'] = 'textarea';
  this['fields'][id]['caption'] = caption;
  this['fields'][id]['maxLength'] = maxLength;
}