﻿athena.animateLayout = function(obj, propertyName, startValue, finalValue, step, speed) {
	var c = parseFloat(window.getComputedStyle(obj, null)[propertyName]);
	if (startValue !== finalValue) {
		function changeC(value) {
			if (startValue < finalValue) {
				value += step;
			} else {
				value -= step;
			}
			return value;
		}
		setTimeout(function() {
			c = changeC(c);
			obj.style[propertyName] = c + "px";
			if (c != finalValue) {
				setTimeout(arguments.callee, speed);
			}
		}, speed);
	}
}

athena.animateOpacity = function(obj, finalValue, step, speed) {
	var startValue = parseFloat(window.getComputedStyle(obj, null).opacity);
	var c = parseFloat(window.getComputedStyle(obj, null).opacity);
	if (startValue !== finalValue) {
		function changeC(value) {
			if (startValue < finalValue) {
				value += step;
			} else {
				value -= step;
			}
			return value;
		}
		setTimeout(function() {
			c = changeC(c);
			c = parseFloat(c.toFixed(2));
			obj.style.opacity = c;
			if (c != finalValue) {
				setTimeout(arguments.callee, speed);
			}
		}, speed);
	}
}

// © E. Knyazev, 2011
