var Eff = {
	step: 5,
	enlargeImage: function (img, src, from_width, from_heigth, to_width, to_height, alt) {
		if (img.isEnlarged) {
			return;
		}
		var im = new Image;
		im.src = src;
		var f = function() {
			img.src = src;
			var coef = to_height / to_width;
			img.style.width = from_width+"px";
			img.style.height = parseInt(from_width*coef)+"px";
			var f = function() {
				if (parseInt(img.style.width)+Eff.step<to_width) {
					img.style.width = (parseInt(img.style.width)+Eff.step)+"px";
					img.style.height = parseInt(parseInt(img.style.width)*coef)+"px";
					setTimeout(f, 2);
				} else {
					img.style.width = to_width+"px";
					img.style.height = parseInt(to_width*coef)+"px";
				}
			};
			f();
			img.style.cursor = "";
			img.alt = img.title = alt;
		}
		if (im.complete) {
			f();
		} else {
			im.onload = f;
		}
		img.isEnlarged = true;
	},

	fade: function (node, start, end, callback) {
		node = typeof node == "string" ? document.getElementById(node) : node;
		var props = {property:"opacity"};
		var step = 0.1;
		if (start == undefined) {
			start = Html.getOpacity(node);
		}
		var f = function() {
			var o = Html.getOpacity(node);
			var v = start<end ? o+step : o-step;
			Html.setOpacity(node, v);
			if ((start<end && v<=end) || (start>=end && v>=end)) {
				setTimeout(f, Eff.step);
			} else {
				callback();
			}
		}
		f(start);
	},

	fadeIn: function(node, callback) {
		this.fade(node, undefined, 1, callback);
	},

	fadeOut: function(node, callback) {
		this.fade(node, undefined, 0, callback);
	}
}