var AnimationList = new Class({
		
	initialize: function() {
		
		// create an array of magentas
		
		magenta = [ 
			'#e61fa9',
			'#e82bae',
			'#de19a1',
			'#d822a0',
			'#dc35a9',
			'#e926ad'
		];
		
		// create an array of all the relevant divs 
		items = [$('column2')];
		$('column3').getElement('.inner_left').getElements('.textbox').each( function(el) {
			items.push(el);
		});
	
		items.push($('column3'));
		items.push($('visual'));
		
		$('column4').getElement('.textbox').getElements('li').each( function(li) {
			items.push(li);
		});
		
		items.push($('column4'));
		items.push($('events_short'));

		start();
	}
});


// setup animatiesequentie
var start = function() {
	animationChain = new Chain();
	animationChain.chain(
		//testanimation,
		animation1,
		animation3,
		animation2,
		animation4,
		animation5,
		animation6,
		animation8,
		animation7,
		animation9,
		start
	);
	animationChain.callChain();
}

var showCurrentAnimation = function(animation) {
	//window.status = "Dit is animatie "+animation;	
}

var testanimation = function() {
	//console.log(items.length);
	
	items.each( function(item, i) {
		(function(){item.highlight('#fff')}).delay(i*400);
	});
	
	(function(){animationChain.callChain()}).delay(items.length*1000);
}





var animation1 = function() {
	showCurrentAnimation(1);
	
	var tijd = 4000;
	
	if (items[0]) (function(){ colorblend(items[0], magenta.getRandom(), tijd) }).delay(0);
	if (items[1]) (function(){ colorblend(items[1], magenta.getRandom(), tijd) }).delay(1000);
	if (items[2]) (function(){ colorblend(items[2], magenta.getRandom(), tijd) }).delay(0);
	if (items[3]) (function(){ colorblend(items[3], magenta.getRandom(), tijd) }).delay(1000);
	if (items[4]) (function(){ colorblend(items[4], magenta.getRandom(), tijd) }).delay(0);
	if (items[5]) (function(){ colorblend(items[5], magenta.getRandom(), tijd) }).delay(1000);
	if (items[6]) (function(){ colorblend(items[6], magenta.getRandom(), tijd) }).delay(0);
	if (items[7]) (function(){ colorblend(items[7], magenta.getRandom(), tijd) }).delay(1000);
	if (items[8]) (function(){ colorblend(items[8], magenta.getRandom(), tijd) }).delay(0);
	if (items[9]) (function(){ colorblend(items[9], magenta.getRandom(), tijd) }).delay(1000);
	
	(function(){animationChain.callChain()}).delay(tijd*3); // go to next animation
};

// variabele kleuren
var animation2 = function() {
	showCurrentAnimation(2);
	
	var tijd = 5000;
	
	if (items[0]) (function(){ colorblend(items[0], magenta.getRandom(), tijd) }).delay(0);
	if (items[1]) (function(){ colorblend(items[1], magenta.getRandom(), tijd) }).delay(tijd);
	if (items[2]) (function(){ colorblend(items[2], magenta.getRandom(), tijd) }).delay(0);
	if (items[3]) (function(){ colorblend(items[3], magenta.getRandom(), tijd) }).delay(tijd);
	if (items[4]) (function(){ colorblend(items[4], magenta.getRandom(), tijd) }).delay(0);
	if (items[5]) (function(){ colorblend(items[5], magenta.getRandom(), tijd) }).delay(tijd);
	if (items[6]) (function(){ colorblend(items[6], magenta.getRandom(), tijd) }).delay(0);
	if (items[7]) (function(){ colorblend(items[7], magenta.getRandom(), tijd) }).delay(tijd);
	if (items[8]) (function(){ colorblend(items[8], magenta.getRandom(), tijd) }).delay(0);
	if (items[9]) (function(){ colorblend(items[9], magenta.getRandom(), tijd) }).delay(tijd);
	
	(function(){animationChain.callChain()}).delay(tijd+tijd*2); // go to next animation
};


// witte woosh van rechtsonder naar linksboven
var animation3 = function() {
	showCurrentAnimation(3);
	
	var tijd = 700;
	var delay = 100;
	
	if (items[9]) (function(){ colorblend(items[9],'#ff71d3',tijd) }).delay(0);
	if (items[8]) (function(){ colorblend(items[8],'#ff71d3',tijd) }).delay(delay);
	if (items[7]) (function(){ colorblend(items[7],'#ff71d3',tijd) }).delay(delay*2);
	if (items[6]) (function(){ colorblend(items[6],'#ff71d3',tijd) }).delay(delay*3);
	if (items[5]) (function(){ colorblend(items[5],'#ff71d3',tijd) }).delay(delay*4);
	if (items[4]) (function(){ colorblend(items[4],'#ff71d3',tijd) }).delay(delay*5);
	if (items[3]) (function(){ colorblend(items[3],'#ff71d3',tijd) }).delay(delay*6);
	if (items[2]) (function(){ colorblend(items[2],'#ff71d3',tijd) }).delay(delay*7);
	if (items[1]) (function(){ colorblend(items[1],'#ff71d3',tijd) }).delay(delay*8);
	if (items[0]) (function(){ colorblend(items[0],'#ff71d3',tijd) }).delay(delay*9);
	
	(function(){animationChain.callChain()}).delay(delay*10+tijd*2); // go to next animation
};

