if(!JUS101) var JUS101 = {};
JUS101.ColorCycle = Class.create();
JUS101.ColorCycle.prototype = {
	initialize: function(element, attribute, colors, duration, pause) {
		this.element = $(element);
		this.attribute = attribute || 'background-color';
		this.colors = $A(colors);
		this.duration = duration;
		this.pause = pause;
		this.pe = new PeriodicalExecuter(this.cycle.bind(this), this.duration + this.pause)
		this.cycle();
		this.currentIndex = 0;
	},
	
	cycle: function() {
		this.element.morph(this.attribute + ':' + this.colors[this.currentIndex++], {duration: this.duration});
		if(this.currentIndex >= this.colors.length) this.currentIndex = 0;
	}
}
Event.observe(document, 'dom:loaded', function(){new JUS101.ColorCycle('header', 'background-color', 
	['#534A21','#53260F','#531022','#293C53','#191D4A','#2E3E20','#3E1038','#2A1A3E'], 10,5);});
