var Uitgelicht = Class.create({

	container	: null,
	items		: [],
	links		: [],
	active_index: 0,

	initialize	: function ( element ) {
		this.container	= element;

		this.items		= this.container.select('.uitgelicht-item');
		this.links		= this.container.select('.uitgelicht-navigatie a');

		this.items.each( function ( el ) {
			if ( el.hasClassName( 'active' ) )
				this.active_index	= this.items.indexOf( el );
		}.bind( this ));

		this.addObservers();

		this.show( this.active_index );	//	voor als er geen active dingen zijn gezet

	} ,

	addObservers: function () {
		this.links.each( function( a ) {
			a.observe( 'mouseover' , function( event ) {
				Event.stop( event );
				event.stop();
				this.show( this.links.indexOf( a ) );
			}.bind( this ));
		}.bind( this ));
	} ,

	show		: function ( index ) {
		this.items[this.active_index].removeClassName( 'active' );
		this.links[this.active_index].removeClassName( 'active' );
		this.active_index	= index;
		this.items[this.active_index].addClassName( 'active' );
		this.links[this.active_index].addClassName( 'active' );
	}

});

document.observe("dom:loaded", function() {
	if ( $('uitgelicht') )
		var uitgelicht = new Uitgelicht( $('uitgelicht') );
});
