var Gallscroll = new Class({
	initialize: function(galName, galCont, pageList, Larr, Rarr, galWidth){
		this.obj = $(galName);
		this.galCont = $(galCont);
		this.pageList = $$(pageList);
		this.galWidth = galWidth;
		this.Larr = Larr ;
		this.Rarr = Rarr;
		this.galLength;
		this.currentPage = 0;
		this.przewijanie;
		this.pagesCounter = 0;
		this.Init();
	},
	properties: function(obj){		
	}
})

Gallscroll.implement({
	Init: function(){
		this.przewijanie = new Fx.Scroll( this.obj.id );
		this.galLength = this.pageList.length*this.galWidth;
		$(this.galCont).style.width = this.galLength+'px';
		var _root = this;
		$(this.Rarr).addEvent('click',function(){
			if(( _root.currentPage+1 ) < _root.pageList.length ){
			_root.currentPage +=1;
			_root.przewijanie.toElement(_root.pageList[_root.currentPage]);
			return;
			}
			else {
				_root.currentPage = 0;
				_root.przewijanie.toElement( _root.pageList[ _root.currentPage ] );
			}
		});
		$(this.Larr).addEvent('click',function(){
			if(( _root.currentPage-1 ) >= 0 ){
			_root.currentPage -=1;
			_root.przewijanie.toElement( _root.pageList[ _root.currentPage ] );
			return;
			}
			else {
				_root.currentPage = _root.pageList.length-1;
				_root.przewijanie.toElement( _root.pageList[ _root.currentPage ] );
			}
		});
	},
	ToElement: function(){
		 this.przewijanie.toElement( $( element ) );
	}
});

