   
   function fSimpleFader(id) {
      if (!id) return;
      this.obj = document.getElementById(id);
      if (!this.obj) {
         throw 'Element with id "'+id+'" not found';
      }
   }
   
   fSimpleFader.prototype = {

      obj: null,
      delay: 10,
      level: 0,
      step: 1,
      
      onFinished: null,
      
      setSpeed: function(sp) {
         this.delay = sp;
      },
      
      setStep: function(st) {
         this.step = st; 
      },
      
      setObject: function(obj) {
         this.obj = obj;
      },

      fadeIn: function() {         
         this._doFade(true);
      },

      fadeOut: function() {
         this.level = 100;
         this._doFade(false);
      },
      
      
      _doFade: function(dir) {
         var me=this;
         this.level += dir ? this.step :  -1 * this.step;
         if (!this.setOpacity()) {
            //dump('setOpacity failed - hard toggle\n');
            this.obj.style.display=(dir?'block':'none');
            this.level=(dir?100:0);
         }
         if ((!dir && this.level > 0) || (dir && this.level < 100)) {
            this.thread=setTimeout(function(){me._doFade(dir);},this.delay);
         } else if (typeof this.onFinished == 'function') {
            this.onFinished(dir);
         }
      },
      
      setOpacity: function() {
         // TODO: browser check?
         var style=this.obj.style;         
         style.opacity= (this.level/100);         
         style.filter='alpha(opacity=' + this.level + ')';
         return true;
      }
      
   }
