var Home = new Class({
                 
    Implements: [Options, Events],

    options: {    
        interval:		4000 
    },
	
	links: [],
	current: 0,
    
    initialize: function(options){
        this.setOptions(options);
		this.addLinks();
		
		this.addPeriodical();
		this.tween = new Fx.Tween(this.options.container, {
			'duration' :  1000						  
		});
	},
	
	addPeriodical: function(){
		if (!this.timer){
			this.timer = function(){ this.slideshow(); }.periodical(this.options.interval, this);
		}
	},
	
	addLinks: function(){
		$each(this.options.links, function(element){
			this.links.extend([element]);
			element.addEvent('mouseenter', function(){
				$clear(this.timer);
				this.timer = false;
				this.showContent(element);									
			}.bind(this));
		}.bind(this));
		
		this.options.links[0].getParent().addEvent('mouseleave', function(){
			this.addPeriodical();
		}.bind(this));
	},
	
	slideshow: function(){
		this.showContent(this.links[this.current]);
		this.current = (this.current + 1) > (this.links.length - 1) ? 0 : this.current +1;
	},
	
	showContent:	function(element){
		$each(this.links, function(element){
			element.removeClass('current');						   
		});
		
		new Request.HTML({
			'url' :			this.options.url + element.get('id'),
			'update' :		this.options.container,
			'onComplete' :	function(data){
								element.addClass('current');
								this.tween.start('opacity', 0.5, 1);
							}.bind(this)
		}).send();
	}

})