// witte woosh van linksboven naar rechtsonder
var animation4 = function() {
	showCurrentAnimation(4);
	
	var tijd = 700;
	var delay = 100;
	
	if (items[0]) (function(){ colorblend(items[0],'#ff71d3',tijd) }).delay(0);
	if (items[1]) (function(){ colorblend(items[1],'#ff71d3',tijd) }).delay(delay);
	if (items[2]) (function(){ colorblend(items[2],'#ff71d3',tijd) }).delay(delay*2);
	if (items[3]) (function(){ colorblend(items[3],'#ff71d3',tijd) }).delay(delay*3);
	if (items[4]) (function(){ colorblend(items[4],'#ff71d3',tijd) }).delay(delay*4);
	if (items[5]) (function(){ colorblend(items[5],'#ff71d3',tijd) }).delay(delay*5);
	if (items[6]) (function(){ colorblend(items[6],'#ff71d3',tijd) }).delay(delay*6);
	if (items[7]) (function(){ colorblend(items[7],'#ff71d3',tijd) }).delay(delay*7);
	if (items[8]) (function(){ colorblend(items[8],'#ff71d3',tijd) }).delay(delay*8);
	if (items[9]) (function(){ colorblend(items[9],'#ff71d3',tijd) }).delay(delay*9);

		
	(function(){animationChain.callChain()}).delay(delay*10+tijd*2); // go to next animation
};

// witte woosh van links naar rechts
var animation5 = function() {
	showCurrentAnimation(5);		
	
	var tijd = 500;
	var delay = 200;
	
	if (items[0]) (function(){ colorblend(items[0],'#ff71d3',tijd) }).delay(0);
	if (items[1]) (function(){ colorblend(items[1],'#ff71d3',tijd) }).delay(delay);
	if (items[2]) (function(){ colorblend(items[2],'#ff71d3',tijd) }).delay(delay);
	if (items[3]) (function(){ colorblend(items[3],'#ff71d3',tijd) }).delay(delay);
	if (items[4]) (function(){ colorblend(items[4],'#ff71d3',tijd) }).delay(delay*2);
	if (items[5]) (function(){ colorblend(items[5],'#ff71d3',tijd) }).delay(delay*3);
	if (items[6]) (function(){ colorblend(items[6],'#ff71d3',tijd) }).delay(delay*3);
	if (items[7]) (function(){ colorblend(items[7],'#ff71d3',tijd) }).delay(delay*3);
	if (items[8]) (function(){ colorblend(items[8],'#ff71d3',tijd) }).delay(delay*3);
	if (items[9]) (function(){ colorblend(items[9],'#ff71d3',tijd) }).delay(delay*3);


	(function(){animationChain.callChain()}).delay(delay*10+tijd*2); // go to next animation
};

// witte woosh van rechts naar links
var animation6 = function() {
	showCurrentAnimation(6);		
	
	var tijd = 500;
	var delay = 200;
	
	if (items[9]) (function(){ colorblend(items[9],'#ff71d3',tijd) }).delay(0);
	if (items[8]) (function(){ colorblend(items[8],'#ff71d3',tijd) }).delay(0);
	if (items[7]) (function(){ colorblend(items[7],'#ff71d3',tijd) }).delay(0);
	if (items[6]) (function(){ colorblend(items[6],'#ff71d3',tijd) }).delay(0);
	if (items[5]) (function(){ colorblend(items[5],'#ff71d3',tijd) }).delay(0);
	if (items[4]) (function(){ colorblend(items[4],'#ff71d3',tijd) }).delay(delay*2);
	if (items[3]) (function(){ colorblend(items[3],'#ff71d3',tijd) }).delay(delay*3);
	if (items[2]) (function(){ colorblend(items[2],'#ff71d3',tijd) }).delay(delay*3);
	if (items[1]) (function(){ colorblend(items[1],'#ff71d3',tijd) }).delay(delay*3);
	if (items[0]) (function(){ colorblend(items[0],'#ff71d3',tijd) }).delay(delay*4);
	
	(function(){animationChain.callChain()}).delay(delay*10+tijd*2); // go to next animation
};

