Cundo.Carousel = Class.create(
{
	initialize: function()
	{
		this.pointer = 0;
		this.elements = $('intro').select('div.huis');
		this.lis = $('frontPage').select('li');
		window.setInterval(this.change.bind(this), 8000);
	},
	
	change: function()
	{
		this.elements.invoke('hide');
		this.lis.invoke('removeClassName', 'selected');
		this.pointer++;
		if (this.pointer >= this.elements.length)
		{
			this.pointer = 0;
		}
		
		this.lis[this.pointer].addClassName('selected');
		this.elements[this.pointer].show();
	},
	
	_eoo: true
});

document.observe('dom:loaded', function() {
	Cundo.Carousel = new Cundo.Carousel();
});
