(function($){var win=$(window),options,images,activeImage=-1,activeURL,prevImage,nextImage,compatibleOverlay,middle,centerWidth,centerHeight,ie6=!window.XMLHttpRequest,operaFix=window.opera&&(document.compatMode=="CSS1Compat")&&($.browser.version>=9.3),documentElement=document.documentElement,preload={},preloadPrev=new Image(),preloadNext=new Image(),overlay,center,image,sizer,prevLink,nextLink,bottomContainer,bottom,caption,number;$(function(){$("body").append($([overlay=$('
')[0],center=$('')[0],bottomContainer=$('')[0]]).css("display","none"));image=$('').append('').appendTo(center).append(sizer=$('').append([prevLink=$('').click(previous)[0],nextLink=$('').click(next)[0]])[0])[0];$('
').appendTo('#lbSpecialImageHolder');bottom=$('').appendTo(bottomContainer).append([$('').add(overlay).click(close)[0],caption=$('')[0],number=$('')[0],$('')[0]])[0];});$.slimbox=function(_images,startImage,_options){options=$.extend({loop:false,overlayOpacity:0.8,overlayFadeDuration:400,resizeDuration:400,resizeEasing:"swing",initialWidth:250,initialHeight:250,imageFadeDuration:400,captionAnimationDuration:400,counterText:"Image {x} of {y}",closeKeys:[27,88,67],previousKeys:[37,80],nextKeys:[39,78],maxWidth:$(window).width()-70,maxHeight:$(window).height()-130},_options);if(typeof _images=="string"){_images=[[_images,startImage]];startImage=0;}middle=win.scrollTop()+((operaFix?documentElement.clientHeight:win.height())/2);centerWidth=options.initialWidth;centerHeight=options.initialHeight;$(center).css({top:Math.max(0,middle-(centerHeight/2)),width:centerWidth,height:centerHeight,marginLeft:-centerWidth/2}).show();compatibleOverlay=ie6||(overlay.currentStyle&&(overlay.currentStyle.position!="fixed"));if(compatibleOverlay)overlay.style.position="absolute";$(overlay).css("opacity",options.overlayOpacity).fadeIn(options.overlayFadeDuration);position();setup(1);images=_images;options.loop=options.loop&&(images.length>1);return changeImage(startImage);};$.fn.slimbox=function(_options,linkMapper,linksFilter){linkMapper=linkMapper||function(el){return[el.href,el.title];};linksFilter=linksFilter||function(){return true;};var links=this;return links.unbind("click").click(function(){var link=this,startIndex=0,filteredLinks,i=0,length;filteredLinks=$.grep(links,function(el,i){return linksFilter.call(link,el,i);});for(length=filteredLinks.length;i=0)?close():(fn(code,options.nextKeys)>=0)?next():(fn(code,options.previousKeys)>=0)?previous():false;}function previous(){return changeImage(prevImage);}function next(){return changeImage(nextImage);}function changeImage(imageIndex){if(imageIndex>=0){activeImage=imageIndex;activeURL=images[activeImage][0];prevImage=(activeImage||(options.loop?images.length:0))-1;nextImage=((activeImage+1)%images.length)||(options.loop?0:-1);stop();center.className="lbLoading";preload=new Image();preload.onload=animateBox;preload.src=activeURL;}return false;}function animateBox(){center.className="";$(image).css({visibility:"hidden",display:""});if(preload.width>options.maxWidth){var oldwidth=preload.width;preload.width=options.maxWidth;preload.height=preload.height/(oldwidth/preload.width);}if(preload.height>options.maxHeight){var oldheight=preload.height;preload.height=options.maxHeight;preload.width=preload.width/(oldheight/preload.height);}$('#lbSpecialImage').attr('src',activeURL).width(preload.width).height(preload.height);$(sizer).width(preload.width);$([sizer,prevLink,nextLink]).height(preload.height);$(caption).html(images[activeImage][1]||"");$(number).html((((images.length>1)&&options.counterText)||"").replace(/{x}/,activeImage+1).replace(/{y}/,images.length));if(prevImage>=0)preloadPrev.src=images[prevImage][0];if(nextImage>=0)preloadNext.src=images[nextImage][0];centerWidth=image.offsetWidth;centerHeight=image.offsetHeight;var top=Math.max(0,middle-(centerHeight/2));if(center.offsetHeight!=centerHeight){$(center).animate({height:centerHeight,top:top},options.resizeDuration,options.resizeEasing);}if(center.offsetWidth!=centerWidth){$(center).animate({width:centerWidth,marginLeft:-centerWidth/2},options.resizeDuration,options.resizeEasing);}$(center).queue(function(){$(bottomContainer).css({width:centerWidth,top:top+centerHeight,marginLeft:-centerWidth/2,visibility:"hidden",display:""});$(image).css({display:"none",visibility:"",opacity:""}).fadeIn(options.imageFadeDuration,animateCaption);});}function animateCaption(){if(prevImage>=0)$(prevLink).show();if(nextImage>=0)$(nextLink).show();$(bottom).css("marginTop",-bottom.offsetHeight).animate({marginTop:0},options.captionAnimationDuration);bottomContainer.style.visibility="";}function stop(){preload.onload=null;preload.src=preloadPrev.src=preloadNext.src=activeURL;$([center,image,bottom]).stop(true);$([prevLink,nextLink,image,bottomContainer]).hide();}function close(){if(activeImage>=0){stop();activeImage=prevImage=nextImage=-1;$(center).hide();$(overlay).stop().fadeOut(options.overlayFadeDuration,setup);}return false;}})(jQuery);jQuery(function($){$("a[rel^='lightbox']").slimbox({loop:true,counterText:"Bild {x} von {y}"},null,function(el){return(this==el)||((this.rel.length>8)&&(this.rel==el.rel));});});