var boxTeaser = new function() {

    var boxTeaser = new Class({
	
		options: {
			startIndex: 0,
			sizeActive: 324,
			sizeInactive: 162
		},
	
		initialize: function(elements, options) {
			
			// Optionen setzten
			$extend(this.options, options);	
			
			// Objekteigenschaften
			this.elements = $$(elements);	
			this.activeElement = options.startIndex;
			this.fx = new Fx.Elements(this.elements, {
				fps: 100,
				duration: 200,
				link: 'cancel'
			});
			 
			// Events
			this.elements.each(function(elm, i) {
				elm.addEvent("mouseenter", this.tween.bind(this, i));
			}.bind(this));
			this.elements[0].getParent().addEvent("mouseleave", this.tween.bind(this, 0));
			
		},
		
		tween: function(index) {			
			var fxProps = {};			
			this.elements.each(function(elm, i) {
				fxProps[i] = {width: this.options.sizeInactive};
			}.bind(this));
			
			fxProps[index] = {width: this.options.sizeActive};
			
			this.fx.start(fxProps);		
		}	
	});
    
    return {
        init: function() {
			var elms = $$("ul#accordion li");	
			if($type(elms) == "array" && elms.length > 0) {
				var bt = new boxTeaser($$("ul#accordion li"), 0);		
			}	
        }


    }
}();

document.addEvent("domready", boxTeaser.init);