function scrollGallery(Objectname){this.bAjax=false;this.LockedID=null;this.bAutoScroll=false;this.Objectname=Objectname;this.aParams=null;this.sUrl="";this.sLockedBackID='';this.sLockedForwardID='';this.sFrameClass='';this.lAutoScrollTime=6000;this.lPreloaded=2;var oGallery=null;var oGalleryDiv=null;var self=this;scrollGallery.prototype.convertNullTo0px=function(wert){if(wert==null){return'0px'}else{return wert}};scrollGallery.prototype.Lock=function(id){this.LockedID=id;if(this.sFrameClass!=''){var iframeliste=document.getElementsByClassName(this.sFrameClass);for(var i=0;i<iframeliste.length;i++){iframeliste[i].style.display='none';iframeliste[i].style.height='0px'}}};scrollGallery.prototype.UnLock=function(){this.LockedID=null;if(this.sFrameClass!=''){var iframeliste=document.getElementsByClassName(this.sFrameClass);for(var i=0;i<iframeliste.length;i++){iframeliste[i].style.display='block';iframeliste[i].style.height='auto'}}};scrollGallery.prototype.InitAutoscroll=function(){this.bAutoScroll=true;window.setTimeout(this.Objectname+'.Autoscroll()',this.lAutoScrollTime)};scrollGallery.prototype.StopAutoscroll=function(){this.bAutoScroll=false};scrollGallery.prototype.Autoscroll=function(){if(this.bAutoScroll){this.ScrollGallerieNext(this.SetScrollGallerie_idPrefix);window.setTimeout(this.Objectname+'.Autoscroll()',this.lAutoScrollTime)}};scrollGallery.prototype.ScrolltoElement=function(id,duration,noLock){if(noLock==null){noLock=false}if(duration==null){duration=1}if((this.LockedID==null)||(noLock)){var left=0;var top=0;var parent=document.getElementById(id).parentNode;var target=document.getElementById(id);left-=parent.offsetLeft+target.offsetLeft;top-=parent.offsetTop+target.offsetTop;new Effect.Move(parent,{x:left,y:top,mode:'relative',duration:duration});if(!noLock){this.Lock(id);window.setTimeout(this.Objectname+'.UnLock()',duration*1000)}}};this.SetScrollGallerie_idPrefix='';this.SetScrollGallerie_nCount=0;this.SetScrollGallerie_nDisplay=0;scrollGallery.prototype.SetScrollGallerie=function(idPrefix,nCount,duration){if(duration==null){duration=1}this.SetScrollGallerie_idPrefix=idPrefix;this.SetScrollGallerie_nCount=nCount;this.SetScrollGallerie_duration=duration;this.SetScrollGallerie_nDisplay=1};scrollGallery.prototype.ScrollGalleriePrevious=function(idPrefix){if(this.bAjax){if((this.SetScrollGallerie_idPrefix==idPrefix)&&(this.SetScrollGallerie_nCount>1)&&(this.SetScrollGallerie_nDisplay>1)&&(this.LockedID==null)){this.SetScrollGallerie_nDisplay--;if(this.SetScrollGallerie_nDisplay<1){this.SetScrollGallerie_nDisplay=this.SetScrollGallerie_nCount}this.ScrollPrevious();if(this.sLockedBackID!=''&&this.SetScrollGallerie_nDisplay==1){Element.hide(this.sLockedBackID)}}if(this.sLockedForwardID!=''){Element.show(this.sLockedForwardID)}}else{if((this.SetScrollGallerie_idPrefix==idPrefix)&&(this.SetScrollGallerie_nCount>1)&&(this.SetScrollGallerie_nDisplay!=0)&&(this.LockedID==null)){this.SetScrollGallerie_nDisplay--;if(this.SetScrollGallerie_nDisplay<1){this.SetScrollGallerie_nDisplay=this.SetScrollGallerie_nCount}this.ScrolltoElement(this.SetScrollGallerie_idPrefix+this.SetScrollGallerie_nDisplay,this.SetScrollGallerie_duration,true);this.Lock(this.SetScrollGallerie_idPrefix+this.SetScrollGallerie_nDisplay);window.setTimeout(this.Objectname+'.UnLock()',this.SetScrollGallerie_duration*1000)}}};scrollGallery.prototype.ScrollPrevious=function(){this.ScrolltoElement(this.SetScrollGallerie_idPrefix+this.SetScrollGallerie_nDisplay,this.SetScrollGallerie_duration,true);this.Lock(this.SetScrollGallerie_idPrefix+this.SetScrollGallerie_nDisplay);window.setTimeout(this.Objectname+'.UnLock()',this.SetScrollGallerie_duration*1000)};scrollGallery.prototype.ScrollGallerieNext=function(idPrefix){if(this.bAjax){if((this.SetScrollGallerie_idPrefix==idPrefix)&&(this.SetScrollGallerie_nCount>1)&&(this.LockedID==null)){this.SetScrollGallerie_nDisplay++;if(((this.SetScrollGallerie_nDisplay+(this.lPreloaded-2))>this.SetScrollGallerie_nCount)&&document.getElementById(this.SetScrollGallerie_idPrefix+(this.SetScrollGallerie_nDisplay+(this.lPreloaded-2)))==undefined){oGallery=document.getElementById(this.SetScrollGallerie_idPrefix);oGalleryDiv=document.createElement("div");oGalleryDiv.setAttribute('id',this.SetScrollGallerie_idPrefix+(this.SetScrollGallerie_nDisplay+(this.lPreloaded-2)));if(document.getElementById(this.SetScrollGallerie_idPrefix+'1').className!=''){oGalleryDiv.setAttribute('class',document.getElementById(this.SetScrollGallerie_idPrefix+'1').className);oGalleryDiv.setAttribute('className',document.getElementById(this.SetScrollGallerie_idPrefix+'1').className)}oGallery.appendChild(oGalleryDiv);document.getElementById(this.SetScrollGallerie_idPrefix).style.width=parseInt(Element.getWidth(document.getElementById(this.SetScrollGallerie_idPrefix)),10)+parseInt(Element.getWidth(document.getElementById(this.SetScrollGallerie_idPrefix+'1')),10)+parseInt(this.convertNullTo0px(Element.getStyle(document.getElementById(this.SetScrollGallerie_idPrefix+1),'marginLeft')).replace('px',''),10)+parseInt(this.convertNullTo0px(Element.getStyle(document.getElementById(this.SetScrollGallerie_idPrefix+1),'marginRight')).replace('px',''),10)+'px';document.getElementById(this.SetScrollGallerie_idPrefix+(this.SetScrollGallerie_nDisplay+(this.lPreloaded-2))).innerHTML=document.getElementById(this.SetScrollGallerie_idPrefix+((this.SetScrollGallerie_nDisplay+(this.lPreloaded-2))-this.SetScrollGallerie_nCount)).innerHTML}if((this.SetScrollGallerie_nDisplay+(this.lPreloaded-2))<this.SetScrollGallerie_nCount){if(!this.aParams[(this.SetScrollGallerie_nDisplay+(this.lPreloaded-2))][1]){this.aParams[(this.SetScrollGallerie_nDisplay+(this.lPreloaded-2))][1]=true;if((this.LockedID==null)||(noLock)){this.Lock(this.SetScrollGallerie_idPrefix+(this.SetScrollGallerie_nDisplay+(this.lPreloaded-2)));new Ajax.Updater(this.SetScrollGallerie_idPrefix,this.sUrl+this.aParams[(this.SetScrollGallerie_nDisplay+(this.lPreloaded-2))][0],{evalScripts:false,parameters:{lPageNumber:(this.SetScrollGallerie_nDisplay+(this.lPreloaded-2))+1},onComplete:this.onAjaxComplete.bind(this),insertion:Insertion.Bottom})}}else{this.ScrollNext()}}else{this.ScrollNext()}if(this.sLockedForwardID!=''){if((this.SetScrollGallerie_nDisplay+(this.lPreloaded-2))==(this.SetScrollGallerie_nCount)){Element.hide(this.sLockedForwardID)}}if(this.sLockedBackID!=''){Element.show(this.sLockedBackID)}}}else{if((this.SetScrollGallerie_idPrefix==idPrefix)&&(this.SetScrollGallerie_nCount>1)&&(this.SetScrollGallerie_nDisplay!=0)&&(this.LockedID==null)){this.SetScrollGallerie_nDisplay++;if(this.SetScrollGallerie_nDisplay>this.SetScrollGallerie_nCount){this.SetScrollGallerie_nDisplay=1}this.ScrolltoElement(this.SetScrollGallerie_idPrefix+this.SetScrollGallerie_nDisplay,this.SetScrollGallerie_duration,true);this.Lock(this.SetScrollGallerie_idPrefix+this.SetScrollGallerie_nDisplay);window.setTimeout(this.Objectname+'.UnLock()',this.SetScrollGallerie_duration*1000)}}};scrollGallery.prototype.onAjaxComplete=function(){this.IfIsLoaded(this.SetScrollGallerie_idPrefix+(this.SetScrollGallerie_nDisplay+(this.lPreloaded-2)))};scrollGallery.prototype.ScrollNext=function(){this.UnLock();this.ScrolltoElement(this.SetScrollGallerie_idPrefix+this.SetScrollGallerie_nDisplay,this.SetScrollGallerie_duration,true);this.Lock(this.SetScrollGallerie_idPrefix+(this.SetScrollGallerie_nDisplay+(this.lPreloaded-2)));window.setTimeout(this.Objectname+'.UnLock()',this.SetScrollGallerie_duration*1000)};var globalID=null;scrollGallery.prototype.IfIsLoaded=function(id){globalID=id;if(document.getElementById(id)!=undefined){this.IfIsImgLoaded()}else{window.setTimeout(this.Objectname+'.IfIsLoaded()',250)}};scrollGallery.prototype.IfIsImgLoaded=function(){var id=globalID;var bLoaded=true;for(var i=0;i<document.getElementById(id).getElementsByTagName('img').length;i++){if(!document.getElementById(id).getElementsByTagName('img')[i].complete){bLoaded=false}}if(bLoaded){this.ScrollNext()}else{window.setTimeout(this.Objectname+'.IfIsImgLoaded()',250)}}}

