function frameAnim(elmA, elmB, frameClass) {
	this.elmA    = elmA;
	this.elmB    = elmB;
	this.classN  = frameClass;
	/* hack proti reloadu porovnatTable - pamatuje si umisteni a rozmery elementu */
	this.elmB.oL = fixOffsetLeft(this.elmB);
	this.elmB.oT = fixOffsetTop(this.elmB);
	this.elmB.oW = this.elmB.offsetWidth;
	this.elmB.oH = this.elmB.offsetHeight;
	this.oldL = fixOffsetLeft(this.elmA);
	this.oldT = fixOffsetTop(this.elmA);
	this.oldW = this.elmA.offsetWidth;
	this.oldH = this.elmA.offsetHeight;
	this.init();
}

frameAnim.prototype = {
	init : function() {
		var parent = this;
		this.frame = document.createElement('DIV');
		cls.add(this.frame, this.classN);
		this.setFrame(fixOffsetLeft(this.elmA), fixOffsetTop(this.elmA), this.elmA.offsetWidth, this.elmA.offsetHeight);
		document.body.appendChild(this.frame);
		setTimeout(function () {parent.move();}, 500);
	},
	
	setFrame : function(x, y, w, h) {
		var constant = document.all ? 0 : 4;
		this.frame.style.left   = x + 'px';
		this.frame.style.top    = y + 'px';
		this.frame.style.width  = w - constant + 'px';
		this.frame.style.height = h - constant + 'px';
	},
	
	move : function() {
		var parent = this;
		var x = this.countStep(fixOffsetLeft(this.frame), this.elmB.oL, 5);
		var y = this.countStep(fixOffsetTop(this.frame), this.elmB.oT, 5);
		var w = this.countStep(this.frame.offsetWidth, this.elmB.oW, 5);
		var h = this.countStep(this.frame.offsetHeight, this.elmB.oH, 5);
		if(
			((x != this.elmB.oL) && (x != this.oldL)) ||
			((y != this.elmB.oT) && (y != this.oldT)) ||
			((w != this.elmB.oW) && (w != this.oldW)) ||
			((h != this.elmB.oH) && (h != this.oldH))
			) {
				this.setFrame(x, y, w, h);
				this.oldL = x;
				this.oldT = y;
				this.oldW = w;
				this.oldH = h;
				setTimeout(function () {parent.move();}, 25);
			} else {
				if (document.all) {
					this.frame.style.left = (x + 1) + 'px';
					this.frame.style.top  = (y + 1) + 'px';
				}
				setTimeout(function () {document.body.removeChild(parent.frame);}, 1000);
			}
	},
	
	countStep : function(r, t, s) {
		if(r>t) {
			return r + Math.floor((t-r)/s);
		} else {
			return r + Math.ceil((t-r)/s);
		}
	}
}
