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