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