var colors = [
	"B1A0CD",
	"F6EB00",
	"E17E1C",
	"90278E",
	"7C8D0C",
	"00ADED",
	"273089",
	"C0D62E",
	"AE5F10",
	"899A92",
	"EC2A74"
];
var cycleCounter = 0;	

$(document).ready(function(){

	setInterval(cycle, 500);
	
});

function cycle() {
	
	$("li").each(function(index, element) {
		$(this).css("background-color", "#" + colors[(index + cycleCounter) % colors.length]);
	})
	
	cycleCounter++;
	if (cycleCounter > $("li").length) cycleCounter = 0;
	//shuffle(colors);
	
}

function shuffle(list) {
	var i, j, t;
	for (i = 1; i < list.length; i++) {
		j = Math.floor(Math.random()*(1+i));  // choose j in [0..i]
		if (j != i) {
			t = list[i];                        // swap list[i] and list[j]
			list[i] = list[j];
			list[j] = t;
		}
	}
}
