var fileLoadingImage="../_kh_etl/images/loading.gif";var fileBottomNavCloseImage="../_kh_etl/images/closelabel.gif";var resizeSpeed=8;var borderSize=1;schonmaloffen=0;var loop=true;var indikator=false;var debug=true;var imageArray=new Array;var activeImage;if(resizeSpeed>10){resizeSpeed=10}if(resizeSpeed<1){resizeSpeed=1}resizeDuration=(11-resizeSpeed)*0.15;Object.extend(Element,{getWidth:function(A){A=$(A);return A.offsetWidth},setWidth:function(B,A){B=$(B);B.style.width=A+"px"},setHeight:function(A,B){A=$(A);A.style.height=B+"px"},setTop:function(B,A){B=$(B);B.style.top=A+"px"},setSrc:function(A,B){A=$(A);A.src=B},setHref:function(B,A){B=$(B);B.href=A},setInnerHTML:function(A,B){A=$(A);A.innerHTML=B}});Array.prototype.removeDuplicates=function(){for(i=1;i<this.length;i++){if(this[i][0]==this[i-1][0]){this.splice(i,1)}}};Array.prototype.empty=function(){for(i=0;i<=this.length;i++){this.shift()}};var Lightbox=Class.create();Lightbox.prototype={initialize:function(){if(!document.getElementsByTagName){return }var M=document.getElementsByTagName("a");for(var S=0;S<M.length;S++){var F=M[S];var U=String(F.getAttribute("rel"));if(F.getAttribute("href")&&(U.toLowerCase().match("lightbox"))){F.onclick=function(){myLightbox.start(this);return false}}}var V=document.getElementsByTagName("body").item(0);if(!document.getElementById("overlay")){var G=document.createElement("div");G.setAttribute("id","overlay");G.style.display="none";G.onclick=function(){myLightbox.end();return false};V.appendChild(G);var L=document.createElement("div");L.setAttribute("id","lightbox");L.style.display="none";V.appendChild(L);var T=document.createElement("div");T.setAttribute("id","outerImageContainer");L.appendChild(T);var K=document.createElement("div");K.setAttribute("id","imageContainer");T.appendChild(K);var I=document.createElement("img");I.setAttribute("id","lightboxImage");K.appendChild(I);var P=document.createElement("div");P.setAttribute("id","hoverNav");K.appendChild(P);var Q=document.createElement("a");Q.setAttribute("id","prevLink");Q.setAttribute("href","#");P.appendChild(Q);var C=document.createElement("a");C.setAttribute("id","nextLink");C.setAttribute("href","#");P.appendChild(C);var R=document.createElement("div");R.setAttribute("id","loading");K.appendChild(R);var A=document.createElement("a");A.setAttribute("id","loadingLink");A.setAttribute("href","#");A.onclick=function(){myLightbox.end();return false};R.appendChild(A);var J=document.createElement("img");J.setAttribute("src",fileLoadingImage);A.appendChild(J);var E=document.createElement("div");E.setAttribute("id","imageDataContainer");E.className="clearfix";L.appendChild(E);var D=document.createElement("div");D.setAttribute("id","imageData");E.appendChild(D);var O=document.createElement("div");O.setAttribute("id","imageDetails");D.appendChild(O);var H=document.createElement("span");H.setAttribute("id","caption");O.appendChild(H);var B=document.createElement("span");B.setAttribute("id","numberDisplay");O.appendChild(B);var N=document.createElement("div");N.setAttribute("id","bottomNav");K.appendChild(N);var W=document.createElement("a");W.setAttribute("id","bottomNavClose");W.setAttribute("href","#");W.onclick=function(){myLightbox.end();return false};N.appendChild(W)}},start:function(C,H){hideSelectBoxes();var F=getPageSize();Element.setHeight("overlay",F[1]);new Effect.Appear("overlay",{duration:0.2,from:0,to:0.8});imageArray=[];var B=0;if(!document.getElementsByTagName){return }var A=document.getElementsByTagName("a");if(!H){if((C.getAttribute("rel")=="lightbox")){imageArray.push(new Array(C.getAttribute("href"),C.getAttribute("title"),C.getAttribute("onerror")))}else{for(var D=0;D<A.length;D++){var E=A[D];if(E.getAttribute("href")&&(E.getAttribute("rel")==C.getAttribute("rel"))){imageArray.push(new Array(E.getAttribute("href"),E.getAttribute("title"),E.getAttribute("onerror")))}}imageArray.removeDuplicates();while(imageArray[B][0]!=C.getAttribute("href")){B++}}}else{for(var D=0;D<A.length;D++){var E=A[D];if(E.getAttribute("href")&&(E.getAttribute("rel")=="lightbox[gal]")){imageArray.push(new Array(E.getAttribute("href"),E.getAttribute("title"),E.getAttribute("onerror")))}}imageArray.removeDuplicates();B=0}var F=getPageSize();var G=getPageScroll();var I=G[1]+(F[3]/15);Element.setTop("lightbox",I);Element.show("lightbox");this.changeImage(B)},changeImage:function(B){activeImage=B;Element.show("loading");Element.hide("lightboxImage");Element.hide("hoverNav");Element.hide("prevLink");Element.hide("nextLink");Element.hide("imageDataContainer");Element.hide("numberDisplay");var A=new Image();A.onload=function(){Element.setSrc("lightboxImage",imageArray[activeImage][0]);myLightbox.resizeImageContainer(A.width,A.height)};A.src=imageArray[activeImage][0]},resizeImageContainer:function(C,A){this.wCur=Element.getWidth("outerImageContainer");this.hCur=Element.getHeight("outerImageContainer");this.xScale=((C+(borderSize*2))/this.wCur)*100;this.yScale=((A+(borderSize*2))/this.hCur)*100;var D=(this.wCur-borderSize*2)-C;var B=(this.hCur-borderSize*2)-A;if(!(B==0)){new Effect.Scale("outerImageContainer",this.yScale,{scaleX:false,duration:resizeDuration,queue:"front"})}if(!(D==0)){new Effect.Scale("outerImageContainer",this.xScale,{scaleY:false,delay:resizeDuration,duration:resizeDuration})}if((B==0)&&(D==0)){if(navigator.appVersion.indexOf("MSIE")!=-1){pause(250)}else{pause(100)}}Element.setHeight("prevLink",A);Element.setHeight("nextLink",A);Element.setWidth("imageDataContainer",C+(borderSize*2));this.showImage()},showImage:function(){Element.hide("loading");new Effect.Appear("lightboxImage",{duration:0.5,queue:"end",afterFinish:function(){myLightbox.updateDetails()}});this.preloadNeighborImages()},updateDetails:function(){Element.show("caption");Element.setInnerHTML("caption",imageArray[activeImage][1]);if(imageArray[activeImage][2]){}else{}if(imageArray.length>1&&indikator==true){Element.show("numberDisplay");if(!debug){Element.setInnerHTML("numberDisplay","Bild "+eval(activeImage+1)+" von "+imageArray.length)}else{Element.setInnerHTML("numberDisplay","Bild: "+imageArray[activeImage][0])}}new Effect.Parallel([new Effect.SlideDown("imageDataContainer",{sync:true,duration:resizeDuration+0.25,from:0,to:1}),new Effect.Appear("imageDataContainer",{sync:true,duration:1})],{duration:0.65,afterFinish:function(){myLightbox.updateNav()}})},updateNav:function(){Element.show("hoverNav");document.getElementById("lightboxImage").onmouseover=function(){document.getElementById("bottomNavClose").style.background="transparent url(../_kh_etl/images/close.png) right 0 no-repeat";return false};document.getElementById("lightboxImage").onmouseout=function(){document.getElementById("bottomNavClose").style.background="transparent url(../_kh_etl/images/blank.gif) no-repeat";return false};document.getElementById("hoverNav").onmouseover=function(){document.getElementById("bottomNavClose").style.background="transparent url(../_kh_etl/images/close.png) right 0 no-repeat";return false};document.getElementById("hoverNav").onmouseout=function(){document.getElementById("bottomNavClose").style.background="transparent url(../_kh_etl/images/blank.gif) no-repeat";return false};document.getElementById("bottomNavClose").onmouseover=function(){document.getElementById("bottomNavClose").style.background="transparent url(../_kh_etl/images/close2.gif) right 0 no-repeat";document.getElementById("bottomNav").style.background="transparent";return false};document.getElementById("bottomNavClose").onmouseout=function(){document.getElementById("bottomNavClose").style.background="transparent url(../_kh_etl/images/blank.gif) no-repeat";document.getElementById("bottomNav").style.background="transparent";return false};if(activeImage!=0){Element.show("prevLink");document.getElementById("prevLink").onclick=function(){myLightbox.changeImage(activeImage-1);return false}}if(activeImage==0&&loop==true){Element.show("prevLink");document.getElementById("prevLink").onclick=function(){myLightbox.changeImage(imageArray.length-1);return false}}if(activeImage!=(imageArray.length-1)){Element.show("nextLink");document.getElementById("nextLink").onclick=function(){myLightbox.changeImage(activeImage+1);return false}}if(activeImage==(imageArray.length-1)&&loop==true){Element.show("nextLink");document.getElementById("nextLink").onclick=function(){myLightbox.changeImage(0);return false}}this.enableKeyboardNav();if(schonmaloffen==1){}},enableKeyboardNav:function(){document.onkeydown=this.keyboardAction},disableKeyboardNav:function(){document.onkeydown=""},keyboardAction:function(A){if(A==null){keycode=event.keyCode}else{keycode=A.which}key=String.fromCharCode(keycode).toLowerCase();if((key=="x")||(key=="o")||(key=="c")){myLightbox.end()}else{if(key=="p"){if(activeImage!=0){myLightbox.disableKeyboardNav();myLightbox.changeImage(activeImage-1)}}else{if(key=="n"){if(activeImage!=(imageArray.length-1)){myLightbox.disableKeyboardNav();myLightbox.changeImage(activeImage+1)}}}}},preloadNeighborImages:function(){if((imageArray.length-1)>activeImage){var A=new Image();A.src=imageArray[activeImage+1][0]}if(activeImage>0){var B=new Image();B.src=imageArray[activeImage-1][0]}},end:function(){this.disableKeyboardNav();Element.hide("lightbox");new Effect.Fade("overlay",{duration:0.2});showSelectBoxes()}};function getPageScroll(){var A;if(self.pageYOffset){A=self.pageYOffset}else{if(document.documentElement&&document.documentElement.scrollTop){A=document.documentElement.scrollTop}else{if(document.body){A=document.body.scrollTop}}}var B=new Array("",A);return B}function getPageSize(){var F,A;if(window.innerHeight&&window.scrollMaxY){F=document.body.scrollWidth;A=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){F=document.body.scrollWidth;A=document.body.scrollHeight}else{F=document.body.offsetWidth;A=document.body.offsetHeight}}var D,G;if(self.innerHeight){D=self.innerWidth;G=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){D=document.documentElement.clientWidth;G=document.documentElement.clientHeight}else{if(document.body){D=document.body.clientWidth;G=document.body.clientHeight}}}if(A<G){var E=G}else{var E=A}if(F<D){var B=D}else{var B=F}var C=new Array(B,E,D,G);return C}function getKey(A){if(A==null){keycode=event.keyCode}else{keycode=A.which}key=String.fromCharCode(keycode).toLowerCase();if(key=="x"){}}function listenKey(){document.onkeypress=getKey}function showSelectBoxes(){var A=document.getElementsByTagName("select");for(i=0;i!=A.length;i++){A[i].style.visibility="visible"}}function hideSelectBoxes(){if(schonmaloffen==0){schonmaloffen=1}else{schonmaloffen=2}var A=document.getElementsByTagName("select");for(i=0;i!=A.length;i++){A[i].style.visibility="hidden"}}function blinkeblink(A){if(A=="ein"){document.getElementById("bottomNavClose").style.background="transparent url(../_kh_etl/images/close.png) right 0 no-repeat";document.getElementById("prevLink").style.background="transparent url(../_kh_etl/images/prevlabel2.png) left 15% no-repeat";document.getElementById("nextLink").style.background="transparent url(../_kh_etl/images/nextlabel2.png) right 15% no-repeat";return }if(A=="aus"){document.getElementById("bottomNavClose").style.background="transparent url(../_kh_etl/images/blank.gif) no-repeat";document.getElementById("prevLink").style.background="transparent url(../_kh_etl/images/blank.gif) no-repeat";document.getElementById("nextLink").style.background="transparent url(../_kh_etl/images/blank.gif) no-repeat";return }}function pause(B){var A=new Date();var C=A.getTime()+B;while(true){A=new Date();if(A.getTime()>C){return }}}function initLightbox(){myLightbox=new Lightbox()}Event.observe(window,"load",initLightbox,false);