function fw_text(id)
{
  this.elem = document.getElementById(id);
  if (!this.elem)
  {
    alert("unable to find text instance " + id);
  }
}

fw_text.prototype.get_id = function()
{
  return this.elem.getAttribute("id");
}

fw_text.prototype.is_enabled = function() 
{
  return eval(this.elem.getAttribute("iw_enabled"));
}

fw_text.prototype.set_enabled = function(enabled)
{
  if (enabled == this.is_enabled()) 
  {
    return;
  }

  this.elem.setAttribute("iw_enabled", enabled);
  this.elem.setAttribute(fwIsIE ? "className" : "class", 
                         this.elem.getAttribute(enabled ? "iw_css_enabled" : "iw_css_disabled"));
  if (!enabled)
  {
    this.elem.setAttribute("readonly", true);
    this.elem.setAttribute("disabled", true);
  }
  else
  {
    this.elem.removeAttribute("readonly");
    this.elem.removeAttribute("disabled");
  }
}



IWText.APIID="iwtext";
IWAPI._doInheritance(IWText,IWFormElement);
IWAPI.registerAPI(IWText.APIID,IWText);

function IWText()
{
}

IWText.prototype.getType = function()
{
    return "text";
}

IWText.prototype.init = function()
{
    this.oldValue = this.value;
}

IWText.prototype.handleBlur = function()
{
    if (this.oldValue != this.value)
    {
        var event = new IWItemChangedEvent(this);
        event._setOldValue(this.oldValue);
        this.oldValue = this.value;
        IWPage.getEventRegistry().fireEvent(event);
    }
}
