var Slider=new Class({Implements:[Events,Options],options:{delay:40,velocity:40,path:"/",clearTimeout:200},initialize:function(A){this.setOptions(A);this.wrapper=$("Wrapper");this.slider=$("Slider");this.slider.setStyle("left",-2300);this.info=$("Info");this.bindImgEvents($$("#Slider div"));this.overhead=$("Overhead").set("opacity",0).setStyle("display","block");this.firstImg=40;this.lastImg=1;sliderX=0;wrapperX=0;startSlide=true;this.slider.addEvent("mousemove",function(B){sliderX=(B.client.x-this.wrapper.getPosition().x);}.bind(this));this.wrapper.addEvent("mousemove",function(B){wrapperX=(B.client.x-this.wrapper.getPosition().x);}.bind(this));this.attachSlider();},bindImgEvents:function(A){A.each(function(D,B){var C=D.getProperty("id").split("-");var E=C[1];D.addEvents({"click":function(F){this.detachInfo();this.loadPreview(D,E);}.bind(this),"mouseenter":function(F){this.attachInfo(E);}.bind(this),"mouseout":function(F){this.detachInfo(E);}.bind(this)});}.bind(this));},unloadPreview:function(A){this.overhead.fade("out");A.fade("out");setTimeout(function(){A.dispose();this.fill.dispose();this.text.dispose();this.close.dispose();}.bind(this),500);},loadPreview:function(D,H){var E=$("src-"+H);var C=E.getProperty("size").split("|");var B=E.getProperty("rel");var G=E.getProperty("alt");this.text=new Element("div",{"html":G,"id":"Text"}).inject(this.overhead,"inside");if(Browser.Engine.trident){var A="0.6";}else{if(Browser.Engine.gecko||Browser.Engine.webkit){var A="0.8";}else{var A="0.6";}}this.fill=new Element("div",{"id":"Fill","events":{"click":function(){this.unloadPreview(img);}.bind(this)}}).inject(this.overhead,"inside").set("opacity",A);this.loader=new Element("img",{"src":this.options.path+"img/ajax-loader.gif","id":"Loader"});this.close=new Element("div",{"html":"close X","id":"Close","events":{"click":function(){this.unloadPreview(img);}.bind(this)}}).inject(this.overhead,"inside");var F=(760-C[0])/2;this.overhead.fade("in");this.close.setStyle("right",(F+10));this.text.setStyle("left",(F+10));new Asset.images([this.options.path+"img/projekte/large/"+B],{onProgress:function(I){this.loader.inject(this.fill,"inside");}.bind(this),onComplete:function(){this.loader.dispose();img=new Element("img",{"height":C[1],"width":C[0],"src":this.options.path+"img/projekte/large/"+B,"alt":G,"styles":{"margin-left":F},"events":{"click":function(){this.unloadPreview(img);}.bind(this)}}).set("opacity",0).inject(this.overhead,"inside").fade("in");}.bind(this)});},detachInfo:function(A){if($type(A)!=false&&$type(A)=="string"){$("infoText").dispose();}},attachInfo:function(A){new Element("div",{"id":"infoText","html":$("src-"+A).getProperty("alt"),"class":"infoText"}).inject($("img-"+A),"inside");},attachSlider:function(){this.starterSlide();this.wrapper.addEvents({"mouseover":function(){this.startSlide();startSlide=false;}.bind(this),"mouseout":function(){this.stopSlide();startSlide=true;this.starterSlide();}.bind(this)});},starterSlide:function(){if(startSlide){var A=this.slider.getSize().x;var B=this.wrapper.getSize().x;var C=-1;this.slider.setStyle("left",(this.slider.offsetLeft+C));if(this.slider.offsetLeft<"-3000"){switch(this.firstImg+"."+this.lastImg){case"40.1":this.switchDivImageRight(40,1);break;case"38.39":this.switchDivImageRight(38,39);break;case"36.37":this.switchDivImageRight(36,37);break;case"34.35":this.switchDivImageRight(34,35);break;case"32.33":this.switchDivImageRight(32,33);break;case"30.31":this.switchDivImageRight(30,31);break;case"28.29":this.switchDivImageRight(28,29);break;case"26.27":this.switchDivImageRight(26,27);break;case"24.25":this.switchDivImageRight(24,25);break;case"22.23":this.switchDivImageRight(22,23);break;case"20.21":this.switchDivImageRight(20,21);break;case"18.19":this.switchDivImageRight(18,19);break;case"16.17":this.switchDivImageRight(16,17);break;case"14.15":this.switchDivImageRight(14,15);break;case"12.13":this.switchDivImageRight(12,13);break;case"10.11":this.switchDivImageRight(10,11);break;case"8.9":this.switchDivImageRight(8,9);break;case"6.7":this.switchDivImageRight(6,7);break;case"4.5":this.switchDivImageRight(4,5);break;case"2.3":this.switchDivImageRight(2,3);break;}}if(this.slider.offsetLeft<"-3100"&&this.slider.offsetLeft>"-3150"){switch(this.firstImg+"."+this.lastImg){case"39.40":this.switchDivImageRight(39,40);break;case"37.38":this.switchDivImageRight(37,38);break;case"35.36":this.switchDivImageRight(35,36);break;case"33.34":this.switchDivImageRight(33,34);break;case"31.32":this.switchDivImageRight(31,32);break;case"29.30":this.switchDivImageRight(29,30);break;case"27.28":this.switchDivImageRight(27,28);break;case"25.26":this.switchDivImageRight(25,26);break;case"23.24":this.switchDivImageRight(23,24);break;case"21.22":this.switchDivImageRight(21,22);break;case"19.20":this.switchDivImageRight(19,20);break;case"17.18":this.switchDivImageRight(17,18);break;case"15.16":this.switchDivImageRight(15,16);break;case"13.14":this.switchDivImageRight(13,14);break;case"11.12":this.switchDivImageRight(11,12);break;case"9.10":this.switchDivImageRight(9,10);break;case"7.8":this.switchDivImageRight(7,8);break;case"5.6":this.switchDivImageRight(5,6);break;case"3.4":this.switchDivImageRight(3,4);break;case"1.2":this.switchDivImageRight(1,2);break;}}starttime=function(){this.starterSlide();}.bind(this).delay(40);}else{return false;}},startSlide:function(){this.layerRecall();time=function(){this.startSlide();}.bind(this).delay(40);},stopSlide:function(){$clear(time);},layerRecall:function(){var A=this.slider.getSize().x;var B=this.wrapper.getSize().x;var C=Math.floor(((B/2)-wrapperX)/20);if(wrapperX<380){if(this.slider.offsetLeft<"-1500"&&this.slider.offsetLeft>"-1550"){switch(this.lastImg+"."+this.firstImg){case"1.40":this.switchDivImageLeft(1,40);break;case"3.2":this.switchDivImageLeft(3,2);break;case"5.4":this.switchDivImageLeft(5,4);break;case"7.6":this.switchDivImageLeft(7,6);break;case"9.8":this.switchDivImageLeft(9,8);break;case"11.10":this.switchDivImageLeft(11,10);break;case"13.12":this.switchDivImageLeft(13,12);break;case"15.14":this.switchDivImageLeft(15,14);break;case"17.16":this.switchDivImageLeft(17,16);break;case"19.18":this.switchDivImageLeft(19,18);break;case"21.20":this.switchDivImageLeft(21,20);break;case"23.22":this.switchDivImageLeft(23,22);break;case"25.24":this.switchDivImageLeft(25,24);break;case"27.26":this.switchDivImageLeft(27,26);break;case"29.28":this.switchDivImageLeft(29,28);break;case"31.30":this.switchDivImageLeft(31,30);break;case"33.32":this.switchDivImageLeft(33,32);break;case"35.34":this.switchDivImageLeft(35,34);break;case"37.36":this.switchDivImageLeft(37,36);break;case"39.38":this.switchDivImageLeft(39,38);break;case"41.40":this.switchDivImageLeft(41,40);break;}}if(this.slider.offsetLeft<"-1600"&&this.slider.offsetLeft>"-1650"){switch(this.lastImg+"."+this.firstImg){case"2.1":this.switchDivImageLeft(2,1);break;case"4.3":this.switchDivImageLeft(4,3);break;case"6.5":this.switchDivImageLeft(6,5);break;case"8.7":this.switchDivImageLeft(8,7);break;case"10.9":this.switchDivImageLeft(10,9);break;case"12.11":this.switchDivImageLeft(12,11);break;case"14.13":this.switchDivImageLeft(14,13);break;case"16.15":this.switchDivImageLeft(16,15);break;case"18.17":this.switchDivImageLeft(18,17);break;case"20.19":this.switchDivImageLeft(20,19);break;case"22.21":this.switchDivImageLeft(22,21);break;case"24.23":this.switchDivImageLeft(24,23);break;case"26.25":this.switchDivImageLeft(26,25);break;case"28.27":this.switchDivImageLeft(28,27);break;case"30.29":this.switchDivImageLeft(30,29);break;case"32.31":this.switchDivImageLeft(32,31);break;case"34.33":this.switchDivImageLeft(34,33);break;case"36.35":this.switchDivImageLeft(36,35);break;case"38.37":this.switchDivImageLeft(38,37);break;case"40.39":this.switchDivImageLeft(40,39);break;}}}else{if(this.slider.offsetLeft<"-3000"){switch(this.firstImg+"."+this.lastImg){case"40.1":this.switchDivImageRight(40,1);break;case"38.39":this.switchDivImageRight(38,39);break;case"36.37":this.switchDivImageRight(36,37);break;case"34.35":this.switchDivImageRight(34,35);break;case"32.33":this.switchDivImageRight(32,33);break;case"30.31":this.switchDivImageRight(30,31);break;case"28.29":this.switchDivImageRight(28,29);break;case"26.27":this.switchDivImageRight(26,27);break;case"24.25":this.switchDivImageRight(24,25);break;case"22.23":this.switchDivImageRight(22,23);break;case"20.21":this.switchDivImageRight(20,21);break;case"18.19":this.switchDivImageRight(18,19);break;case"16.17":this.switchDivImageRight(16,17);break;case"14.15":this.switchDivImageRight(14,15);break;case"12.13":this.switchDivImageRight(12,13);break;case"10.11":this.switchDivImageRight(10,11);break;case"8.9":this.switchDivImageRight(8,9);break;case"6.7":this.switchDivImageRight(6,7);break;case"4.5":this.switchDivImageRight(4,5);break;case"2.3":this.switchDivImageRight(2,3);break;}}if(this.slider.offsetLeft<"-3100"&&this.slider.offsetLeft>"-3150"){switch(this.firstImg+"."+this.lastImg){case"39.40":this.switchDivImageRight(39,40);break;case"37.38":this.switchDivImageRight(37,38);break;case"35.36":this.switchDivImageRight(35,36);break;case"33.34":this.switchDivImageRight(33,34);break;case"31.32":this.switchDivImageRight(31,32);break;case"29.30":this.switchDivImageRight(29,30);break;case"27.28":this.switchDivImageRight(27,28);break;case"25.26":this.switchDivImageRight(25,26);break;case"23.24":this.switchDivImageRight(23,24);break;case"21.22":this.switchDivImageRight(21,22);break;case"19.20":this.switchDivImageRight(19,20);break;case"17.18":this.switchDivImageRight(17,18);break;case"15.16":this.switchDivImageRight(15,16);break;case"13.14":this.switchDivImageRight(13,14);break;case"11.12":this.switchDivImageRight(11,12);break;case"9.10":this.switchDivImageRight(9,10);break;case"7.8":this.switchDivImageRight(7,8);break;case"5.6":this.switchDivImageRight(5,6);break;case"3.4":this.switchDivImageRight(3,4);break;case"1.2":this.switchDivImageRight(1,2);break;}}}if((this.slider.offsetLeft+C)<0&&(this.slider.offsetLeft+C)>(B-A)){this.slider.setStyle("left",(this.slider.offsetLeft+C));}},switchDivImageLeft:function(D,C){this.slider.setStyle("left",(this.slider.offsetLeft+-($("img-"+D).getSize().x+5)));var B=$("img-"+D);var A=B.clone(true,true).cloneEvents(B);B.dispose();A.set("id","img-"+D);A.inject($("img-"+C),"after");if(C==40){this.firstImg=1;}else{this.firstImg=(C+1);}if(D==40){this.lastImg=1;}else{this.lastImg=(D+1);}},switchDivImageRight:function(D,C){this.slider.setStyle("left",(this.slider.offsetLeft- -($("img-"+D).getSize().x+5)));var B=$("img-"+D);var A=B.clone(true,true).cloneEvents(B);B.dispose();A.set("id","img-"+D);A.inject($("img-"+C),"before");if(D==1){this.firstImg=40;}else{this.firstImg=(D-1);}if(C==1){this.lastImg=40;}else{this.lastImg=(C-1);}}});