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