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