var Crossfader = Class.create();
Crossfader.prototype = {
	initialize : function( container, options ) {
		this.options = Object.extend({
			wait: 3,
			time: 2
        },options || {});
		
		this.container = $(container);
		this.divs = $(container).immediateDescendants();
		this.current = 0;
		
		this.timeout = new PeriodicalExecuter( this.crossfade.bind(this), this.options.wait );
		
		for(i=1; i<this.divs.length;i++)
		{
			this.divs[i].hide();
		}
	},
	crossfade : function( )
	{
		this.divs[this.current].fade({ duration:this.options.time });
		this.current++;
		this.current = this.current % this.divs.length;
		this.divs[this.current].appear({ duration:this.options.time });		
	}
}
