var SlideList = new Class({

		Implements: [ Options ],

		initialize: function(menu, options) {

			this.setOptions(this.getOptions(), options);

			this.menu = $(menu);
			this.current = this.menu.getElement('div.current');

			this.menu.getElements('div').each(function(item){
				if(Browser.Engine.trident) item.setStyle('cursor','hand');
				item.addEvent('mouseover', function(){this.moveBg(item)}.bind(this));
				item.addEvent('mouseout', function(){ this.moveBg(this.current); }.bind(this));
				item.addEvent('click', function(event){ this.clickItem(event, item, item.getElement('a')); }.bind(this));
			}.bind(this));
			
			this.backgroundContainer = new Element('div').setProperty('id','sliderMaster').addClass('background').adopt(new Element('div').addClass('left')).injectInside(this.menu);
			this.backgroundContainer.fx = new Fx.Morph(this.backgroundContainer,{
					link: this.options.link,
					fps: this.options.fps,
					duration: this.options.duration,
					transition: this.options.transition,
					onClick: this.options.onClick
					});
			if(this.current) this.setCurrent(this.current);

		},

		getOptions: function(){
			return {
				transition: Fx.Transitions.Quint.easeOut,
				duration: 750,
				fps: 75,
				link: 'cancel',
				onClick: function(ev, item) { ev.stop(); }
			};
		},

		setCurrent: function(el, effect){
			this.backgroundContainer.setStyles({left: (el.offsetLeft)+'px', width: (el.offsetWidth)+'px'});
			this.current = el;
		},

		moveBg: function(to) {
			if(!this.current) return;
			if( to.id == '' ) return;
			this.backgroundContainer.fx.start({
				left: [this.backgroundContainer.offsetLeft, to.offsetLeft],
				width: [this.backgroundContainer.offsetWidth, to.offsetWidth]
			});
		},

		clickItem: function(event, item, anch) {
			if(!this.current) this.setCurrent(item, true);

			// do something with anch (a tag)

			this.current = item;
			this.options.onClick(new Event(event), item);

		}

	});