// variabele woosh van rechts naar links
var animation7 = function() {
	showCurrentAnimation(7);	
	
	var tijd = 500;
	var delay = 200;
	
	if (items[9]) (function(){ colorblend(items[9], magenta.getRandom(), tijd) }).delay(0);
	if (items[8]) (function(){ colorblend(items[8], magenta.getRandom(), tijd) }).delay(0);
	if (items[7]) (function(){ colorblend(items[7], magenta.getRandom(), tijd) }).delay(0);
	if (items[6]) (function(){ colorblend(items[6], magenta.getRandom(), tijd) }).delay(0);
	if (items[5]) (function(){ colorblend(items[5], magenta.getRandom(), tijd) }).delay(0);
	if (items[4]) (function(){ colorblend(items[4], magenta.getRandom(), tijd) }).delay(0);
	if (items[3]) (function(){ colorblend(items[3], magenta.getRandom(), tijd) }).delay(delay*2);
	if (items[2]) (function(){ colorblend(items[2], magenta.getRandom(), tijd) }).delay(delay*3);
	if (items[1]) (function(){ colorblend(items[1], magenta.getRandom(), tijd) }).delay(delay*3);
	if (items[0]) (function(){ colorblend(items[0], magenta.getRandom(), tijd) }).delay(delay*4);
	
	(function(){animationChain.callChain()}).delay(delay*10+tijd*2); // go to next animation
};

// variabele wobbel
var animation8 = function() {
	showCurrentAnimation(8);		
	
	var tijd1 = 500;
	var tijd2 = 2000;
	var delay = tijd2;
	
	if (items[0]) (function(){ colorblend(items[0], magenta.getRandom(), $random(tijd1,tijd2)) }).delay($random(0,delay));
	if (items[1]) (function(){ colorblend(items[1], magenta.getRandom(), $random(tijd1,tijd2)) }).delay($random(0,delay));
	if (items[2]) (function(){ colorblend(items[2], magenta.getRandom(), $random(tijd1,tijd2)) }).delay($random(0,delay));
	if (items[3]) (function(){ colorblend(items[3], magenta.getRandom(), $random(tijd1,tijd2)) }).delay($random(0,delay));
	if (items[4]) (function(){ colorblend(items[4], magenta.getRandom(), $random(tijd1,tijd2)) }).delay($random(0,delay));
	if (items[5]) (function(){ colorblend(items[5], magenta.getRandom(), $random(tijd1,tijd2)) }).delay($random(0,delay));
	if (items[6]) (function(){ colorblend(items[6], magenta.getRandom(), $random(tijd1,tijd2)) }).delay($random(0,delay));
	if (items[7]) (function(){ colorblend(items[7], magenta.getRandom(), $random(tijd1,tijd2)) }).delay($random(0,delay));
	if (items[8]) (function(){ colorblend(items[8], magenta.getRandom(), $random(tijd1,tijd2)) }).delay($random(0,delay));
	if (items[9]) (function(){ colorblend(items[9], magenta.getRandom(), $random(tijd1,tijd2)) }).delay($random(0,delay));

	
	(function(){animationChain.callChain()}).delay( (tijd2) * 2 + delay + 100); // go to next animation
};

// variabele wobbel naar magenta
var animation9 = function() {
	showCurrentAnimation(9);		
	
	var tijd1 = 200;
	var tijd2 = 500;
	var delay = 100;
	var kleur = '#ff71d3';
	
	if (items[0]) (function(){ colorblend(items[0], kleur, $random(tijd1,tijd2)) }).delay($random(0,delay));
	if (items[1]) (function(){ colorblend(items[1], kleur, $random(tijd1,tijd2)) }).delay($random(0,delay));
	if (items[2]) (function(){ colorblend(items[2], kleur, $random(tijd1,tijd2)) }).delay($random(0,delay));
	if (items[3]) (function(){ colorblend(items[3], kleur, $random(tijd1,tijd2)) }).delay($random(0,delay));
	if (items[4]) (function(){ colorblend(items[4], kleur, $random(tijd1,tijd2)) }).delay($random(0,delay));
	if (items[5]) (function(){ colorblend(items[5], kleur, $random(tijd1,tijd2)) }).delay($random(0,delay));
	if (items[6]) (function(){ colorblend(items[6], kleur, $random(tijd1,tijd2)) }).delay($random(0,delay));
	if (items[7]) (function(){ colorblend(items[7], kleur, $random(tijd1,tijd2)) }).delay($random(0,delay));
	if (items[8]) (function(){ colorblend(items[8], kleur, $random(tijd1,tijd2)) }).delay($random(0,delay));
	if (items[9]) (function(){ colorblend(items[9], kleur, $random(tijd1,tijd2)) }).delay($random(0,delay));
	
	(function(){animationChain.callChain()}).delay(tijd2*2+delay+100); // go to next animation
};