var Slider=new Class({Implements:[Events,Options],Binds:["clickedElement","draggedKnob","scrolledElement"],options:{onTick:function(a){this.setKnobPosition(a);},initialStep:0,snap:false,offset:0,range:false,wheel:false,steps:100,mode:"horizontal"},initialize:function(f,a,e){this.setOptions(e);e=this.options;this.element=document.id(f);a=this.knob=document.id(a);this.previousChange=this.previousEnd=this.step=-1;var b={},d={x:false,y:false};switch(e.mode){case"vertical":this.axis="y";this.property="top";this.offset="offsetHeight";break;case"horizontal":this.axis="x";this.property="left";this.offset="offsetWidth";}this.setSliderDimensions();this.setRange(e.range);if(a.getStyle("position")=="static"){a.setStyle("position","relative");}a.setStyle(this.property,-e.offset);d[this.axis]=this.property;b[this.axis]=[-e.offset,this.full-e.offset];var c={snap:0,limit:b,modifiers:d,onDrag:this.draggedKnob,onStart:this.draggedKnob,onBeforeStart:(function(){this.isDragging=true;}).bind(this),onCancel:function(){this.isDragging=false;}.bind(this),onComplete:function(){this.isDragging=false;this.draggedKnob();this.end();}.bind(this)};if(e.snap){this.setSnap(c);}this.drag=new Drag(a,c);this.attach();if(e.initialStep!=null){this.set(e.initialStep);}},attach:function(){this.element.addEvent("mousedown",this.clickedElement);if(this.options.wheel){this.element.addEvent("mousewheel",this.scrolledElement);}this.drag.attach();return this;},detach:function(){this.element.removeEvent("mousedown",this.clickedElement).removeEvent("mousewheel",this.scrolledElement);this.drag.detach();return this;},autosize:function(){this.setSliderDimensions().setKnobPosition(this.toPosition(this.step));this.drag.options.limit[this.axis]=[-this.options.offset,this.full-this.options.offset];if(this.options.snap){this.setSnap();}return this;},setSnap:function(a){if(!a){a=this.drag.options;}a.grid=Math.ceil(this.stepWidth);a.limit[this.axis][1]=this.full;return this;},setKnobPosition:function(a){if(this.options.snap){a=this.toPosition(this.step);}this.knob.setStyle(this.property,a);return this;},setSliderDimensions:function(){this.full=this.element.measure(function(){this.half=this.knob[this.offset]/2;return this.element[this.offset]-this.knob[this.offset]+(this.options.offset*2);}.bind(this));return this;},set:function(a){if(!((this.range>0)^(a<this.min))){a=this.min;}if(!((this.range>0)^(a>this.max))){a=this.max;}this.step=Math.round(a);return this.checkStep().fireEvent("tick",this.toPosition(this.step)).end();},setRange:function(a,b){this.min=Array.pick([a[0],0]);this.max=Array.pick([a[1],this.options.steps]);this.range=this.max-this.min;this.steps=this.options.steps||this.full;this.stepSize=Math.abs(this.range)/this.steps;this.stepWidth=this.stepSize*this.full/Math.abs(this.range);if(a){this.set(Array.pick([b,this.step]).floor(this.min).max(this.max));}return this;},clickedElement:function(c){if(this.isDragging||c.target==this.knob){return;}var b=this.range<0?-1:1,a=c.page[this.axis]-this.element.getPosition()[this.axis]-this.half;a=a.limit(-this.options.offset,this.full-this.options.offset);this.step=Math.round(this.min+b*this.toStep(a));this.checkStep().fireEvent("tick",a).end();},scrolledElement:function(a){var b=(this.options.mode=="horizontal")?(a.wheel<0):(a.wheel>0);this.set(this.step+(b?-1:1)*this.stepSize);a.stop();},draggedKnob:function(){var b=this.range<0?-1:1,a=this.drag.value.now[this.axis];a=a.limit(-this.options.offset,this.full-this.options.offset);this.step=Math.round(this.min+b*this.toStep(a));this.checkStep();},checkStep:function(){var a=this.step;if(this.previousChange!=a){this.previousChange=a;this.fireEvent("change",a);}return this;},end:function(){var a=this.step;if(this.previousEnd!==a){this.previousEnd=a;this.fireEvent("complete",a+"");}return this;},toStep:function(a){var b=(a+this.options.offset)*this.stepSize/this.full*this.steps;return this.options.steps?Math.round(b-=b%this.stepSize):b;},toPosition:function(a){return(this.full*Math.abs(this.min-a))/(this.steps*this.stepSize)-this.options.offset;}});var ScrollBar=new Class({Extends:Slider,options:{onTick:function(a){if(this.options.snap){a=this.toPosition(this.step);}if(this.knobFx){this.knob.tween(this.property,a);}else{this.knob.setStyle(this.property,a);}},onChange:function(a){this.scroll(a/this.ratioScroll);},initialStep:0,snap:false,offset:0,range:false,wheel:true,steps:100,mode:"horizontal",scroll:{duration:200,link:"cancel",transition:"linear"},knob:{duration:200,transition:"linear",link:"cancel"}},initialize:function(b,d,a,c){this.setOptions(c);this.container=document.id(b);this.scroller=this.container.getFirst();this.parent(d,a);this.scroller.set("tween",this.options.scroll);this.knob.set("tween",this.options.knob);this.scrollFx=this.scroller.get("tween");if(this.options.knob.duration||this.options.knob.transition){this.knobFx=this.knob.get("tween");}if(this.options.wheel){this.container.addEvent("mousewheel",function(e){this.element.fireEvent("mousewheel",e);}.bind(this));}this.ratio=this.steps/(this.element.getSize()[this.axis]-this.knob.getSize()[this.axis]);this.ratioScroll=this.steps/(this.scroller.getSize()[this.axis]-this.container.getSize()[this.axis]);},scroll:function(a){this.scroller.tween(this.property,-a);},draggedKnob:function(){this.parent();this.scrollFx.cancel();this.scroller.setStyle(this.property,-this.step/this.ratioScroll);},clickedElement:function(a){if(this.knobFx&&a.target===this.knob){this.knobFx.cancel();}this.parent(a);},scrolledElement:function(a){if(this.knobFx){this.knobFx.cancel();}var b=(this.options.mode=="horizontal")?(a.wheel<0):(a.wheel>0);this.set(this.step+10*((b)?-this.stepSize:this.stepSize));a.stop();},set:function(a){if(typeOf(a)==="element"){a=a.getPosition(this.scroller)[this.axis]*this.ratioScroll;}this.parent(a);}});window.addEvent("domready",function(){center();if(!(Browser.Platform.ios||Browser.Platform.android)){var e=$("main").getElement(".inside");if(e){var i=e.getElement("div.scroll-container");i.setStyle("overflow","hidden");var m=i.getElement("article").getComputedSize().height;if((m-i.getComputedSize().height)>=10){var l=new Element("div",{id:"bar"}).inject(i,"after");var h=new Element("div",{id:"knob"}).inject(l,"top");var d=(Browser.ie&&Browser.version<9)?-5:0;var n=new ScrollBar(i,"bar","knob",{mode:"vertical",offset:d,steps:(Math.round(m/10))});}}var a=$("member-finder");if(a){var k=a.getElement("div.scroll-container");k.setStyle("overflow","hidden");var g=k.getElement(".scroll-content").getComputedSize().height;if((g-i.getComputedSize().height)>=10){var j=new Element("div",{id:"bar"}).inject(k,"after");var c=new Element("div",{id:"knob"}).inject(j,"top");var f=(Browser.ie&&Browser.version<9)?-5:0;myScrollMap=new ScrollBar(k,"bar","knob",{mode:"vertical",offset:f,steps:(Math.round(g/10))});}}}mapContainerHasContent=false;cSlider=new ContentSlider();if($("contact-form")){showBGContainer();}var b=new Timer(7000);$("r3-imageslider").getElements("#image-slider").each(function(p,o){new RotatorSlideVertical(p,b,undefined,undefined,true);},this);});window.addEvent("onload",function(){});window.addEvent("onunload",function(){});window.addEvent("resize",function(){center();});function center(){var a=window.getSize();var d=$("wrapper").getSize();$("viewport").setStyle("width",(a.x>=d.x)?a.x+"px":d.x+"px");$("viewport").setStyle("height",(a.y>=d.y)?a.y+"px":d.y+"px");var b=0;if(a.y>d.y){b=(a.y-d.y)/2;}$("wrapper").setStyle("margin-top",b);}function showBGContainer(){cSlider.zoomIn();}function injectErrorMsg(){$("cm_member_googlemaps_error_msg").dispose().inject($("show_all"),"before");}function arrayShuffle(){var b,c;for(var a=0;a<this.length;a++){c=Math.floor(Math.random()*this.length);b=this[a];this[a]=this[c];this[c]=b;}}Array.prototype.shuffle=arrayShuffle;var Rotator=new Class({idleTime:15000,container:undefined,items:[],autoRotate:false,workInProgress:false,navigator:undefined,mobileNavigator:undefined,timeIdle:undefined,active:undefined,absPosTop:undefined,absPosLeft:undefined,parentWidth:undefined,parentHeight:undefined,width:undefined,height:undefined,timer:undefined,autorotate:true,initRandom:false,initialize:function(b,e,a,d,c){if(!b.hasClass("initialized")){b.addClass("initialized");
if(e==undefined){var e=new Timer();}if(a!=undefined){this.idleTime=a;}if(d!=undefined){this.autorotate=d;}if(c!=undefined){this.initRandom=c;}this.container=b;this.toAbsolutePosition();if(this.items.length>1){this.buildNavigation();if(this.autorotate){this.startRotation();if(e!=undefined){this.timer=e;this.timer.register(this.showNext.bind(this));}}}}},toAbsolutePosition:function(){var a=this.container.getChildren("section");var b=a[0].getParent().getComputedSize();this.parentWidth=b.totalWidth;this.parentHeight=b.totalHeight;this.width=b.width;this.height=b.height;this.absPosTop=b.computedTop;this.absPosLeft=b.computedLeft;a.each(function(c){c.setStyles({position:"absolute",width:this.width,height:this.height});c.setPosition({x:this.absPosLeft,y:this.absPosTop});this.items.push(c.dispose());},this);if(this.initRandom){this.items.shuffle();}this.items[0].inject(this.container,"top");},buildNavigation:function(){var c=new Element("div",{"class":"rotator-navigation"}).inject($("main"),"after");var d=new Element("ul").inject(c);var a,b;this.items.each(function(f,e){a=new Element("li");b=new Element("a").inject(a);b.set("html",e+1);b.addEvent("click",this.navigatorClick.bind(this,e));a.inject(d,"bottom");if(e==0){b.addClass("active");this.active=e;}},this);d.inject(c,"top");this.navigator=c.getElements("a");this.afterBuildNavigation();},startRotation:function(){this.autoRotate=true;},stopRotation:function(){this.autoRotate=false;clearTimeout(this.timerIdle);this.timerIdle=this.startRotation.delay(this.idleTime,this);},navigatorClick:function(a){this.stopRotation();this.show(a);return false;},swipeRight:function(){this.stopRotation();var a=(this.active>0)?this.active-1:undefined;if(a!==undefined){this.show(a);}return false;},swipeLeft:function(){this.stopRotation();var a=(this.active<(this.items.length-1))?this.active+1:undefined;if(a!==undefined){this.show(a);}return false;},showNext:function(){if(this.autoRotate){var a=(this.active<(this.items.length-1))?this.active+1:0;this.show(a,true);}},afterBuildNavigation:function(a,b){},show:function(a,b){}});var RotatorSlideVertical=new Class({Extends:Rotator,scale:0.95,transform3d:false,show:function(i,d){if(!this.workInProgress&&this.active!=i){this.workInProgress=true;this.navigator[this.active].removeClass("active");var b=this.items[this.active].getElement("img");var a=b.getSize();if(this.transform3d){this.items[i].getElement("figure").addClass((i>this.active||d)?"initBottom":"initTop");}this.items[i].inject(this.items[this.active],"after");if(this.scale!=1){var c=this.items[i].getElement("img");var j=c.getSize();c.setStyle("width",j.x*this.scale);c.setStyle("height",j.y*this.scale);}this.items[i].setStyle("opacity",0);var h;if(i>this.active||d){var e=-1*this.parentHeight-50;this.items[i].setPosition({x:this.absPosLeft,y:this.parentHeight+50});h="moveOutTop";}else{if(i<this.active){var e=this.parentHeight+50;this.items[i].setPosition({x:this.absPosLeft,y:-1*this.parentHeight-50});h="moveOutBottom";}}var g=new Fx.Elements([this.items[this.active],this.items[i]],{duration:1000,transition:Fx.Transitions.Cubic.easeInOut,onComplete:function(){this.items[this.active].dispose();this.items[this.active].setStyle("opacity",1);this.active=i;this.navigator[this.active].addClass("active");this.workInProgress=false;}.bind(this)});if(this.transform3d){this.items[this.active].getElement("figure").addClass(h);this.items[i].getElement("figure").addClass("moveIn");}g.start({"0":{top:e,opacity:0},"1":{top:this.absPosTop,opacity:1}});if(this.scale!=1){var f=new Fx.Elements([this.items[this.active].getElement("img"),this.items[i].getElement("img")],{duration:1000,transition:Fx.Transitions.Cubic.easeInOut,onComplete:function(){if(this.transform3d){this.items[this.active].getElement("figure").removeClass("moveOutTop");this.items[this.active].getElement("figure").removeClass("moveOutBottom");this.items[i].getElement("figure").removeClass("initBottom");this.items[i].getElement("figure").removeClass("initTop");this.items[i].getElement("figure").removeClass("moveIn");}var k=this.items[this.active].getElement("img");k.setStyle("width",a.w);k.setStyle("height",a.h);}.bind(this)});f.start({"0":{width:a.x*this.scale,height:a.y*this.scale},"1":{width:j.x,height:j.y}});}return true;}else{return false;}}});var Timer=new Class({period:5000,timerAuto:undefined,callback:[],initialize:function(a){if(a!=undefined){this.period=a;}this.timerAuto=this.tick.periodical(this.period,this);},register:function(a){this.callback.push(a);},tick:function(){this.callback.each(function(a){if(typeof(a)==="function"){a();}});}});var ContentSlider=new Class({initialize:function(){this.slider=new Element("div",{id:"content-slider",title:"Hintergrund zeigen"}).inject($("main").getElement(".inside"),"bottom");this.logo=$("logo");this.logoDim=this.logo.getCoordinates(this.logo.getParent());this.article=$("main").getElement("div.inside");this.articleDim=this.article.getCoordinates(this.article.getParent());this.l1Navi=$("level1-navi");this.l1NaviDim=this.l1Navi.getCoordinates(this.l1Navi.getParent());this.l2Navi=$("level2-navi");if(this.l2Navi){this.l2NaviDim=this.l2Navi.getCoordinates(this.l2Navi.getParent());}this.footer=$("footer");this.zoom=false;this.slider.addEvent("click",this.zoomInOut.bind(this));},zoomIn:function(){if(!this.zoom){this.zoomInOut();}},zoomOut:function(){if(this.zoom){this.zoomInOut();}},zoomInOut:function(){if(this.zoom){this.moveObjTo(this.logo,this.logoDim.left,this.logoDim.top);this.moveObjTo(this.article,this.articleDim.left,this.articleDim.top);this.moveObjTo(this.l1Navi,this.l1NaviDim.left,this.l1NaviDim.top);if(this.l2Navi){this.moveObjTo(this.l2Navi,this.l2NaviDim.left,this.l2NaviDim.top);}this.footer.fade("in");this.slider.removeClass("open");var a=$("member-finder");if(a!==null&&mapContainerHasContent){a.getElement(".ce_image").removeClass("search_result_active");a.getElement(".ce_image").fade("in");a.getElement(".memberfinder_content").removeClass("search_result_active");a.getElement(".memberfinder_content").fade("out");}this.zoom=false;}else{this.moveObjTo(this.logo,this.logoDim.left-199,this.logoDim.top);this.moveObjTo(this.article,this.articleDim.left+410,this.articleDim.top);this.moveObjTo(this.l1Navi,this.l1NaviDim.left+410,this.l1NaviDim.top);if(this.l2Navi){this.moveObjTo(this.l2Navi,this.l2NaviDim.left+410,this.l2NaviDim.top);}this.footer.fade("out");this.slider.addClass("open");var a=$("member-finder");if(a!==null&&mapContainerHasContent){a.getElement(".ce_image").addClass("search_result_active");a.getElement(".ce_image").fade("out");a.getElement(".memberfinder_content").addClass("search_result_active");a.getElement(".memberfinder_content").fade("in");}this.zoom=true;}},moveObjTo:function(b,a,c){b.set("morph",{duration:300});b.morph({left:a,top:c});}});
