function transitarColor(colores, id, ms, f, t) {
	var fondos = window[colores];
	var elemento = document.getElementById(id);
	var inc = parseInt(elemento.getAttribute("incremento"));
	var valorActual = parseInt(elemento.getAttribute("valor"));
	var nuevoValor = valorActual + inc;
//	document.getElementById(id).setAttribute("valor", nuevoValor);
	elemento.setAttribute("valor", nuevoValor);
	if (nuevoValor >= 0 && nuevoValor < (fondos.length)) {
		if (f) elemento.style.backgroundColor = fondos[nuevoValor];
		if (t) elemento.style.color = fondos[(fondos.length) - nuevoValor - 1];
		var recurrir = "transitarColor('" + colores + "', '" + id + "', " + ms + ", " + f + ", " + t + ")";
		setTimeout(recurrir, ms);
	}
}

function cambiaColor(colores, id, ms, f, t) {
	var fondos = window[colores];
	var elemento = document.getElementById(id);
	elemento.setAttribute("incremento", "-1");
	elemento.setAttribute("valor", (fondos.length - 2).toString());
	transitarColor(colores, id, ms, f, t);
}

function recuperaColor(colores, id, ms, f, t)	{
	var elemento = document.getElementById(id);
	elemento.setAttribute("incremento", "1");
	if (parseInt(elemento.getAttribute("valor")) < 0)
		elemento.setAttribute("valor", "1");
	transitarColor(colores, id, ms, f, t);
}
