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