// ColorBox v1.3.17.4 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
// Lucas Monteverde - Adicionado opção de minWidth;
// Copyright (c) 2011 Jack Moore - jack@colorpowered.com
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
(function(b,B,fa){function c(a,y,d){d=B.createElement("div");if(a)d.id=m+a;d.style.cssText=y||"";return b(d)}function k(a,b){return Math.round((/%/.test(a)?(b==="x"?f.width():f.height())/100:1)*parseInt(a,10))}function N(e){return a.photo||/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(e)}function $(e){a=b.extend({},b.data(n,p));for(e in a)b.isFunction(a[e])&&e.substring(0,2)!=="on"&&(a[e]=a[e].call(n));a.rel=a.rel||n.rel||"nofollow";a.href=a.href||b(n).attr("href");a.title=a.title||n.title;if(typeof a.href==="string")a.href=b.trim(a.href)}function w(a,d){d&&d.call(n);b.event.trigger(a)}function ga(){var e,b=m+"Slideshow_",c="click."+m,g,O;a.slideshow&&i[1]?(g=function(){C.text(a.slideshowStop).unbind(c).bind(P,function(){if(j<i.length-1||a.loop)e=setTimeout(d.next,a.slideshowSpeed)}).bind(Q,function(){clearTimeout(e)}).one(c+" "+J,O);l.removeClass(b+"off").addClass(b+"on");e=setTimeout(d.next,a.slideshowSpeed)},O=function(){clearTimeout(e);C.text(a.slideshowStart).unbind([P,Q,J,c].join(" ")).one(c,g);l.removeClass(b+"on").addClass(b+"off")},a.slideshowAuto?g():O()):l.removeClass(b+"off "+b+"on")}function aa(e){if(!K){n=e;$();i=b(n);j=0;a.rel!=="nofollow"&&(i=b("."+z).filter(function(){return(b.data(this,p).rel||this.rel)===a.rel}),j=i.index(n),j===-1&&(i=i.add(n),j=i.length-1));if(!q){q=D=!0;l.show();if(a.returnFocus)try{n.blur(),b(n).one(ba,function(){try{this.focus()}catch(a){}})}catch(c){}t.css({opacity:+a.opacity,cursor:a.overlayClose?"pointer":"auto"}).show();a.w=k(a.initialWidth,"x");a.h=k(a.initialHeight,"y");d.position();E&&f.bind("resize."+L+" scroll."+L,function(){t.css({width:f.width(),height:f.height(),top:f.scrollTop(),left:f.scrollLeft()})}).trigger("resize."+L);w(ca,a.onOpen);R.add(S).hide();T.html(a.close).show()}d.load(!0)}}var da={transition:"elastic",speed:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,inline:!1,html:!1,iframe:!1,fastIframe:!0,photo:!1,href:!1,title:!1,rel:!1,opacity:0.9,preloading:!0,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:!1,returnFocus:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:!1,minWidth:!1},p="colorbox",m="cbox",z=m+"Element",ca=m+"_open",Q=m+"_load",P=m+"_complete",J=m+"_cleanup",ba=m+"_closed",M=m+"_purge",A=b.browser.msie&&!b.support.opacity,E=A&&b.browser.version<7,L=m+"_IE6",t,l,x,h,U,V,W,X,i,f,o,F,G,S,Y,C,H,I,T,R,a,u,v,r,s,n,j,g,q,D,K,Z,ea,d;d=b.fn[p]=b[p]=function(a,d){var c=this,a=a||{};if(!c[0]){if(c.selector)return c;c=b("<a/>");a.open=!0}if(d)a.onComplete=d;c.each(function(){b.data(this,p,b.extend({},b.data(this,p)||da,a));b(this).addClass(z)});(b.isFunction(a.open)&&a.open.call(c)||a.open)&&aa(c[0]);return c};d.init=function(){f=b(fa);l=c().attr({id:p,"class":A?m+(E?"IE6":"IE"):""});t=c("Overlay",E?"position:absolute":"").hide();x=c("Wrapper");h=c("Content").append(o=c("LoadedContent","width:0; height:0; overflow:hidden"),G=c("LoadingOverlay").add(c("LoadingGraphic")),S=c("Title"),Y=c("Current"),H=c("Next"),I=c("Previous"),C=c("Slideshow").bind(ca,ga),T=c("Close"));x.append(c().append(c("TopLeft"),U=c("TopCenter"),c("TopRight")),c(!1,"clear:left").append(V=c("MiddleLeft"),h,W=c("MiddleRight")),c(!1,"clear:left").append(c("BottomLeft"),X=c("BottomCenter"),c("BottomRight"))).children().children().css({"float":"left"});F=c(!1,"position:absolute; width:9999px; visibility:hidden; display:none");b("body").prepend(t,l.append(x,F));h.children().hover(function(){b(this).addClass("hover")},function(){b(this).removeClass("hover")}).addClass("hover");u=U.height()+X.height()+h.outerHeight(!0)-h.height();v=V.width()+W.width()+h.outerWidth(!0)-h.width();r=o.outerHeight(!0);s=o.outerWidth(!0);l.css({"padding-bottom":u,"padding-right":v}).hide();H.click(function(){d.next()});I.click(function(){d.prev()});T.click(function(){d.close()});R=H.add(I).add(Y).add(C);h.children().removeClass("hover");t.click(function(){a.overlayClose&&d.close()});b(B).bind("keydown."+m,function(b){var c=b.keyCode;q&&a.escKey&&c===27&&(b.preventDefault(),d.close());q&&a.arrowKey&&i[1]&&(c===37?(b.preventDefault(),I.click()):c===39&&(b.preventDefault(),H.click()))})};d.remove=function(){l.add(t).remove();b("."+z).removeData(p).removeClass(z)};d.position=function(b,c){function g(a){U[0].style.width=X[0].style.width=h[0].style.width=a.style.width;G[0].style.height=G[1].style.height=h[0].style.height=V[0].style.height=W[0].style.height=a.style.height}var i=0,j=0;f.unbind("resize."+m);l.hide();a.fixed&&!E?l.css({position:"fixed"}):(i=f.scrollTop(),j=f.scrollLeft(),l.css({position:"absolute"}));j+=a.right!==!1?Math.max(f.width()-a.w-s-v-k(a.right,"x"),0):a.left!==!1?k(a.left,"x"):Math.round(Math.max(f.width()-a.w-s-v,0)/2);i+=a.bottom!==!1?Math.max(B.documentElement.clientHeight-a.h-r-u-k(a.bottom,"y"),0):a.top!==!1?k(a.top,"y"):Math.round(Math.max(B.documentElement.clientHeight-a.h-r-u,0)/2);l.show();b=l.width()===a.w+s&&l.height()===a.h+r?0:b||0;x[0].style.width=x[0].style.height="9999px";l.dequeue().animate({width:a.w+s,height:a.h+r,top:i,left:j},{duration:b,complete:function(){g(this);D=!1;x[0].style.width=a.w+s+v+"px";x[0].style.height=a.h+r+u+"px";c&&c();setTimeout(function(){f.bind("resize."+m,d.position)},1)},step:function(){g(this)}})};d.resize=function(b){if(q){b=b||{};if(b.width)a.w=k(b.width,"x")-s-v;if(b.innerWidth)a.w=k(b.innerWidth,"x");o.css({width:a.w});if(b.height)a.h=k(b.height,"y")-r-u;if(b.innerHeight)a.h=k(b.innerHeight,"y");if(!b.innerHeight&&!b.height)b=o.wrapInner("<div style='overflow:auto'></div>").children(),a.h=b.height(),b.replaceWith(b.children());o.css({height:a.h});d.position(a.transition==="none"?0:a.speed)}};d.prep=function(e){if(q){var f,n=a.transition==="none"?0:a.speed;o.remove();o=c("LoadedContent").append(e);o.hide().appendTo(F.show()).css({width:function(){a.w=a.w||o.width();a.w=a.minWidth&&a.w<a.minWidth?k(a.minWidth,"x"):a.w;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||o.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}()}).prependTo(h);F.hide();b(g).css({"float":"none"});if(E)b("select").not(l.find("select")).filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one(J,function(){this.style.visibility="inherit"});f=function(){function c(){A&&l[0].style.removeAttribute("filter")}var d,e,f,k;e=i.length;var h,y;if(q){y=function(){clearTimeout(ea);G.hide();w(P,a.onComplete)};A&&g&&o.fadeIn(100);S.html(a.title).add(o).show();if(e>1){if(typeof a.current==="string"&&Y.html(a.current.replace("{current}",j+1).replace("{total}",e)).show(),H[a.loop||j<e-1?"show":"hide"]().html(a.next),I[a.loop||j?"show":"hide"]().html(a.previous),d=j?i[j-1]:i[e-1],f=j<e-1?i[j+1]:i[0],a.slideshow&&C.show(),a.preloading){k=b.data(f,p).href||f.href;e=b.data(d,p).href||d.href;k=b.isFunction(k)?k.call(f):k;e=b.isFunction(e)?e.call(d):e;if(N(k))b("<img/>")[0].src=k;if(N(e))b("<img/>")[0].src=e}}else R.hide();if(a.iframe){h=b("<iframe/>").addClass(m+"Iframe")[0];if(a.fastIframe)y();else b(h).one("load",y);h.name=m+ +new Date;h.src=a.href;if(!a.scrolling)h.scrolling="no";if(A)h.frameBorder=0,h.allowTransparency="true";b(h).appendTo(o).one(M,function(){h.src="//about:blank"})}else y();a.transition==="fade"?l.fadeTo(n,1,c):c()}};a.transition==="fade"?l.fadeTo(n,0,function(){d.position(0,f)}):d.position(n,f)}};d.load=function(e){var f,l,h=d.prep;D=!0;g=!1;n=i[j];e||$();w(M);w(Q,a.onLoad);a.h=a.height?k(a.height,"y")-r-u:a.innerHeight&&k(a.innerHeight,"y");a.w=a.width?k(a.width,"x")-s-v:a.innerWidth&&k(a.innerWidth,"x");a.mw=a.w;a.mh=a.h;if(a.maxWidth)a.mw=k(a.maxWidth,"x")-s-v,a.mw=a.w&&a.w<a.mw?a.w:a.mw;if(a.maxHeight)a.mh=k(a.maxHeight,"y")-r-u,a.mh=a.h&&a.h<a.mh?a.h:a.mh;f=a.href;ea=setTimeout(function(){G.show()},100);a.inline?(c().hide().insertBefore(b(f)[0]).one(M,function(){b(this).replaceWith(o.children())}),h(b(f))):a.iframe?h(" "):a.html?h(a.html):N(f)?(b(g=new Image).addClass(m+"Photo").error(function(){a.title=!1;h(c("Error").text("This image could not be loaded"))}).load(function(){var b;g.onload=null;a.scalePhotos&&(l=function(){g.height-=g.height*b;g.width-=g.width*b},a.mw&&g.width>a.mw&&(b=(g.width-a.mw)/g.width,l()),a.mh&&g.height>a.mh&&(b=(g.height-a.mh)/g.height,l()));if(a.h)g.style.marginTop=Math.max(a.h-g.height,0)/2+"px";if(i[1]&&(j<i.length-1||a.loop))g.style.cursor="pointer",g.onclick=function(){d.next()};if(A)g.style.msInterpolationMode="bicubic";setTimeout(function(){h(g)},1)}),setTimeout(function(){g.src=f},1)):f&&F.load(f,a.data,function(a,d,e){h(d==="error"?c("Error").text("Request unsuccessful: "+e.statusText):b(this).contents())})};d.next=function(){if(!D&&i[1]&&(j<i.length-1||a.loop))j=j<i.length-1?j+1:0,d.load()};d.prev=function(){if(!D&&i[1]&&(j||a.loop))j=j?j-1:i.length-1,d.load()};d.close=function(){q&&!K&&(K=!0,q=!1,w(J,a.onCleanup),f.unbind("."+m+" ."+L),t.fadeTo(200,0),l.stop().fadeTo(300,0,function(){l.add(t).css({opacity:1,cursor:"auto"}).hide();w(M);o.remove();setTimeout(function(){K=!1;w(ba,a.onClosed)},1)}))};d.element=function(){return b(n)};d.settings=da;Z=function(a){a.button!==0&&typeof a.button!=="undefined"||a.ctrlKey||a.shiftKey||a.altKey||(a.preventDefault(),aa(this))};b.fn.delegate?b(B).delegate("."+z,"click",Z):b("."+z).live("click",Z);b(d.init)})(jQuery,document,this);
