if(typeof console==="undefined")console={log:function(){}};var iScroller=Class.create({wrapper:null,autostart:false,inner:null,original:null,images:null,width:0,vorige:null,volgende:null,per_second:25,initialize:function(settings){this.wrapper=settings.wrapper;this.autostart=settings.autostart;this.inner=this.wrapper.down('div.iscroller-inner');this.original=this.inner.down('div');this.images=this.original.childElements();this.vorige=this.wrapper.down('a.vorige');this.volgende=this.wrapper.down('a.volgende');this.images.each(function(img){this.width+=parseInt(img.getWidth())}.bind(this));var times=0;if(Math.ceil(this.wrapper.getWidth()/this.width)>1)times=Math.max(0,Math.ceil(this.wrapper.getWidth()/this.width));for(i=1;i<times;i++)this.inner.insert(this.original.cloneNode(true));if(times>0){this.inner.setStyle({width:(this.width*times)+'px'})}else this.inner.setStyle({width:this.width+'px'});this.addObservers();if(this.autostart===true)this.moveLeft()},moveLeft:function(){var morphLeft=new Effect.Morph(this.inner,{beforeUpdate:function(){var dif=(this.wrapper.getWidth()-this.inner.getWidth()-(this.volgende.getWidth()-10));if(parseInt(this.inner.getStyle('left'))<dif)morphLeft.cancel()}.bind(this),duration:this.width/this.per_second,fps:120,style:'left: -'+this.width+'px',transition:Effect.Transitions.linear,afterFinish:function(){this.moveLeft()}.bind(this)})},moveRight:function(){var morphRight=new Effect.Morph(this.inner,{beforeUpdate:function(){if(parseInt(this.inner.getStyle('left'))>(this.vorige.getWidth()-10))morphRight.cancel()}.bind(this),duration:this.width/this.per_second,fps:120,style:'left: +'+this.width+'px',transition:Effect.Transitions.linear,afterFinish:function(){this.moveRight()}.bind(this)})},addObservers:function(){this.vorige.observe('mouseover',function(event){this.moveRight()}.bind(this));this.volgende.observe('mouseover',function(event){this.moveLeft()}.bind(this))}})
