(function(a){a.fn.imageBox=function(b){function g(c){a("body").append('<div class="imageBoxBackground" style="position:absolute; width:'+a(window).width()+"px; height:"+a(window).height()+"px; z-index:99998; background-color:#FFF; left:0; top:0; display:none; background-image: url("+b.loaderIcon+'); background-repeat: no-repeat; background-position: center center; cursor:pointer;"></div>');a(window).bind("resize",e);a(".imageBoxBackground").css("opacity","0").show().fadeTo(500,0.8,function(){var f=
new Image;a(f).load(function(){a(this).attr("height")>a(window).height()&&(a(this).attr("width",a(this).attr("width")*(a(window).height()-100)/a(this).attr("height")),a(this).attr("height",a(window).height()-100));a("body").append('<div class="imageBoxImage" style="position:absolute; z-index:99999; background-color:#6C8A42; padding:10px; left:10px; display:none;"></div>');a("body").append('<div class="imageBoxCloseButton" style="position:absolute; z-index:100000; left:0; top:0; display:none;"><a style="cursor:pointer"><img src="'+
b.closeIcon+'" width="20" height="20" alt="'+b.closeMsg+'"/></a></div>');a(".imageBoxImage").append(a(this)).css("left",a(window).width()/2-a(this).attr("width")/2).css("top",a(window).height()/2-a(this).attr("height")/2).fadeIn("slow",function(){a(".imageBoxBackground").css("background-image","")});a(".imageBoxCloseButton").css("left",parseInt(a(".imageBoxImage").css("left").replace("px",""))+a(".imageBoxImage").width()+10).css("top",parseInt(a(".imageBoxImage").css("top").replace("px",""))-10).fadeIn("slow",
function(){a(this).click(d)})}).error(function(){a(f).attr("src","../images/new/img_placeholder.png");a(this).attr("height")>a(window).height()&&(a(this).attr("width",a(this).attr("width")*(a(window).height()-100)/a(this).attr("height")),a(this).attr("height",a(window).height()-100));a("body").append('<div class="imageBoxImage" style="position:absolute; z-index:99999; background-color:#6C8A42; padding:10px; left:10px; display:none;"></div>');a("body").append('<div class="imageBoxCloseButton" style="position:absolute; z-index:100000; left:0; top:0; display:none;"><a style="cursor:pointer"><img src="'+
b.closeIcon+'" width="20" height="20" alt="'+b.closeMsg+'"/></a></div>');a(".imageBoxImage").append(a(this)).css("left",a(window).width()/2-a(this).attr("width")/2).css("top",a(window).height()/2-a(this).attr("height")/2).fadeIn("slow",function(){a(".imageBoxBackground").css("background-image","")});a(".imageBoxCloseButton").css("left",parseInt(a(".imageBoxImage").css("left").replace("px",""))+a(".imageBoxImage").width()+10).css("top",parseInt(a(".imageBoxImage").css("top").replace("px",""))-10).fadeIn("slow",
function(){a(this).click(d)})}).attr("src",c.data.image.attr("rel"))}).click(d)}function d(){a(".imageBoxImage").fadeTo(500,0,function(){a(this).remove();a(".imageBoxBackground").fadeTo(500,0,function(){a(this).remove();a(window).unbind("resize",e)})});a(".imageBoxCloseButton").fadeTo(250,0,function(){a(this).remove()})}function e(){a(".imageBoxBackground").css("width",a(window).width()).css("height",a(window).height())}a.fn.imageBox.defaults={closeMsg:"Schlie\u00dfen",zoomIcon:"../images/imageBoxZoomIcon.png",
zoomSmallIcon:"../images/imageBoxZoomSmallIcon.png",loaderIcon:"../images/imageBoxLoaderIcon.gif",closeIcon:"../images/imageBoxCloseButton.png"};b=a.extend({},a.fn.imageBox.defaults,b);return this.each(function(){if(a(this).attr("rel")!=void 0){a(this).wrapAll('<div class="imageBoxDiv" style="width:'+a(this).width()+"px; height:"+a(this).height()+'px;"></div>');var c=a(this).parents(".imageBoxDiv:eq(0)");c.append('<div class="imageBoxZoomSmallIcon" style="position:relative; width:'+a(this).width()+
"px; height:"+a(this).height()+"px; left:0px; top:-"+a(this).height()+"px; background-image: url("+b.zoomSmallIcon+'); background-repeat: no-repeat; background-position: left bottom; cursor:pointer;">\u00a0</div>');c.append('<div class="imageBoxZoomIcon" style="position:relative; width:'+a(this).width()+"px; height:"+a(this).height()+"px; left:0px; top:-"+a(this).height()*2+"px; background-image: url("+b.zoomIcon+'); background-repeat: no-repeat; background-position: center center; cursor:pointer; visibility:hidden;">\u00a0</div>');
c.bind("mouseenter",function(){var b=a(this).find(".imageBoxZoomIcon");b.css("opacity","0").css("visibility","visible");a.browser.msie?b.show().fadeTo(200,0.6):b.show().fadeTo(200,1)}).bind("mouseleave",function(){a(this).find(".imageBoxZoomIcon").fadeOut(100)}).bind("click",{image:a(this)},g)}})}})(jQuery);
