(function(){var o=0;var p={};var q=false;var r=null;var t="";var u=window.location.pathname;var w='1.1.0';var x=false;var y={Browser:"jImageGalleryBrowser",Gallery:"jImageGallery"};var z=function(a){return p[a]};var A=function(a){if(!q){Element.observe(document,"dom:loaded",function(){q=true;a()})}else{a()}};var B=function(a){var v=a.replace(/_.*|\./g,'');v=parseInt(v+'0'.times(4-v.length));return a.indexOf('_')>-1?v-1:v};var C=function(a){var b=E();var c=a.id;var d=undefined;switch(a.xType){case y.Browser:{d=a.root;if(typeof b[c]!="undefined"){d=d+b[c]}break}case y.Gallery:{if(typeof b[c]!="undefined"){if(b[c].endsWith("-single]")){d={group:b[c],index:0}}else{d={group:b[c].substring(0,b[c].lastIndexOf("["))+"[]",index:Number(b[c].match(/\[(.*)\]/)[1])}}}break}}return d};var D=function(){if(!D.element){document.body.insert({bottom:"<iframe id='jiHistory' src='"+u+"ä.test.txt' class='jImageGallery jHistory'>"});D.element=$("jiHistory");Event.observe(D.element,"load",function(){var a=D.element.contentWindow.location.search;if(a.substring(0,1)=="?"){a="#"+a.substring(1)}if(window.location.hash!=a){window.location.hash=a}})}return D.element};var E=function(){var c=F();if(c.length==0){return{}}if(c.startsWith("#")){c=c.substring(1)}return c.split("&").inject({},function(a,b){b=b.split("=");if(b.length==2){a[decodeURIComponent(b[0])]=decodeURIComponent(b[1])}return a})};var F=function(){return window.location.hash};var G=function(){o++;return"jig"+o};var H=function(a){p[a.id]=a};var I=function(a){var b=E();var c=a.id;switch(a.xType){case y.Browser:{if(a.url!=a.root){b[c]=a.url.replace(a.root,"")}else{b[c]=undefined}break}case y.Gallery:{if(!a.current){b[c]=undefined}else{if(a.current.group.endsWith("[]")){b[c]=a.current.group.substring(0,a.current.group.length-2)+"["+a.current.index+"]"}else if(a.current.group.endsWith("-single]")){b[c]=a.current.group}else{b[c]=a.current.group+"["+a.current.index+"]"}}}}J(b)};var J=function(c){var d=Object.keys(c).inject([],function(a,b){if(typeof c[b]!="undefined"){a.push(encodeURIComponent(b)+"="+encodeURIComponent(c[b]))}return a}).join("&");if(!Prototype.Browser.isSafari||(Prototype.Browser.isSafari&&d!="")){d="#"+d}if(F()==""&&(d==""||d=="#")){return}if(F()!=d){if(r.pause){r.pause()}K(d);t=F();if(r.resume){r.resume()}}};var K=function(a){window.location.hash=a;if(Prototype.Browser.isIE6||Prototype.Browser.isIE7){if(a.substring(0,1)=="#"){a="?"+a.substring(1)}D().contentWindow.location.href=u+"ä.test.txt"+a}};if((typeof jControls=='undefined')||(B(jControls.Version)<B(w))){throw("jImageGallery requires jControls >= "+w);}var u=$$('head script[src]').find(function(s){return s.src.match(/jImageGallery(.*)\.js(\?.*)?$/)}).src.replace(/(.*)jImageGallery(.*)\.js(\?.*)?$/,"$1");if(Prototype.Browser.isIE6){String.prototype.utf8Decode=function(){var a=this;var b="";var i=0;var c=c1=c2=0;while(i<a.length){c=a.charCodeAt(i);if(c<128){b+=String.fromCharCode(c);i++}else if((c>191)&&(c<224)){c2=a.charCodeAt(i+1);b+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2}else{c2=a.charCodeAt(i+1);c3=a.charCodeAt(i+2);b+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3}}return b};String.prototype.utf8Encode=function(){var a=this.replace(/\r\n/g,"\n");var b="";for(var n=0;n<a.length;n++){var c=a.charCodeAt(n);if(c<128){b+=String.fromCharCode(c)}else if((c>127)&&(c<2048)){b+=String.fromCharCode((c>>6)|192);b+=String.fromCharCode((c&63)|128)}else{b+=String.fromCharCode((c>>12)|224);b+=String.fromCharCode(((c>>6)&63)|128);b+=String.fromCharCode((c&63)|128)}}return b}}String.prototype.escapeURI=function(){var b=this;if(Prototype.Browser.isIE6){return b.utf8Encode()}if(x){if(Prototype.Browser.isIE){return encodeURI(b)}return b}return b.split("/").collect(function(a){if(a!=window.location.protocol&&a!=window.location.host){return escape(a)}return a}).join("/")};String.prototype.unescapeURI=function(){var a=this;if(x){a=decodeURI(a)}else{a=unescape(a)}if(Prototype.Browser.isIE6){a=a.utf8Decode()}return a};x=Prototype.Browser.isIE6?false:jControls.Cookies("server-utf-8").get();if(x==null){new Ajax.Request(u+"ä.test.txt",{method:"get",asynchronous:false,onFailure:function(a){x=Prototype.Browser.isIE},onSuccess:function(a){x=a&&a.responseText&&a.responseText.evalJSON(true)===true&&!Prototype.Browser.isIE}});jControls.Cookies("server-utf-8").set(x)}A(function(){t=F();r=new PeriodicalExecuter(function(c){if(t!=F()){c.pause();var d=E();Object.keys(p).each(function(a){a=p[a];var b=d[a.id];switch(a.xType){case y.Browser:{if(typeof b=="undefined"&&a.root!=a.url){a.load(a.root,false)}else if(typeof b!="undefined"&&a.url!=a.root+b){a.load(a.root+b,false)}break}case y.Gallery:{if(typeof b!="undefined"){if(b.endsWith("-single]")){b={group:b,index:0}}else{b={group:b.substring(0,b.lastIndexOf("["))+"[]",index:Number(b.match(/\[(.*)\]/)[1])}}}if(a.current&&typeof b=="undefined"){a.hide()}else if(typeof b!="undefined"){a.stop();a.show(b)}break}}});c.resume()}t=F()},Prototype.Browser.isIE?0.5:0.05)});window.jImageGallery={};var L=function(a,b){var c=b.getAttribute("rel");if(c.indexOf("[")==-1){c=c+"["+G()+"-single]"}if(typeof a.images[c]=="undefined"){a.images[c]=$A([])}var d=a.images[c].length;a.images[c].push({"group":c,"index":d,elementPreview:b,elementImage:null,src:b.tagName.toLowerCase()=="a"?b.href:b.src,boxPreview:b.tagName.toLowerCase()=="a"?b.down("img"):b,size:null,title:b.getQtipText()||""});Event.observe(b,"click",function(e){e.stop();a.show(a.images[c][d])})};var M=function(a){if(!$(document.body)){return}if(a.options.auto){a.update();var b=C(a);if(b){a.show(b)}}};var N=function(a,b,c){c._elementGallery=null;c.elementGallery=function(){if(!c._elementGallery){c._elementGallery=a.elementGalleryImages.down("span.index-"+c.index)}return c._elementGallery};return b+"<span class='image gallery-image "+(c.index==a.current.index?" current":"")+" index-"+c.index+"'>"+"<img class='gallery-image index-"+c.index+"' src='"+c.boxPreview.src+"' title='"+c.title+"'/>"+"</span>"};var O=function(e,f,g){g=g.wrap(function(a){if(!f.size||f.size.recalc){var b=e.options.maxWidth;var c=e.options.maxHeight;if(!f.sizeOrg){f.sizeOrg=f.elementImage.getSize()}f.size=Object.clone(f.sizeOrg);f.size.recalc=false;if(b=="auto"){var d=e.dom.toggleDisplayed();b=e.dom.getWidth();b-=e.elementContent.down(".close").getWidth();e.dom.toggleDisplayed(d)}if(c=="auto"){var d=e.dom.toggleDisplayed();c=e.dom.getHeight()-(parseFloat(e.elementInformation.getStyle("bottom"))+e.elementInformation.getHeight());c-=e.elementContent.down(".close").getHeight();e.dom.toggleDisplayed(d)}if(b<f.size.width){f.size.height=b*f.size.height/f.size.width;f.size.width=b}if(c<f.size.height){f.size.width=c*f.size.width/f.size.height;f.size.height=c}f.size.maxWidth=b;f.size.maxHeight=c}e.elementLoading.hide();f.loading=false;a(e)});if(f.loading){new PeriodicalExecuter(function(a){if(f.loading){return}a.stop();g()});return}if(!f.elementImage){f.loading=true;f.elementImage=new Element("img");f.elementImage.addClass("jImageGallery preloadImage").src=f.src;var h=new PeriodicalExecuter(function(a){if(typeof a.counter=="undefined"){a.counter=0}a.counter++;var b=f.elementImage.getBox();if(b.width>=e.options.minWidth&&b.height>=e.options.minHeight){a.stop();h=null;if(Prototype.Browser.isIE6||Prototype.Browser.isIE7){g.delay(1)}else{g()}}else if(a.counter*0.1>=30){a.stop();h=null;f.loading=false;e.elementLoading.hide();e.hide();f.elementImage=null;alert(e.options.textLoadError.replace("%1",f.title))}},0.1);Event.observe(f.elementImage,"error",function(){if(h){h.stop();h=null;f.loading=false;e.elementLoading.hide();e.hide();f.elementImage=null;alert(e.options.textLoadError.replace("%1",f.title))}});document.body.insert({bottom:f.elementImage})}else{document.body.insert({bottom:f.elementImage});g()}};var P=function(c,d){if(d){d.elementImage.remove();d=null}if(!c.current||!c.images||!c.images[c.current.group]){return}if(c.current.index<c.images[c.current.group].length-1){d=c.images[c.current.group].find(function(a,b){return b>c.current.index&&!Object.isElement(a.elementImage)})}if(!d){d=c.images[c.current.group].find(function(a){return!Object.isElement(a.elementImage)})}if(d){O.defer(c,d,P.curry(c,d))}};var Q=function(c){if(c.rendered){return this}c.rendered=true;document.body.insert({top:"<div class='jImageGallery view"+(Prototype.Browser.isIE6?" jiIE6":"")+(Prototype.Browser.isIE7?" jiIE7":"")+"' id='"+c.id+"' style='display:none;'>"+"<div class='content'>"+"<div class='shadow'></div>"+"<div class='close'></div>"+"</div>"+"<div class='information'>"+"<div class='index'>"+c.options.textImagesOfImg+" <span class='position'></span> "+c.options.textImagesOfOf+" <span class='count'></span>"+"</div>"+"<div class='description'>&nbsp;</div>"+"</div>"+"<div class='navigation'>"+"<div class='button-ml previous' title='"+c.options.textBtnPrevTitle+"'>"+"<div class='button-mr'>"+"<div class='button-mc'>"+"<div class='button-content'>"+c.options.textBtnPrev+"</div>"+"</div>"+"</div>"+"</div>"+"<div class='button-ml play' title='"+c.options.textBtnPlayTitle+"'>"+"<div class='button-mr'>"+"<div class='button-mc'>"+"<div class='button-content'>"+c.options.textBtnPlay+"</div>"+"</div>"+"</div>"+"</div>"+"<div class='button-ml pause' style='display: none;' title='"+c.options.textBtnPauseTitle+"'>"+"<div class='button-mr'>"+"<div class='button-mc'>"+"<div class='button-content'>"+c.options.textBtnPause+"</div>"+"</div>"+"</div>"+"</div>"+"<div class='button-ml last next' title='"+c.options.textBtnNextTitle+"'>"+"<div class='button-mr'>"+"<div class='button-mc'>"+"<div class='button-content'>"+c.options.textBtnNext+"</div>"+"</div>"+"</div>"+"</div>"+"<div class='jImageGallery-clear'></div>"+"</div>"+"<div class='gallery'>"+"<div class='list'>"+"<div class='images'></div>"+"</div>"+"<div class='scroll-left'></div>"+"<div class='scroll-right'></div>"+"</div>"+"</div>"+"<div class='jImageGallery loading' id='"+c.id+"-loading' style='display:none;'>"+"<div class='loading-ml'>"+"<div class='loading-mr'>"+"<div class='loading-mc'>"+"<div class='loading-indicator'></div>"+"</div>"+"</div>"+"</div>"+"</div>"+"<div class='jcContainer jcLayer jImageGallery' id='"+c.id+"-layer' style='"+(!Prototype.Browser.isIE6?"position: fixed; ":"")+"display: none;'/>"});c.dom=$(c.id).setOpacity(0);c.dom._jImageGallery=c;c.elementLoading=$(c.id+"-loading").setOpacity(0.8);c.elementContent=c.dom.down(".content");c.elementInformation=c.dom.down(".information");c.elementIndex=c.dom.down(".index");c.elementIndexPosition=c.dom.down(".position");c.elementIndexCount=c.dom.down(".count");c.elementDescription=c.dom.down(".description");c.elementNavigation=c.dom.down(".navigation");c.elementGalleryList=c.dom.down(".gallery");c.elementGalleryListScrollLeft=c.elementGalleryList.down(".scroll-left");c.elementGalleryListScrollRight=c.elementGalleryList.down(".scroll-right");c.elementGalleryImages=c.elementGalleryList.down(".images");c.elementShadow=c.elementContent.down(".shadow");c.elementLayer=$(c.id+"-layer").setOpacity(0.8);if(Prototype.Browser.isIE6){var d=function(){var a=document.viewport.getScrollOffsets();var b=document.viewport.getDimensions();b.x=a.left;b.y=a.top;c.elementLayer.setStyle({left:b.x+"px",top:b.y+"px",width:b.width+"px",height:b.height+"px"});c.dom.setStyle({left:b.x+"px",top:b.y+"px",width:b.width+"px",height:b.height+"px"})};d();Event.observe(document,"resize",d);Event.observe(document,"scroll",d)}Event.observe(Prototype.Browser.isIE6?c.elementLayer:c.dom,"click",function(e){if(Event.element(e)==(Prototype.Browser.isIE6?c.elementLayer:c.dom)){e.stop();c.hide()}});Event.observe(c.elementContent.down(".close"),"click",function(e){e.stop();c.hide()});Event.observe(c.elementNavigation.down(".previous"),"click",function(e){e.stop();c.stop();c.previous()});Event.observe(c.elementNavigation.down(".play"),"click",function(e){e.stop();c.play()});Event.observe(c.elementNavigation.down(".pause"),"click",function(e){e.stop();c.stop()});Event.observe(c.elementNavigation.down(".next"),"click",function(e){e.stop();if(c.current.index<c.images[c.current.group].length-1){c.stop();c.next()}});Event.observe(c.elementGalleryImages,"click",function(e){e.stop();var a=Event.element(e);if(a.hasClassName("gallery-image")){c.show(c.current.group,Number($w(a.className).last().replace("index-","")))}});var f=null;Event.observe(c.elementGalleryListScrollLeft,"mouseover",function(e){e.stop();if(f){f.stop()}f=new PeriodicalExecuter(function(){var a=parseFloat(c.elementGalleryImages.getStyle("left"));if(a-c.elementGalleryList.down(".scroll-left").getWidth()<0){c.elementGalleryImages.setStyle({"left":(a+25)+"px"})}else{f.stop()}},0.05)});Event.observe(c.elementGalleryListScrollLeft,"mouseout",function(e){e.stop();if(f){f.stop()}});Event.observe(c.elementGalleryListScrollRight,"mouseover",function(e){e.stop();if(f){f.stop()}f=new PeriodicalExecuter(function(){var a=parseFloat(c.elementGalleryImages.getStyle("left"));if(c.elementGalleryImages.getContentWidth()+a-c.elementGalleryList.getWidth()+c.elementGalleryList.down(".scroll-right").getWidth()>0){c.elementGalleryImages.setStyle({"left":(a-25)+"px"})}else{f.stop()}},0.05)});Event.observe(c.elementGalleryListScrollRight,"mouseout",function(e){e.stop();if(f){f.stop()}});Event.observe(document,"resize",function(){if(c.images){Object.keys(c.images).each(function(b){c.images[b].each(function(a){if(a.size){a.size.recalc=true}})})}})};var R=function(a,b){var c=document.viewport.getScrollOffsets();a.currentOld.elementImage.insert({after:b.current.elementImage.setStyle({left:"0px",top:"0px",width:b.current.size.width+"px",height:b.current.size.height+"px",position:"absolute"}).removeClass("jImageGallery preloadImage").setOpacity(0).show()});new Effect.Parallel([new Effect.Appear(b.current.elementImage,{sync:true,to:1}),new Effect.Fade(a.currentOld.elementImage,{sync:true,to:0}),new Effect.Morph(b.elementGalleryImages,{sync:true,style:{left:(b.elementGalleryImages.getWidth()/2-b.current.elementGallery().offsetLeft-b.current.elementGallery().getWidth()/2)+"px"}}),new Effect.Morph(b.elementContent,{sync:true,style:{left:(b.elementContent.down(".close").getWidth()+b.current.size.maxWidth/2-(b.current.size.width)/2)+"px",top:(b.elementContent.down(".close").getHeight()+b.current.size.maxHeight/2-(b.current.size.height)/2)+"px",width:b.current.size.width+"px",height:b.current.size.height+"px"}}),new Effect.Morph(b.elementInformation,{sync:true,style:{left:(b.elementContent.down(".close").getWidth()+b.current.size.maxWidth/2-(b.current.size.width)/2)+"px",width:b.current.size.width+"px"}})],{duration:0.5,afterFinish:function(){a.currentOld.elementGallery().removeClass("current");b.current.elementGallery().addClass("current");b.elementIndexPosition.innerHTML=b.current.index+1;b.elementDescription.innerHTML=b.current.title;a.currentOld.elementImage.remove().clearStyle("display").addClass("jImageGallery preloadImage");if(!b.current.title){b.elementDescription.hide()}b.current.elementImage.clearStyle("left top");if(b.pe){b.pe.resume()}}})};var S=function(a,b){var c=document.viewport.getScrollOffsets();b.dom.setOpacity(0).show();b.elementShadow.show();b.elementContent.setStyle({left:(b.elementContent.down(".close").getWidth()+b.current.size.maxWidth/2-(b.current.size.width)/2)+"px",top:(b.elementContent.down(".close").getHeight()+b.current.size.maxHeight/2-(b.current.size.height)/2)+"px",width:b.current.size.width+"px",height:b.current.size.height+"px"}).select("img").invoke("remove");b.elementInformation.setStyle({left:b.elementContent.getX()+"px",width:b.current.size.width+"px"});if(b.images[b.current.group].length>1){b.elementNavigation.setStyle({left:(b.dom.getWidth()/2-b.elementNavigation.getWidth()/2)+"px"})}b.current.elementImage.setStyle({left:(a.boxPreview.x-c.left)+"px",top:(a.boxPreview.y-c.top)+"px",width:a.boxPreview.width+"px",height:a.boxPreview.height+"px",visibility:"visible",position:"fixed"}).show();new Effect.Parallel([new Effect.Morph(b.current.elementImage,{sync:true,style:{left:b.elementContent.cumulativeOffset().left+"px",top:b.elementContent.cumulativeOffset().top+"px",width:b.current.size.width+"px",height:b.current.size.height+"px"}}),new Effect.Appear(b.elementLayer,{sync:true,to:0.8})],{duration:0.5,afterFinish:function(){b.elementDescription.innerHTML=b.current.title;if(b.current.title){b.elementDescription.show()}else{b.elementDescription.hide()}b.elementIndexPosition.innerHTML=b.current.index+1;b.elementIndexCount.innerHTML=b.images[b.current.group].length;if(b.images[b.current.group].length>1){b.elementIndex.show()}else{b.elementIndex.hide()}if(b.images[b.current.group].length>1){new Effect.Parallel([new Effect.Appear(b.dom,{sync:true,to:1}),new Effect.Morph(b.elementGalleryImages,{sync:true,style:{left:(b.elementGalleryImages.getWidth()/2-b.current.elementGallery().offsetLeft-b.current.elementGallery().getWidth()/2)+"px"}})],{duration:0.25,afterFinish:function(){b.elementShadow.insert({after:b.current.elementImage.clearStyle("left top").removeClass("jImageGallery preloadImage").setStyle({position:"absolute"})})}})}else{new Effect.Appear(b.dom,{to:1,duration:0.25,afterFinish:function(){b.elementShadow.insert({after:b.current.elementImage.clearStyle("left top").removeClass("jImageGallery preloadImage").setStyle({position:"absolute"})})}})}}});P(b)};var T=new Class.create({current:null,dom:null,elementContent:null,elementDescription:null,elementGalleryList:null,elementGalleryImages:null,elementIndex:null,elementIndexCount:null,elementIndexPosition:null,elementInformation:null,elementLoading:null,elementNavigation:null,elementShadow:null,elementLayer:null,images:null,pe:null,hide:function(){if(this.current==null){return this}var a=this.current.boxPreview.getBox();var b=this.current.elementImage.cumulativeOffset();var c=document.viewport.getScrollOffsets();document.body.insert({bottom:this.current.elementImage.setStyle({left:b.left+"px",top:b.top+"px",position:"fixed"}).addClass("jImageGallery preloadImage")});this.elementShadow.hide();new Effect.Parallel([new Effect.Morph(this.current.elementImage,{sync:true,style:{left:(a.x-c.left)+"px",top:(a.y-c.top)+"px",width:a.width+"px",height:a.height+"px"}}),new Effect.Fade(this.elementLayer,{sync:true,to:0}),new Effect.Fade(this.dom,{sync:true,to:0})],{duration:0.5,afterFinish:(function(){this.stop();if(this.current){if(this.current.elementImage){this.current.elementImage.remove().clearStyle("left top width height visibility position display")}this.current=null}I(this)}).bind(this)});return this},initialize:function(a){this.xType=y.Gallery;this.id=G();H(this);this.options=a||{};this.options.auto=typeof this.options.auto!="undefined"?this.options.auto:true;this.options.name=this.options.name||["jImageGallery","jig"];this.options.maxWidth=this.options.maxWidth||"auto";this.options.maxHeight=this.options.maxHeight||"auto";this.options.minWidth=this.options.minWidth||100;this.options.minHeight=this.options.minHeight||100;this.options.slideShowInterval=this.options.slideShowInterval||5;this.options.textBtnPrev=this.options.textBtnPrev||"Vorheriges";this.options.textBtnPrevTitle=this.options.textBtnPrevTitle||"vorheriges Bild anzeigen";this.options.textBtnPlay=this.options.textBtnPlay||"Abspielen";this.options.textBtnPlayTitle=this.options.textBtnPlayTitle||"Bilder als Slideshow anzeigen";this.options.textBtnPause=this.options.textBtnPause||"Pause";this.options.textBtnPauseTitle=this.options.textBtnPauseTitle||"Slideshow anhalten";this.options.textBtnNext=this.options.textBtnNext||"Nächstes";this.options.textBtnNextTitle=this.options.textBtnNextTitle||"nächstes Bild anzeigen";this.options.textImagesOfImg=this.options.textImagesOfImg||"Bild";this.options.textImagesOfOf=this.options.textImagesOfOf||"von";this.options.textLoadError=this.options.textLoadError||"Das Bild %1 konnte nicht geladen werden!";if(q){M(this)}else{A(M.curry(this))}},next:function(){if(this.current&&this.current.index<this.images[this.current.group].length-1){this.show(this.images[this.current.group][this.current.index+1])}else{this.show(this.images[this.current.group][0])}return this},pause:function(){if(this.pe){this.pe.pause();this.elementNavigation.down(".pause").hide();this.elementNavigation.down(".play").show()}return this},play:function(){if(this.current){if(this.pe){this.pe.resume()}else{this.pe=new PeriodicalExecuter(this.next.bind(this),this.options.slideShowInterval)}this.elementNavigation.down(".pause").show();this.elementNavigation.down(".play").hide()}return this},previous:function(){if(this.current&&this.current.index>0){this.show(this.images[this.current.group][this.current.index-1])}return this},reset:function(a){if(typeof a=="undefined"){this.images={}}else if(typeof this.images[a]!="undefined"){this.images[a]=undefined}return this},show:function(a,b){if(typeof a=="string"){if(typeof b=="undefined"){b=0}a={group:a,index:b}}if(this.pe){this.pe.pause()}if((this.current&&this.current.group==a.group&&this.current.index==a.index)||typeof this.images[a.group]=="undefined"||typeof this.images[a.group][a.index]=="undefined"){return this}if(!this.rendered){Q(this)}if(typeof a.src=="undefined"){a=this.images[a.group][a.index]}var c=this.current;this.current=a;I(this);var d=!c?this.current.boxPreview.getBox():{x:c.elementImage.getX(),y:c.elementImage.getY(),width:c.size.width,height:c.size.height};this.elementLoading.setStyle({left:d.x+"px",top:d.y+"px",width:d.width+"px",height:d.height+"px"}).show();if(this.images[this.current.group].length>1){if(!c){this.elementInformation.removeClass("single");this.elementGalleryList.show();this.elementGalleryImages.innerHTML=this.images[this.current.group].inject("",N.curry(this))}this.elementNavigation.show();this.elementNavigation.select(".disabled").invoke("removeClass","disabled");if(!this.pe){this.elementNavigation.down(".play").show();this.elementNavigation.down(".pause").hide()}else{this.elementNavigation.down(".play").hide();this.elementNavigation.down(".pause").show()}if(this.current.index==0){this.elementNavigation.down(".previous").addClass("disabled")}if(this.current.index>=this.images[this.current.group].length-1){this.elementNavigation.down(".next").addClass("disabled")}}else{this.elementInformation.addClass("single");this.elementIndex.hide();this.elementGalleryList.hide();this.elementNavigation.hide()}O(this,this.current,(c?R:S).curry({boxPreview:d,currentOld:c}));return this},stop:function(){if(this.pe){this.pe.stop();this.pe=null;this.elementNavigation.down(".pause").hide();this.elementNavigation.down(".play").show()}return this},update:function(b){this.reset(b);if(typeof b=="undefined"){b=this.options.name}if(typeof b=="string"){b=[b]}$(document.body).select($A(b).collect(function(a){return["a[rel*="+a+"]","img[rel*="+a+"]"]}).flatten()).each(L.curry(this));return this}});A(function(){window.jImageGallery=new T(window.jImageGallery)});var U=function(a){a.container=$(a.container);if(!a.container){return}if(!a.container.id){a.container.id=a.id}a.container._jImageGalleryBrowser=a;a.url=C(a);a.render();a.load()};var V=function(n){new Ajax.Request(n.url.escapeURI()+"?jImageGalleryBrowser",{method:"get",onSuccess:function(f){var g=$A([]);var h=0;var i=0;var j=0;var k="";var l=false;n.elementParser.innerHTML=f.responseText;if(n.elementParser.down("pre",1)){n.elementContentInformation.innerHTML=n.elementParser.down("pre",1).innerHTML;n.elementContentInformation.show()}else{n.elementContentInformation.hide()}n.elementParser.select("pre a").each(function(a,b){var c=a.getAttribute("href").unescapeURI();if(a.previous("img").alt=="[DIR]"){l=true;c=c.split("/");c=c[c.length-2];Event.observe(n.elementContentPathes.insert({bottom:"<div class='dir dir"+b+" dir-"+n.id+"' title='"+c+"'>"+"<div class='dir-ml'>"+"<div class='dir-mr'>"+"<div class='dir-mc'>"+"<div class='dir-text'>"+c+"</div>"+"</div>"+"</div>"+"</div>"+"</div>"}).down(".dir"+b),"click",n.load.curry(n.url+c+"/").bind(n))}else{var d={url:(Prototype.Browser.isIE6?n.url:n.url.unescapeURI().escapeURI()),src:a.href.replace(/.*\/(.*\.jpg)/i,"$1").unescapeURI().escapeURI(),preview:"preview/"+a.href.replace(/.*\/(.*\.jpg)/i,"$1").unescapeURI(),title:c.replace(/\.jpg$/i,"").split("/").last(),id:n.id,index:b};if(!Prototype.Browser.isIE6){d.preview=d.preview.escapeURI()}g.push(d);k=k+"<div class='image image"+d.index+"' title='"+d.title+"' style='visibility:hidden;'>"+"<div>"+"<a class='link' href='"+d.url+d.src+"' title='"+d.title+"' rel='"+d.id+"[]'></a>"+"</div>"+"<div>"+"<small class='title'>"+d.title+"</small>"+"</div>"+"</div>"}});if(l){n.elementContentPathes.show()}else{n.elementContentPathes.hide()}i=g.length;if(i==0){n.elementContentImages.hide()}else if(i!=0){n.elementContentImages.show();n.elementContentImages.innerHTML=k+"<div class='jImageGallery-clear'></div>";var m=function(c){var d=$(new Image());Event.observe(d,"error",function(e){e.stop();if(c.preview.match("preview")){c.preview=c.src;d.src=c.url+c.src}});Event.observe(d,"load",function(){var b=n.elementContentImages.down(".image"+c.index);b.down(".link").insert({bottom:d});if(j<b.getHeight()-b.getFrameWidth("tb")-b.getMargins("b")){j=b.getHeight()-b.getFrameWidth("tb")-b.getMargins("b")}h++;n.elementContentLoading.setText(h+" von "+i+" Bilder geladen...");if(!n.options.asynchronous&&g.length!=0){m.defer(g.shift())}else if(h==i||g.length==0){h++;n.elementContentLoading.setText("Ansicht wird erzeugt...");n.elementContentImages.select(".image").each(function(a){a.clearStyle("visibility");if(j>a.getHeight()-a.getFrameWidth("tb")-a.getMargins("b")){a.setStyle({marginBottom:(j-(a.getHeight()-a.getFrameWidth("tb")-a.getMargins("b"))+a.getMargins("b"))+"px"})}});n.elementContentLoading.hide();window.jImageGallery.update(n.id+"[]");if(C(window.jImageGallery)){window.jImageGallery.show(C(window.jImageGallery))}}});d.src=c.url+c.preview};if(!n.options.asynchronous){m(g.shift())}else{g.each(m);new PeriodicalExecuter(function(a){if(typeof a.counter=="undefined"||a.counter!=h){a.counter=h;return}if(a.counter==i){a.stop()}n.elementContentLoading.setText("Ansicht wird erzeugt...");n.elementContentImages.select(".image").invoke("clearStyle","visibility");n.elementContentLoading.hide();a.stop()},5)}}if(i!=0){n.elementContentImages.show()}else{n.elementContentLoading.hide()}}})};var W=function(a){if(a.url==a.root){return}var b=a.url.split("/");b.pop();b.pop();a.load(b.join("/")+"/")};window.jImageGalleryBrowser=new Class.create({container:null,gallery:null,id:null,rendered:false,root:null,url:null,initialize:function(a){this.xType=y.Browser;this.id=G();H(this);this.options=a||{};this.options.asynchronous=typeof this.options.asynchronous!="undefined"?this.options.asynchronous:!Prototype.Browser.isIE;this.container=this.options.container;this.url=this.options.url||"/Galerie/";if(this.url.substring(0,5)!="http:"){this.url=window.location.protocol+"//"+window.location.host+this.url}this.root=this.url;if(q){U(this)}else{A(U.curry(this))}},load:function(a,b){if(typeof a=="undefined"){a=this.url}if(typeof b=="undefined"){b=true}if(!this.rendered){return this}if(a.substring(a.length-1)!="/"){a=a+"/"}this.url=a;if(b){I(this)}if(window.jImageGallery.reset){window.jImageGallery.reset(this.id+"[]")}if(this.url!=this.root){this.elementContentTop.show()}else{this.elementContentTop.hide()}var c=this.url.replace(this.root,"");if(c.length!=0){if(c.substring(c.length-1)=="/"){c=c.substring(0,c.length-1)}this.elementContentPath.show().innerHTML=c}else{this.elementContentPath.hide()}this.elementContentPathes.innerHTML="";this.elementContentLoading.show();if(this.options.asynchronous){V(this)}return this},render:function(){if(this.rendered){return this}this.rendered=true;this.container.innerHTML="<div class='jImageGalleryBrowser-parser'></div>"+"<div class='jImageGalleryBrowser-content'>"+"<div class='path' style='display:none;'></div>"+"<div class='top dir' style='display:none;'>"+"<div class='dir-ml'>"+"<div class='dir-mr'>"+"<div class='dir-mc'>"+"<div class='dir-text'>zurück</div>"+"</div>"+"</div>"+"</div>"+"</div>"+"<div class='pathes'></div>"+"<div class='information' style='display:none;'></div>"+"<div class='images'></div>"+"</div>";this.container.addClass("jImageGalleryBrowser-container"+(Prototype.Browser.isIE6?" jiIE6":""))+(Prototype.Browser.isIE7?" jiIE7":"");this.elementParser=this.container.down(".jImageGalleryBrowser-parser");this.elementContent=this.container.down(".jImageGalleryBrowser-content");this.elementContentPath=this.elementContent.down(".path");this.elementContentTop=this.elementContent.down(".top");this.elementContentTopText=this.elementContentTop.down(".dir-text");this.elementContentInformation=this.elementContent.down(".information");this.elementContentPathes=this.elementContent.down(".pathes");this.elementContentImages=this.elementContent.down(".images");this.elementContentLoading=new jControls.Loading({text:"Daten werden geladen...",renderTo:this.elementContent,listeners:{onAfterShow:this.options.asynchronous?Prototype.emptyFunction:V.curry(this)}});Event.observe(this.elementContentTop,"click",W.curry(this));return this}})})();
