function aniLayer(oWin, sName, x, y, w, h, z, DEBUG) {
	this.window = oWin;
	this.name = sName;
	this.id = sName.replace(/\W/g,"") + "Id"; 
	this.x = x;
	this.y = y;
	this.w = w;
	this.h = h;
	this.z = z;
	if (DEBUG) { alert("Name: " + sName + " x: " + x + " y: " + y + " w: " + w + " h: " + h + " z: " + z); }
	// New Properties
	this.aniInterval;
	this.fadeInterval;
	this.totalFrames;
	this.currentFrame = 1;
	this.fps = 30;
	this.ease = 0;
	this.bounce = 1;
	this.sX;
	this.sY;
	this.sW;
	this.sH;
	this.distX;
	this.distY;
	this.distW;
	this.distH;
	this.isPlaying = false;
}
aniLayer.prototype = new dynLayer(window, "nullObject", 0, 0, 0, 0, 0);
aniLayer.prototype.slideTo = function(EASE, FRAMES, X, Y, W, H) {
	this.ease = EASE;
	this.totalFrames = FRAMES;
	this.sX = this.getX();
	this.sY = this.getY();
	this.sW = this.getWidth();
	this.sH = this.getHeight();
	this.distX = X - this.sX;
	this.distY = Y - this.sY;
	
	if (typeof W != "undefined") {
		this.distW = W - this.sW;
	} else {
		this.distW = 0;
	}
	if (typeof H != "undefined") {
		this.distH = H - this.sH;
	} else {
		this.distH = 0;
	}
	
	this.playAni();
};
aniLayer.prototype.playAni = function() {
	if (this.isPlaying) { return; }
	if (this.totalFrames == undefined) {
		return;
	}
	this.aniInterval = setInterval(this.name + ".update()", 1000 / this.fps);
	this.isPlaying = true;
	if (this.onPlay) {
		this.onPlay();
	}
};
aniLayer.prototype.update = function() {
	var framePercent = this.currentFrame / this.totalFrames;
	var easePercent = ((this.ease - (this.ease * framePercent)) / 100) * this.bounce;
	if (this.distX != 0) {
		this.setX(this.sX + (this.distX * framePercent) + ((this.distX * framePercent) * easePercent));
	}
	if (this.distY != 0) {
		this.setY(this.sY + (this.distY * framePercent) + ((this.distY * framePercent) * easePercent));
	}
	if (this.distW != 0) {
		var newWidth = Math.round(this.sW + (this.distW * framePercent) + ((this.distW * framePercent) * easePercent));
		if (this.maxWidth && (this.getX() + newWidth) > this.maxWidth) {
			newWidth = this.maxWidth - this.getX();
		}
		this.setWidth(newWidth);
	}
	if (this.distH != 0) {
		var newHeight = Math.round(this.sH + (this.distH * framePercent) + ((this.distH * framePercent) * easePercent));
		if (this.maxHeight && (this.getY() + newHeight) > this.maxHeight) {		
			newHeight = this.maxHeight - this.getY();
		}
		this.setHeight(newHeight);
	}
	if (this.currentFrame++ == this.totalFrames) {
		this.currentFrame = 1;
		this.stopAni();
	}
	if (this.onUpdate) { this.onUpdate(this.currentFrame); }
};

aniLayer.prototype.stopAni = function() {
	clearInterval(this.aniInterval);
	this.isPlaying = false;
	if (this.onStop) {
		this.onStop();
	}
};
aniLayer.prototype.setTo = function(X, Y, W, H) {
	this.moveTo(X, Y);
	if (typeof W != "undefined") {
		this.setWidth(W);
	}
	if (typeof H != "undefined") {
		this.setHeight(H);
	}
	if (this.onUpdate) { this.onUpdate(this.currentFrame); }
};

