Rico.loadModule('Effect');
var EffectDemo,calc_div;
Rico.onLoad( function() {
  EffectDemo = Class.create();
  EffectDemo.prototype = {
    initialize: function(element) {
      this.animator = new Rico.Effect.Animator();
      this.element = $(element);
      this.startLeft = this.element.offsetLeft;
    },
    positionEffectStarted: false,
    play: function(effect) {
      this.animator.play(effect, {steps:15, duration:500});
    },
    togglePosition: function(){
      this.play(new Rico.Effect.Position(this.element, this.nextPosition(), null));
    },
    nextPosition: function(){
      this.positionEffectStarted = !this.positionEffectStarted;
      return !this.positionEffectStarted ? this.startLeft : -276;
    },
    toggleLeft: function(){
	if(!this.positionEffectStarted)
	 {
      this.play(new Rico.Effect.Position(this.element, this.leftPosition(), null));
	 }
    },
    leftPosition: function(){
      this.positionEffectStarted = !this.positionEffectStarted;
      return -276;
    }
  };
  calc_div = new EffectDemo('calc_outer_div');
});

