/**
 * @author yetik
 */
var My_Scroller = new Class({
	left_offset: 363,
	
	initialize: function () {
		
		//po kliknieciu na strzalke w lewo przesun w lewo
		$('left_arrow').addEvent('click', function (event){
			event = new Event(event).stop();
			this.left();
		}.bind(this))
		
		//po kliknieciu na strzalke w prawo przesun w prawo		
		$('right_arrow').addEvent('click', function (event){
			event = new Event(event).stop();
			this.right();
		}.bind(this))		
		
		//element przesuwany
		this.cont = $('my_scroller_outer');
		var count = this.cont.getElements('.my_scroller_cont').length;
		var width = this.cont.getElements('.my_scroller_cont')[0].getStyle("width").toInt() + this.cont.getElements('.my_scroller_cont')[0].getStyle("margin-right").toInt();
		$('my_scroller_inner').setStyle('width', (width*count));
		
		this.fx_cont = new Fx.Scroll(this.cont, {
			duration: 500,
			transition: Fx.Transitions.Quad.easeInOut
		
		});
		
		
	},
	
	left: function () {
		var x = this.cont.getScroll().x;	
		this.fx_cont.start (x - this.left_offset,0)
	},
	
	right: function () {
		var x = this.cont.getScroll().x;
		this.fx_cont.start (x +this.left_offset,0)
	}
})


window.addEvent ('domready', function () {
	//var anim_gallery = new Anim_Gallery;
	try {
		new My_Scroller;
	} catch (e) {}
})

