// does looping fading of liedempfehlung entries. requires an array
//    vt[]      containing liedempfehlung strings.

// define fading range
colormax=255;
colormin=150;
// define fading speed
speed=100;
// how long stay fully visible
visibletime=300;

// shared variables
cx=0; ac=0; cv=colormax;

function fadein() {
	if(ac<30) { // 30 steps
		ac++;
		if (cv>colormin) cv-=6; // color change step: approximately (colormax-colormin)/steps
		document.getElementById("sotd").style.color="rgb("+cv+","+cv+","+cv+")";
		setTimeout("fadein()",speed);
	} else {    // reset for fadeout
		ac=0;
        cv=colormin;
		setTimeout("fadeout()",visibletime);
	}
}

function fadeout() {
        if(ac<30) { // 30 steps
		ac++;
		if (cv<colormax) cv+=6; // color change step: approximately (colormax-colormin)/steps
		document.getElementById("sotd").style.color="rgb("+cv+","+cv+","+cv+")";
		setTimeout("fadeout()",speed);
        } else {    // reset for fadein
		ac=0;
		cv=colormax;
		cx++;
		if (cx>=vt.length) cx=0;
		document.getElementById("sotd").innerHTML=vt[cx];
		fadein();
	}
}

// calling function
function startFade() {
	document.getElementById("sotd").innerHTML=vt[cx];
        fadein();
}

