window.addEvent('domready',function(){
	if($$('.highslide')[0]){
		var buttons = new Element('div',{
			id		:	'buttons',
			html	:	'<a id="prev"></a><a id="next"></a>'
		}).inject($$('body')[0],'top');
		new switcher();
	}
});

var switcher = new Class({
	initialize : function(){
		this.pos = 0;
		$('next').addEvent('click',function(){
			this.browse_forward();
		}.bind(this));
		$('prev').addEvent('click',function(){
			this.browse_backward();
		}.bind(this));
	},
	browse_forward : function(){
		if(this.running) return false;
		this.pos++;
		if($$('#Inhalt td')[this.pos]){
			this.running = true;
			new Fx.SmoothScroll({
				duration	:	250,
				transition	:	Fx.Transitions.linear,
				offset 		:	{
					x		:	-48,
					y		:	0
				},
				onComplete	:	function(){
					this.running = false;
				}.bind(this),
				wait		:	false
			})
			.toElement($$('#Inhalt td')[this.pos]);
				
		}
		else this.pos--;
	},
	browse_backward : function(){
		if(this.running) return false;
		this.pos--;
		if(this.pos < 0) this.pos = 0;
			this.running = true;
			new Fx.SmoothScroll({
				duration	:	250,
				transition	:	Fx.Transitions.linear,
				offset 		:	{
					x		:	-48,
					y		:	0
				},
				onComplete	:	function(){
					this.running = false;
				}.bind(this),
				wait		:	false
			})
			.toElement($$('#Inhalt td')[this.pos]);
	}
});
