function fadeFlashText(element)
{
	var t=this;
	t.element = element;

	t.color = function(r,g,b)
	{
		var ct=this;
		ct.r = r;
		ct.g = g;
		ct.b = b;
		this.multiply = function(x)
		{
			return new t.color(Math.min(Math.round(ct.r*x),255),Math.min(Math.round(ct.g*x),255),Math.min(Math.round(ct.b*x),255));
		};
		this.towards = function(color,factor)
		{
			var rDiff = color.r - ct.r;
			var gDiff = color.g - ct.g;
			var bDiff = color.b - ct.b;
			return new t.color(Math.round(ct.r + factor*rDiff),Math.round(ct.g + factor*gDiff),Math.round(ct.b + factor*bDiff));
		};
		this.toProperty = function()
		{
			return "rgb("+ct.r+","+ct.g+","+ct.b+")";
		};
	};

	t.baseColor = new t.color(128,0,0);
	t.highlightColor = new t.color(255,149,137);
	t.stage = 0;
	t.midStage = 10;

	t.step = function()
	{
		var lightness = null;
		if (t.stage < t.midStage) {
			lightness = t.stage/t.midStage;
		} else {
			lightness = 1-(t.stage-t.midStage)/t.midStage;
		}

		//console.log("Lightness: %f",lightness);
		t.element.style.color = t.baseColor.towards(t.highlightColor,lightness).toProperty();

		t.stage++;
		if (t.stage > t.midStage*2) {

			t.stage = 0;
			setTimeout(t.step,600);
			return; // break
		}
		setTimeout(t.step,80);
	};
}

