//opsIsDebugOn = 'con';

YAHOO.namespace("OPS");

YAHOO.OPS.AnimBase = function(opts) {
};

YAHOO.OPS.AnimBase.prototype = {
    initParams: function() {
	// Determine highest speed.
	speedFactor = 1;
	for(var i in this.els) {
	    if(this.els[i].speed > speedFactor)
		speedFactor = this.els[i].speed;
	}

	// Normalize speeds so highest speed is 1.
	if(speedFactor > 1) {
	    if(this.opts.speed)
		this.opts.speed = this.opts.speed/speedFactor;
	    for(var i in this.els)
		this.els[i].speed = this.els[i].speed/speedFactor;
	}

	// Determine highest step resolution for all elements.
	resolution = 1;
	for(var i in this.els) {
	    this.els[i].resolution = 1/this.els[i].speed;
	    //opsDebugDump(this.els[i].resolution, this.els[i], 1);
	    if(this.els[i].resolution > resolution)
		resolution = this.els[i].resolution;
	}

	// Determine duration if needed.
	if(this.opts.duration)
	    duration = this.opts.duration;
	else {
	    duration = 0;
	    for(var i in this.els) {
		duration += (this.opts.speed/this.els[i].speed)*this.els[i].nSteps;
	    }
	}

	nSteps = 0;
	for(var i in this.els)
	    nSteps += this.els[i].nSteps*resolution;

	this.resolution = resolution;
	this.duration = duration;
	this.nSteps = nSteps;
	this.curEl = 0;
    }

};

YAHOO.lang.augmentProto(YAHOO.OPS.AnimBase, YAHOO.util.EventProvider);

