(function(c,ka){function g(b,d){b=b?' id="'+l+b+'"':"";d=d?' style="'+d+'"':"";return c("<div"+b+d+"/>")}function q(b,d){d=d==="x"?p.width():p.height();return typeof b==="string"?Math.round(b.match(/%/)?d/100*parseInt(b,10):parseInt(b,10)):b}function Q(b,d){b=c.isFunction(b)?b.call(d):b;return a.photo||b.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i)}function da(b){for(var d in b)if(c.isFunction(b[d])&&d.substring(0,2)!=="on")b[d]=b[d].call(o);b.rel=b.rel||o.rel||"nofollow";b.href=b.href|| c(o).attr("href");b.title=b.title||o.title;return b}function v(b,d){d&&d.call(o);c.event.trigger(b)}function la(){var b,d=l+"Slideshow_",e,i;if(a.slideshow&&k[1]){e=function(){w.text(a.slideshowStop).bind(R,function(){b=setTimeout(f.next,a.slideshowSpeed)}).bind(S,function(){clearTimeout(b)}).one("click",function(){i()});j.removeClass(d+"off").addClass(d+"on")};i=function(){clearTimeout(b);w.text(a.slideshowStart).unbind(R+" "+S).one("click",function(){e();b=setTimeout(f.next,a.slideshowSpeed)}); j.removeClass(d+"on").addClass(d+"off")};w.bind(ea,function(){w.unbind();clearTimeout(b);j.removeClass(d+"off "+d+"on")});a.slideshowAuto?e():i()}}function fa(b){if(!N){o=b;a=da(c.extend({},c.data(o,r)));k=c(o);h=0;if(a.rel!=="nofollow"){k=c("."+I).filter(function(){return(c.data(this,r).rel||this.rel)===a.rel});h=k.index(o);if(h===-1){k=k.add(o);h=k.length-1}}if(!t){t=F=true;j.show();T=o;try{T.blur()}catch(d){}x.css({opacity:+a.opacity,cursor:a.overlayClose?"pointer":"auto"}).show();a.w=q(a.initialWidth, "x");a.h=q(a.initialHeight,"y");f.position(0);U&&p.bind("resize."+O+" scroll."+O,function(){x.css({width:p.width(),height:p.height(),top:p.scrollTop(),left:p.scrollLeft()})}).trigger("scroll."+O);v(ga,a.onOpen);V.add(J).add(K).add(w).add(W).hide();X.html(a.close).show()}f.load(true)}}var ha={transition:"elastic",speed:300,width:false,initialWidth:"600",innerWidth:false,maxWidth:false,height:false,initialHeight:"450",innerHeight:false,maxHeight:false,scalePhotos:true,scrolling:true,inline:false,html:false, iframe:false,photo:false,href:false,title:false,rel:false,opacity:0.9,preloading:true,current:"foto {current} z {total}",previous:"předchozí",next:"další",close:"zavřít",open:false,loop:true,slideshow:false,slideshowAuto:true,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:false,onLoad:false,onComplete:false,onCleanup:false,onClosed:false,overlayClose:true,escKey:true,arrowKey:true},r="colorbox",l="cbox",ga=l+"_open",S=l+"_load",R=l+"_complete",ia=l+"_cleanup", ea=l+"_closed",P=l+"_purge",ja=l+"_loaded",B=c.browser.msie&&!c.support.opacity,U=B&&c.browser.version<7,O=l+"_IE6",x,j,C,s,Y,Z,$,aa,k,p,m,L,M,W,V,w,K,J,X,D,E,y,z,o,T,h,a,t,F,N=false,f,I=l+"Element";f=c.fn[r]=c[r]=function(b,d){var e=this,i;if(!e[0]&&e.selector)return e;b=b||{};if(d)b.onComplete=d;if(!e[0]||e.selector===undefined){e=c("<a/>");b.open=true}e.each(function(){c.data(this,r,c.extend({},c.data(this,r)||ha,b));c(this).addClass(I)});i=b.open;if(c.isFunction(i))i=i.call(e);i&&fa(e[0]);return e}; f.init=function(){p=c(ka);j=g().attr({id:r,"class":B?l+"IE":""});x=g("Overlay",U?"position:absolute":"").hide();C=g("Wrapper");s=g("Content").append(m=g("LoadedContent","width:0; height:0; overflow:hidden"),M=g("LoadingOverlay").add(g("LoadingGraphic")),W=g("Title"),V=g("Current"),K=g("Next"),J=g("Previous"),w=g("Slideshow").bind(ga,la),X=g("Close"));C.append(g().append(g("TopLeft"),Y=g("TopCenter"),g("TopRight")),g(false,"clear:left").append(Z=g("MiddleLeft"),s,$=g("MiddleRight")),g(false,"clear:left").append(g("BottomLeft"), aa=g("BottomCenter"),g("BottomRight"))).children().children().css({"float":"left"});L=g(false,"position:absolute; width:9999px; visibility:hidden; display:none");c("body").prepend(x,j.append(C,L));s.children().hover(function(){c(this).addClass("hover")},function(){c(this).removeClass("hover")}).addClass("hover");D=Y.height()+aa.height()+s.outerHeight(true)-s.height();E=Z.width()+$.width()+s.outerWidth(true)-s.width();y=m.outerHeight(true);z=m.outerWidth(true);j.css({"padding-bottom":D,"padding-right":E}).hide(); K.click(f.next);J.click(f.prev);X.click(f.close);s.children().removeClass("hover");c("."+I).live("click",function(b){if(!(b.button!==0&&typeof b.button!=="undefined"||b.ctrlKey||b.shiftKey||b.altKey)){b.preventDefault();fa(this)}});x.click(function(){a.overlayClose&&f.close()});c(document).bind("keydown",function(b){if(t&&a.escKey&&b.keyCode===27){b.preventDefault();f.close()}if(t&&a.arrowKey&&!F&&k[1])if(b.keyCode===37&&(h||a.loop)){b.preventDefault();J.click()}else if(b.keyCode===39&&(h<k.length- 1||a.loop)){b.preventDefault();K.click()}})};f.remove=function(){j.add(x).remove();c("."+I).die("click").removeData(r).removeClass(I)};f.position=function(b,d){function e(A){Y[0].style.width=aa[0].style.width=s[0].style.width=A.style.width;M[0].style.height=M[1].style.height=s[0].style.height=Z[0].style.height=$[0].style.height=A.style.height}var i,u=Math.max(document.documentElement.clientHeight-a.h-y-D,0)/2+p.scrollTop(),n=Math.max(p.width()-a.w-z-E,0)/2+p.scrollLeft();i=j.width()===a.w+z&&j.height()=== a.h+y?0:b;C[0].style.width=C[0].style.height="9999px";j.dequeue().animate({width:a.w+z,height:a.h+y,top:u,left:n},{duration:i,complete:function(){e(this);F=false;C[0].style.width=a.w+z+E+"px";C[0].style.height=a.h+y+D+"px";d&&d()},step:function(){e(this)}})};f.resize=function(b){if(t){b=b||{};if(b.width)a.w=q(b.width,"x")-z-E;if(b.innerWidth)a.w=q(b.innerWidth,"x");m.css({width:a.w});if(b.height)a.h=q(b.height,"y")-y-D;if(b.innerHeight)a.h=q(b.innerHeight,"y");if(!b.innerHeight&&!b.height){b=m.wrapInner("<div style='overflow:auto'></div>").children(); a.h=b.height();b.replaceWith(b.children())}m.css({height:a.h});f.position(a.transition==="none"?0:a.speed)}};f.prep=function(b){function d(u){var n,A,G,ba,H=k.length,ca=a.loop;f.position(u,function(){if(t){B&&e&&m.fadeIn(100);m.show();v(ja);W.show().html(a.title);if(H>1){V.html(a.current.replace(/\{current\}/,h+1).replace(/\{total\}/,H)).show();K[ca||h<H-1?"show":"hide"]().html(a.next);J[ca||h?"show":"hide"]().html(a.previous);n=h?k[h-1]:k[H-1];G=h<H-1?k[h+1]:k[0];if(a.slideshow){w.show();h===H-1&& !ca&&j.is("."+l+"Slideshow_on")&&w.click()}if(a.preloading){ba=c.data(G,r).href||G.href;A=c.data(n,r).href||n.href;if(Q(ba,G))c("<img/>")[0].src=ba;if(Q(A,n))c("<img/>")[0].src=A}}M.hide();if(a.transition==="fade")j.fadeTo(i,1,function(){if(B)j[0].style.filter=false});else if(B)j[0].style.filter=false;p.bind("resize."+l,function(){f.position(0)});v(R,a.onComplete)}})}if(t){var e,i=a.transition==="none"?0:a.speed;p.unbind("resize."+l);m.remove();m=g("LoadedContent").html(b);m.hide().appendTo(L.show()).css({width:function(){a.w= a.w||m.width();a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}(),overflow:a.scrolling?"auto":"hidden"}).css({height:function(){a.h=a.h||m.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}()}).prependTo(s);L.hide();c("#"+l+"Photo").css({cssFloat:"none",marginLeft:"auto",marginRight:"auto"});U&&c("select").not(j.find("select")).filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one(ia,function(){this.style.visibility="inherit"});a.transition==="fade"?j.fadeTo(i,0,function(){d(0)}): d(i)}};f.load=function(b){var d,e,i,u=f.prep;F=true;o=k[h];b||(a=da(c.extend({},c.data(o,r))));v(P);v(S,a.onLoad);a.h=a.height?q(a.height,"y")-y-D:a.innerHeight&&q(a.innerHeight,"y");a.w=a.width?q(a.width,"x")-z-E:a.innerWidth&&q(a.innerWidth,"x");a.mw=a.w;a.mh=a.h;if(a.maxWidth){a.mw=q(a.maxWidth,"x")-z-E;a.mw=a.w&&a.w<a.mw?a.w:a.mw}if(a.maxHeight){a.mh=q(a.maxHeight,"y")-y-D;a.mh=a.h&&a.h<a.mh?a.h:a.mh}d=a.href;M.show();if(a.inline){g().hide().insertBefore(c(d)[0]).one(P,function(){c(this).replaceWith(m.children())}); u(c(d))}else if(a.iframe){j.one(ja,function(){var n=c("<iframe name='"+(new Date).getTime()+"' frameborder=0"+(a.scrolling?"":" scrolling='no'")+(B?" allowtransparency='true'":"")+" style='width:100%; height:100%; border:0; display:block;'/>");n[0].src=a.href;n.appendTo(m).one(P,function(){n[0].src="about:blank"})});u(" ")}else if(a.html)u(a.html);else if(Q(d,o)){e=new Image;e.onload=function(){var n;e.onload=null;e.id=l+"Photo";c(e).css({border:"none",display:"block",cssFloat:"left"});if(a.scalePhotos){i= function(){e.height-=e.height*n;e.width-=e.width*n};if(a.mw&&e.width>a.mw){n=(e.width-a.mw)/e.width;i()}if(a.mh&&e.height>a.mh){n=(e.height-a.mh)/e.height;i()}}if(a.h)e.style.marginTop=Math.max(a.h-e.height,0)/2+"px";if(k[1]&&(h<k.length-1||a.loop))c(e).css({cursor:"pointer"}).click(f.next);if(B)e.style.msInterpolationMode="bicubic";setTimeout(function(){u(e)},1)};setTimeout(function(){e.src=d},1)}else g().appendTo(L).load(d,function(n,A,G){u(A==="error"?"Request unsuccessful: "+G.statusText:this)})}; f.next=function(){if(!F){h=h<k.length-1?h+1:0;f.load()}};f.prev=function(){if(!F){h=h?h-1:k.length-1;f.load()}};f.close=function(){if(t&&!N){N=true;t=false;v(ia,a.onCleanup);p.unbind("."+l+" ."+O);x.fadeTo("fast",0);j.stop().fadeTo("fast",0,function(){v(P);m.remove();j.add(x).css({opacity:1,cursor:"auto"}).hide();try{T.focus()}catch(b){}setTimeout(function(){N=false;v(ea,a.onClosed)},1)})}};f.element=function(){return c(o)};f.settings=ha;c(f.init)})(jQuery,this);function str_trim(a) {
    a = a.replace(/^\s\s*/, ''), ws = /\s/, i = a.length;
    while (ws.test(a.charAt(--i)));
    return a.slice(0, i + 1)
}
$(document).ready(function () {
    $(".colorbox").colorbox({
        maxWidth: "90%",
        maxHeight: "90%",
        transition: 'none',
        speed: 1
    });
    $('.tooltip .close-button').click(function () {
        $(this).parent('.tooltip').fadeOut();
    });
    $('.vystava-title').click(function () {
        $('.tooltip').hide();
        var a = $('#vystava-box-' + $(this).attr('id').substr(8));
        if (str_trim(a.text()).length) {
            a.fadeIn();
            a.css("margin-left","-"+a.outerWidth()/2+"px");
        }

    })
});
