(function(g){g.fn.fixPNG=function(){return this.each(function(){var k=g(this).css("backgroundImage");if(k.match(/^url\(["']?(.*\.png)["']?\)$/i)){k=RegExp.$1;g(this).css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod="+(g(this).css("backgroundRepeat")=="no-repeat"?"crop":"scale")+", src='"+k+"')"}).each(function(){var l=g(this).css("position");if(l!="absolute"&&l!="relative"){g(this).css("position","relative")}})}})};var d,a,h=false,c=new Image,i,j=1,f=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i;var b=(g.browser.msie&&parseInt(g.browser.version.substr(0,1))<8);var e=(g.browser.msie&&parseInt(g.browser.version.substr(0,1))==8);g.fn.fancybox=function(l){l=g.extend({},g.fn.fancybox.defaults,l);var t=this;function o(){d=this;a=l;m();return false}function m(){if(h){return}if(g.isFunction(a.callbackOnStart)){a.callbackOnStart()}a.itemArray=[];a.itemCurrent=0;if(l.itemArray.length>0){a.itemArray=l.itemArray}else{var v={};if(!d.rel||d.rel==""){var v={href:d.href,title:d.title};if(g(d).children("img:first").length){v.orig=g(d).children("img:first")}a.itemArray.push(v)}else{var w=g(t).filter("a[rel="+d.rel+"]");var v={};for(var u=0;u<w.length;u++){v={href:w[u].href,title:w[u].title};if(g(w[u]).children("img:first").length){v.orig=g(w[u]).children("img:first")}a.itemArray.push(v)}while(a.itemArray[a.itemCurrent].href!=d.href){a.itemCurrent++}}}if(a.overlayShow){if(b){g("embed, object, select").css("visibility","hidden")}g("#fancy_overlay").css("opacity",a.overlayOpacity).show()}p()}function p(){g("#fancy_right, #fancy_left, #fancy_close, #fancy_title").hide();var u=a.itemArray[a.itemCurrent].href;if(u.match(/#/)){var v=window.location.href.split("#")[0];v=u.replace(v,"");v=v.substr(v.indexOf("#"));n('<div id="fancy_div">'+g(v).html()+"</div>",a.frameWidth,a.frameHeight)}else{if(u.match(f)){c=new Image;c.src=u;if(c.complete){s()}else{g.fn.fancybox.showLoading();g(c).unbind().bind("load",function(){g(".fancy_loading").hide();s()})}}else{if(u.match("iframe")||d.className.indexOf("iframe")>=0){n('<iframe id="fancy_frame" onload="$.fn.fancybox.showIframe()" name="fancy_iframe'+Math.round(Math.random()*1000)+'" frameborder="0" hspace="0" src="'+u+'"></iframe>',a.frameWidth,a.frameHeight)}else{g.get(u,function(w){n('<div id="fancy_ajax">'+w+"</div>",a.frameWidth,a.frameHeight)})}}}}function s(){if(a.imageScale){var v=g.fn.fancybox.getViewport();var y=Math.min(Math.min(v[0]-36,c.width)/c.width,Math.min(v[1]-60,c.height)/c.height);var x=Math.round(y*c.width);var u=Math.round(y*c.height)}else{var x=c.width;var u=c.height}n('<img alt="" id="fancy_img" src="'+c.src+'" />',x,u)}function q(){if((a.itemArray.length-1)>a.itemCurrent){var u=a.itemArray[a.itemCurrent+1].href;if(u.match(f)){objNext=new Image();objNext.src=u}}if(a.itemCurrent>0){var u=a.itemArray[a.itemCurrent-1].href;if(u.match(f)){objNext=new Image();objNext.src=u}}}function n(A,v,C){h=true;var y=a.padding;if(b){g("#fancy_content")[0].style.removeExpression("height");g("#fancy_content")[0].style.removeExpression("width")}if(y>0){v+=y*2;C+=y*2;g("#fancy_content").css({top:y+"px",right:y+"px",bottom:y+"px",left:y+"px",width:"auto",height:"auto"});if(b){g("#fancy_content")[0].style.setExpression("height","(this.parentNode.clientHeight - 20)");g("#fancy_content")[0].style.setExpression("width","(this.parentNode.clientWidth - 20)")}}else{g("#fancy_content").css({top:0,right:0,bottom:0,left:0,width:"100%",height:"100%"})}if(g("#fancy_outer").is(":visible")&&v==g("#fancy_outer").width()&&C==g("#fancy_outer").height()){g("#fancy_content").fadeOut("fast",function(){g("#fancy_content").empty().append(g(A)).fadeIn("normal",function(){k()})});return}var B=g.fn.fancybox.getViewport();var x=(v+36)>B[0]?B[2]:(B[2]+Math.round((B[0]-v-36)/2));var E=(C+50)>B[1]?B[3]:(B[3]+Math.round((B[1]-C-50)/2));var D={left:x,top:E,width:v+"px",height:C+"px"};if(g("#fancy_outer").is(":visible")){g("#fancy_content").fadeOut("normal",function(){g("#fancy_content").empty();g("#fancy_outer").animate(D,a.zoomSpeedChange,a.easingChange,function(){g("#fancy_content").append(g(A)).fadeIn("normal",function(){k()})})})}else{if(a.zoomSpeedIn>0&&a.itemArray[a.itemCurrent].orig!==undefined){g("#fancy_content").empty().append(g(A));var z=a.itemArray[a.itemCurrent].orig;var u=g.fn.fancybox.getPosition(z);g("#fancy_outer").css({left:(u.left-18)+"px",top:(u.top-18)+"px",width:g(z).width(),height:g(z).height()});if(a.zoomOpacity){D.opacity="show"}g("#fancy_outer").animate(D,a.zoomSpeedIn,a.easingIn,function(){k()})}else{g("#fancy_content").hide().empty().append(g(A)).show();g("#fancy_outer").css(D).fadeIn("normal",function(){k()})}}}function r(){if(a.itemCurrent!=0){g("#fancy_left, #fancy_left_ico").unbind().bind("click",function(u){u.stopPropagation();a.itemCurrent--;p();return false});g("#fancy_left").show()}if(a.itemCurrent!=(a.itemArray.length-1)){g("#fancy_right, #fancy_right_ico").unbind().bind("click",function(u){u.stopPropagation();a.itemCurrent++;p();return false});g("#fancy_right").show()}}function k(){r();q();g(document).keydown(function(v){if(v.keyCode==27){g.fn.fancybox.close();g(document).unbind("keydown")}else{if(v.keyCode==37&&a.itemCurrent!=0){a.itemCurrent--;p();g(document).unbind("keydown")}else{if(v.keyCode==39&&a.itemCurrent!=(a.itemArray.length-1)){a.itemCurrent++;p();g(document).unbind("keydown")}}}});if(a.centerOnScroll){g(window).bind("resize scroll",g.fn.fancybox.scrollBox)}else{g("div#fancy_outer").css("position","absolute")}if(a.hideOnContentClick){g("#fancy_wrap").click(g.fn.fancybox.close)}g("#fancy_overlay, #fancy_close").bind("click",g.fn.fancybox.close);g("#fancy_close").show();var u="";if(a.showItemNum&&a.itemArray.length>1){u="Bild "+(a.itemCurrent+1)+" von "+a.itemArray.length}if(a.itemArray[a.itemCurrent].title!==undefined&&a.itemArray[a.itemCurrent].title.length>0){u=((u!="")?u+" &nbsp;&bull;&nbsp; ":"")+a.itemArray[a.itemCurrent].title}if(u!=""){g("#fancy_title div").html(u);g("#fancy_title").show()}if(a.overlayShow&&b){g("embed, object, select",g("#fancy_content")).css("visibility","visible")}if(g.isFunction(a.callbackOnShow)){a.callbackOnShow()}h=false}return this.unbind("click").click(o)};g.fn.fancybox.scrollBox=function(){var k=g.fn.fancybox.getViewport();g("#fancy_outer").css("left",((g("#fancy_outer").width()+36)>k[0]?k[2]:k[2]+Math.round((k[0]-g("#fancy_outer").width()-36)/2)));g("#fancy_outer").css("top",((g("#fancy_outer").height()+50)>k[1]?k[3]:k[3]+Math.round((k[1]-g("#fancy_outer").height()-50)/2)))};g.fn.fancybox.getNumeric=function(k,l){return parseInt(g.curCSS(k.jquery?k[0]:k,l,true))||0};g.fn.fancybox.getPosition=function(k){var l=k.offset();l.top+=g.fn.fancybox.getNumeric(k,"paddingTop");l.top+=g.fn.fancybox.getNumeric(k,"borderTopWidth");l.left+=g.fn.fancybox.getNumeric(k,"paddingLeft");l.left+=g.fn.fancybox.getNumeric(k,"borderLeftWidth");return l};g.fn.fancybox.showIframe=function(){g(".fancy_loading").hide();g("#fancy_frame").show()};g.fn.fancybox.getViewport=function(){return[g(window).width(),g(window).height(),g(document).scrollLeft(),g(document).scrollTop()]};g.fn.fancybox.animateLoading=function(){if(!g("#fancy_loading").is(":visible")){clearInterval(i);return}g("#fancy_loading > div").css("top",(j*-40)+"px");j=(j+1)%12};g.fn.fancybox.showLoading=function(){clearInterval(i);var k=g.fn.fancybox.getViewport();g("#fancy_loading").css({left:((k[0]-40)/2+k[2]),top:((k[1]-40)/2+k[3])}).show();g("#fancy_loading").bind("click",g.fn.fancybox.close);i=setInterval(g.fn.fancybox.animateLoading,66)};g.fn.fancybox.close=function(){h=true;g(c).unbind();g("#fancy_overlay, #fancy_close").unbind();if(a.hideOnContentClick){g("#fancy_wrap").unbind()}g("#fancy_close, .fancy_loading, #fancy_left, #fancy_right, #fancy_title").hide();if(a.centerOnScroll){g(window).unbind("resize scroll")}__cleanup=function(){g("#fancy_overlay, #fancy_outer").hide();if(a.centerOnScroll){g(window).unbind("resize scroll")}if(b){g("embed, object, select").css("visibility","visible")}if(g.isFunction(a.callbackOnClose)){a.callbackOnClose()}h=false};if(g("#fancy_outer").is(":visible")!==false){if(a.zoomSpeedOut>0&&a.itemArray[a.itemCurrent].orig!==undefined){var l=a.itemArray[a.itemCurrent].orig;var k=g.fn.fancybox.getPosition(l);var m={left:(k.left-18)+"px",top:(k.top-18)+"px",width:g(l).width(),height:g(l).height()};if(a.zoomOpacity){m.opacity="hide"}g("#fancy_outer").stop(false,true).animate(m,a.zoomSpeedOut,a.easingOut,__cleanup)}else{g("#fancy_outer").stop(false,true).fadeOut("fast",__cleanup)}}else{__cleanup()}return false};g.fn.fancybox.build=function(){var k="";k+='<div id="fancy_overlay"></div>';k+='<div id="fancy_wrap">';k+='<div class="fancy_loading" id="fancy_loading"><div></div></div>';k+='<div id="fancy_outer">';k+='<div id="fancy_inner">';k+='<div id="fancy_close"></div>';k+='<div id="fancy_bg"><div class="fancy_bg fancy_bg_n"></div><div class="fancy_bg fancy_bg_ne"></div><div class="fancy_bg fancy_bg_e"></div><div class="fancy_bg fancy_bg_se"></div><div class="fancy_bg fancy_bg_s"></div><div class="fancy_bg fancy_bg_sw"></div><div class="fancy_bg fancy_bg_w"></div><div class="fancy_bg fancy_bg_nw"></div></div>';k+='<a href="javascript:;" id="fancy_left"><span class="fancy_ico" id="fancy_left_ico"></span></a><a href="javascript:;" id="fancy_right"><span class="fancy_ico" id="fancy_right_ico"></span></a>';k+='<div id="fancy_content"></div>';k+='<div id="fancy_title"></div>';k+="</div>";k+="</div>";k+="</div>";g(k).appendTo("body");g('<table cellspacing="0" cellpadding="0" border="0"><tr><td class="fancy_title" id="fancy_title_left"></td><td class="fancy_title" id="fancy_title_main"><div></div></td><td class="fancy_title" id="fancy_title_right"></td></tr></table>').appendTo("#fancy_title");if(b||e){g("#fancy_inner").prepend('<iframe class="fancy_bigIframe" scrolling="no" frameborder="0"></iframe>');g("#fancy_close, .fancy_bg, .fancy_title, .fancy_ico").fixPNG()}};g.fn.fancybox.defaults={padding:10,imageScale:true,zoomOpacity:false,zoomSpeedIn:0,zoomSpeedOut:0,zoomSpeedChange:300,easingIn:"swing",easingOut:"swing",easingChange:"swing",frameWidth:425,frameHeight:355,overlayShow:true,overlayOpacity:0.3,hideOnContentClick:true,centerOnScroll:true,itemArray:[],callbackOnStart:null,callbackOnShow:null,callbackOnClose:null,showItemNum:false};g(document).ready(function(){g.fn.fancybox.build()})})(jQuery);

