if(!kronos)
  kronos = {}

YUI.add('row', function(Y) {

var Row = function(config) {
  this.name       = config.name;
  this.id         = config.id;
  this.controller = config.controller;
  this.group      = config.group;
  
  var that = this;
  var nodeId      = '#' + this.id;
  this.element    = Y.one(nodeId);
}

//-----------------------------------------------------------------------------------------------------------
//                                              ANIMATION
//===========================================================================================================

Row.prototype.setupAnimation = function(cfg) {
  if(this._anim) {
    this._anim.stop();
    this._anim = null;
  }
  
  var that = this;
  
  var node = Y.one('#' + this.id);
  var anim = new Y.Anim({
    duration : kronos.ROW_EXPANSION_TIME,
    node : node,
    from : cfg.from, to : cfg.to
  });
  anim.on('end', function() { that.endAnimationHandler(anim); });
  
  this._anim = anim;
}

Row.prototype.animate = function(forward) {
  this._anim.run();
}

Row.prototype.stopAnimation = function() {
  
}

Row.prototype.endAnimationHandler = function(anim) {
  if(this.endAnimationListener) {
    var evt = { group : this.group }
    this.endAnimationListener(evt);
  }
}

kronos.Row = Row;

}, '1.0.0' /* module version */, {
  requires: ['base', 'node']
});
