function FillInManager(span) {
  var mySelf = this

  // Superclass Constructor
  top.glbDict.makeWidgetManager(this,span)

  mySelf.getServerUpdates = function() {
      var out = [ '( "' + mySelf.span.getAttribute('id') + '" , "_clientSetValue" , "' + encodeURIComponent(mySelf.inp.value) + '" )' ]
      return out
    }

  mySelf.beforeEvent = function (evtName, method, extra ) {
    // IE Needs this
    //mySelf.dirty = 1
  }

  mySelf.enable = function(tf) {
    if (tf) {
      mySelf.inp.disabled = 0
    }
    else {
      mySelf.inp.disabled = 1
    }
  }

  mySelf.attrChange = function(attrName,attrVal) {
      // Deal with change in the 'disabled' property
      if (attrName == 'disabled') {
        if (attrVal != 'false') {
          inst.enable(0)
        }
        else inst.enable(1)
      }
      if (attrName == 'readonly') {
        if (attrVal == 'true') {
          mySelf.inp.readonly = 1
        }
        else {
          mySelf.inp.readonly = 0
        }
      }
  }

  mySelf.postLeave = function () {
    var d = new Date()
    if ( d - mySelf.init_date > 1000 ) {
      top.glbDict.queueServerEvent( mySelf.span , 'leave' , false, '0' )
    }
  }
    mySelf.handleKey = function(eType,evt) {
    evt = (evt) ? evt : ((event) ? event : null)
    if (evt) {
      var elem = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
      if (elem) {
        elem = ((elem.nodeType == 1) || (elem.nodeType == 9)) ? elem : elem.parentNode
        var keyC = (mySelf.span.ownerDocument.all) ? evt.keyCode : evt.which

        switch(keyC) {
          case 13: // Page Up
            top.glbDict.queueServerEvent(mySelf.span,'key_enter', false , '' )
            break
        }
      }
      else {
        //alert('Unable to determine element!')
      }
    }
    else {
      //alert('Unable to determine event!')
    }
  }


  mySelf.initialize = function () {
    mySelf.inp = mySelf.span.getElementsByTagName('INPUT')[0] 
    mySelf.watchChild( mySelf.inp )
    try {

      if ( mySelf.inp.value != '' ) {
        mySelf.inp.setAttribute('value' , decodeURIComponent( mySelf.inp.getAttribute('value') ) )
        mySelf.inp.value = decodeURIComponent( mySelf.inp.value )
      }
    }
    catch(e) {
      //alert('uwfillin.js: uh oh')
    }

    // IE will sometimes not allow mouse entry into an enabled INPUT element
    // within IFRAMEs that have a higher zIndex than the background screen.
    // Appears to be related to fact that INPUT controls are native Windows
    // controls and not IE specific controls, so they are separate windows,
    // which should change in IE 7.  At any rate, forcing the 'selection'
    // of an empty range in each seems to alleviate the problem.
    if (document.all && !(window.opera)) {
      r = mySelf.inp.createTextRange()
      r.moveStart('textedit',1)
      r.select()
    }

    mySelf.init_date = new Date()
    top.glbDict.addEvent( mySelf.inp, 'blur' , mySelf.postLeave , [] )

    // get key events
    top.glbDict.addEvent(mySelf.inp,'onkeydown', mySelf.handleKey , ['keyup'] )

  }
  return mySelf
}

top.glbDict.uwWidgetFactory.registerWidgetClass('FillIn',FillInManager)

