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