var IWOV_FX = function() {
  return {

    fadeIn: function(objId, steps, millisPerStep) {
      var duration = 0;
      var alpha = 0;
      for (s=0; s<=steps; s++) {
        var delay = s*millisPerStep;
        alpha = alpha + parseInt(100/steps);
        var meth = "IWOV_FX.setAlpha('"+objId+"', "+ alpha +")";
        setTimeout(meth, delay);
        duration = delay;
      }
      return duration;
    },

    fadeOut: function(objId, steps, millisPerStep) {
      var duration = 0;
      var alpha = 100;
      for (s=0; s<=steps; s++) {
        var delay = s*millisPerStep;
        alpha = alpha - parseInt(100/steps);
        var meth = "IWOV_FX.setAlpha('"+objId+"', "+ alpha +")";
        setTimeout(meth, delay);
        duration = delay;
      }
      return duration;
    },

    setAlpha: function(objId, alpha) {
      var obj = null;
      if (objId) {
        try {
          obj = document.getElementById(objId);
        } catch (objNotFound) {
          try {
            obj = eval(objId);
          } catch (invalidObjId) {}
        }
      }
      if (obj) {
        var a = alpha;
        if (a==null || a<0) {
          a = 0;
        } else if (a>100) {
          a = 100;
        }
        try {
           //alert('setting ' + obj + ' to ' + a);
          obj.style.opacity = a/100;
          obj.style.MozOpacity = a/100;
          obj.style.filter = "alpha(opacity="+a+")";
          if (obj.style.visibility == 'hidden') {
            obj.style.visibility = 'inherit';
          }
        } catch (invalidObj) {
          alert(invalidObj);
        }
      }
    }

  };
}();

