
function sEffects(oElement){
  
  var _element = createSElement(oElement);
  var _this = this;
  
  var options = new Array(); 
  var animIndex = -1;
  
  var _timeOut = false;
  

  function nextLevel(){
    animIndex++;
    window.clearTimeout(_timeOut);
    if (options[animIndex]){
      var nL = options[animIndex];

      
      switch(nL.type){
        case "h":
          hS(nL.n, nL.step);
          break;
        case "v":
          vS(nL.n, nL.step);
          break;
        case "o":
          opacity(nL.n, nL.step);
          break;
        case "w":
          wait(nL.n);
          break;
        case "lr":
          lr(nL.n, nL.step);
          break;
        case "ud":
          ud(nL.n, nL.step);
          break;
        case "slr":
          slr(nL.n, nL.step);
          break;
        case "func": 
          nL.func();
          nextLevel();
          break;
        default:
          
          break;
      }
    }
  }
  
  this.play = function(){
    animIndex = -1;
    nextLevel();
  }
  
  this.createAnimation = function(oArr){ options = oArr; }
  this.clearAnimation = function(){ options = new Array(); }
  this.addEffect = function(oO){ options[options.length] = oO; }
  
  function wait(n){
    if ( n > 0 )
      _timeOut = window.setTimeout(function(){
        wait(n-1);
      }, 1);
    else nextLevel();
  }
  
  function hS(n, step){ //horizontal size
    if ( n > Math.abs(step) )
      _timeOut = window.setTimeout(function(){
        hS(n-Math.abs(step), step);
      }, 1);
    else nextLevel();
    
    var s = step;
    if (n < Math.abs(step))
      s = (step < 0) ? n*(-1) : n;
    
    _element.setWidth(_element.getWidth()+step);
    _element.setLeft(_element.getLeft()-Math.round(step/2));
  }
  
  function vS(n, step){ //vertical size
    if ( n > Math.abs(step) )
      _timeOut = window.setTimeout(function(){
        vS(n-Math.abs(step), step);
      }, 1);
    else nextLevel();
    
    var s = step;
    if (n < Math.abs(step))
      s = (step < 0) ? n*(-1) : n;
    _element.setHeight(_element.getHeight()+s);
    _element.setTop(_element.getTop()-Math.round(step/2));
  }
  
  function slr(n, step){ //scroll left/right 
    if ( n > 0 )
      _timeOut = window.setTimeout(function(){
        slr(n-Math.abs(step), step);
      }, 1);
    else nextLevel();
    
    _element.setScrollLeft(step);
  }
  
   function sud(n, step){ //scroll up/down 
    if ( n > 0 )
      _timeOut = window.setTimeout(function(){
        lr(n-Math.abs(step), step);
      }, 1);
    else nextLevel();
    
    _element.setScrollLeft(step);
  }
  
  function lr(n, step){ //move left/right 
    if ( n > 0 )
      _timeOut = window.setTimeout(function(){
        lr(n-Math.abs(step), step);
      }, 1);
    else nextLevel();
    
    _element.setLeft(_element.getLeft()+step);
  }
  
  function ud(n, step){ //move up/down 
    if ( n > 0 )
      _timeOut = window.setTimeout(function(){
        ud(n-Math.abs(step), step);
      }, 1);
    else nextLevel();
    
    _element.setTop(_element.getTop()+step);
  }
  
  function opacity(n, step){
    if ( n > 0 )
      _timeOut = window.setTimeout(function(){
        opacity(n-Math.abs(step), step);
      }, 1);
    else nextLevel();
    
    _element.setOpacity(_element.getOpacity()+step);
  }
}
