var myScroller=new Class({'options':{'requestUrl':'/modules/ajax/start.php','duration':25000,'data':{}},initialize:function(options){this.setOptions(options);this.Scroller=0;this.items=new Array();this.current='right';this.spinner(1);if($H(this.options.data).getKeys()){this.spinner();new Element('div',{'id':'scrollerCnt'}).inject('scroller','bottom');this.prepareData(this.options.data);this.initScroller();this.buildElements()}return this},prepareData:function(objects){for(var p=0;p<2;p++){$H(objects).each(function(el,objectid){if(!$type(el.angebot))el.angebot='';if(!$type(el.kategorie))el.kategorie='';if(!$type(el.preis))el.preis=0;if(!$type(el.preiseinheit))el.preiseinheit='';if(!$type(el.zip))el.zip='';if(!$type(el.city))el.city='';var tipHeader='Immobilien / '+staticAngebot[el.angebot]+': '+staticCategories[el.kategorie];var tipContent=new Array();if(typeof(el.preis)!="undefined"&&el.preis.toInt()>0)tipContent.push('Preis:'+el.preis.toInt()+' '+el.preiseinheit);else tipContent.push('Preis:'+el.preiseinheit);if(typeof(el.thumb)!='undefined'){this.items.push({'id':objectid,'image':el.thumb,'alt':el.zip+' '+el.city+'<br>'+tipContent.join('<br>'),'title':tipHeader,'link':'/immobilien/'+objectid})}}.bind(this))}},buildElements:function(){var posX=250;this.items.each(function(item,index){var span=new Element('span').setStyles({'left':posX+=120,'position':'absolute','padding':'2px','cursor':'pointer','float':'left'}).addEvent('click',function(e){var event=new Event(e);event.stop();parent.location.href=item.link}.bindWithEvent(this)).addEvent('mouseover',function(e){this.stopScroller()}.bindWithEvent(this)).addEvent('mouseout',function(e){this.resumeScroller()}.bindWithEvent(this));var img=new Element('img',{'src':item.image,'name':item.id,'width':'110','height':'80','title':item.title,'rel':item.alt}).addClass('itemOut').inject(span,'bottom');span.inject('scrollerCnt','bottom')}.bind(this));new Tips($$('.itemOut'),{'className':'itemOver','offsets':{'x':25,'y':0}});this.Scroller.toRight()},stopScroller:function(){return this.Scroller.cancel()},resumeScroller:function(){return(this.current=='right')?this.Scroller.toRight():this.Scroller.toLeft()},initScroller:function(){this.Scroller=new Fx.Scroll('scrollerCnt',{wait:false,duration:this.options.duration,offset:{'x':-2,'y':-1},transition:Fx.Transitions.linear,wheelStops:false,onComplete:function(e){if(this.current=='right'){this.current='left';this.Scroller.toLeft()}else if(this.current=='left'){this.current='right';this.Scroller.toRight()}}.bind(this)})},spinner:function(en){if(en){new Element('img',{'id':'scrollerSpinner','src':'/images/spinner.gif','width':'32px','height':'32px','alt':'Loading content'}).inject('scroller','bottom')}else if($('scrollerSpinner'))$('scrollerSpinner').dispose()}});myScroller.implement(new Options(),new Events());
