/* Colorbox 1.3.10 */
(function(c,ca){function g(b,d){b=b?' id="'+l+b+'"':"";d=d?' style="'+d+'"':"";return c("<div"+b+d+"/>")}function r(b,d){d=d==="x"?p.width():p.height();return typeof b==="string"?Math.round(/%/.test(b)?d/100*parseInt(b,10):parseInt(b,10)):b}function Q(b,d){b=c.isFunction(b)?b.call(d):b;return a.photo||/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(b)}function da(b){for(var d in b)if(c.isFunction(b[d])&&d.substring(0,2)!=="on")b[d]=b[d].call(o);b.rel=b.rel||o.rel||"nofollow";b.href=b.href||
c(o).attr("href");b.title=b.title||o.title;return b}function v(b,d){d&&d.call(o);c.event.trigger(b)}function la(){var b,d=l+"Slideshow_",e="click."+l,i,q;if(a.slideshow&&j[1]){i=function(){E.text(a.slideshowStop).unbind(e).bind(R,function(){if(h<j.length-1||a.loop)b=setTimeout(f.next,a.slideshowSpeed)}).bind(S,function(){clearTimeout(b)}).one(e,q);k.removeClass(d+"off").addClass(d+"on");b=setTimeout(f.next,a.slideshowSpeed)};q=function(){clearTimeout(b);E.text(a.slideshowStart).unbind(R+" "+S+" "+
e).one(e,i);k.removeClass(d+"on").addClass(d+"off")};E.bind(ea,function(){clearTimeout(b)});k.hasClass(d+"on")||a.slideshowAuto&&!k.hasClass(d+"off")?i():q()}}function fa(b){if(!N){o=b;a=da(c.extend({},c.data(o,s)));j=c(o);h=0;if(a.rel!=="nofollow"){j=c("."+H).filter(function(){return(c.data(this,s).rel||this.rel)===a.rel});h=j.index(o);if(h===-1){j=j.add(o);h=j.length-1}}if(!u){u=F=true;k.show();T=o;try{T.blur()}catch(d){}w.css({opacity:+a.opacity,cursor:a.overlayClose?"pointer":"auto"}).show();
a.w=r(a.initialWidth,"x");a.h=r(a.initialHeight,"y");f.position(0);U&&p.bind("resize."+O+" scroll."+O,function(){w.css({width:p.width(),height:p.height(),top:p.scrollTop(),left:p.scrollLeft()})}).trigger("scroll."+O);v(ga,a.onOpen);V.add(I).add(J).add(E).add(W).hide();X.html(a.close).show()}f.load(true)}}var ha={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,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},s="colorbox",l="cbox",ga=l+"_open",S=l+"_load",R=
l+"_complete",ia=l+"_cleanup",ea=l+"_closed",P=l+"_purge",ja=l+"_loaded",A=c.browser.msie&&!c.support.opacity,U=A&&c.browser.version<7,O=l+"_IE6",w,k,B,t,Y,Z,$,aa,j,p,m,K,L,W,V,E,J,I,X,C,D,x,y,o,T,h,a,u,F,N=false,f,H=l+"Element";f=c.fn[s]=c[s]=function(b,d){var e=this,i;if(!e[0]&&e.selector)return e;b=b||{};if(d)b.onComplete=d;if(!e[0]||e.selector===undefined){e=c("<a/>");b.open=true}e.each(function(){c.data(this,s,c.extend({},c.data(this,s)||ha,b));c(this).addClass(H)});i=b.open;if(c.isFunction(i))i=
i.call(e);i&&fa(e[0]);return e};f.init=function(){p=c(ca);k=g().attr({id:s,"class":A?l+"IE":""});w=g("Overlay",U?"position:absolute":"").hide();B=g("Wrapper");t=g("Content").append(m=g("LoadedContent","width:0; height:0; overflow:hidden"),L=g("LoadingOverlay").add(g("LoadingGraphic")),W=g("Title"),V=g("Current"),J=g("Next"),I=g("Previous"),E=g("Slideshow").bind(ga,la),X=g("Close"));B.append(g().append(g("TopLeft"),Y=g("TopCenter"),g("TopRight")),g(false,"clear:left").append(Z=g("MiddleLeft"),t,$=
g("MiddleRight")),g(false,"clear:left").append(g("BottomLeft"),aa=g("BottomCenter"),g("BottomRight"))).children().children().css({"float":"left"});K=g(false,"position:absolute; width:9999px; visibility:hidden; display:none");c("body").prepend(w,k.append(B,K));t.children().hover(function(){c(this).addClass("hover")},function(){c(this).removeClass("hover")}).addClass("hover");C=Y.height()+aa.height()+t.outerHeight(true)-t.height();D=Z.width()+$.width()+t.outerWidth(true)-t.width();x=m.outerHeight(true);
y=m.outerWidth(true);k.css({"padding-bottom":C,"padding-right":D}).hide();J.click(f.next);I.click(f.prev);X.click(f.close);t.children().removeClass("hover");c("."+H).live("click",function(b){if(!(b.button!==0&&typeof b.button!=="undefined"||b.ctrlKey||b.shiftKey||b.altKey)){b.preventDefault();fa(this)}});w.click(function(){a.overlayClose&&f.close()});c(document).bind("keydown",function(b){if(u&&a.escKey&&b.keyCode===27){b.preventDefault();f.close()}if(u&&a.arrowKey&&!F&&j[1])if(b.keyCode===37&&(h||
a.loop)){b.preventDefault();I.click()}else if(b.keyCode===39&&(h<j.length-1||a.loop)){b.preventDefault();J.click()}})};f.remove=function(){k.add(w).remove();c("."+H).die("click").removeData(s).removeClass(H)};f.position=function(b,d){function e(z){Y[0].style.width=aa[0].style.width=t[0].style.width=z.style.width;L[0].style.height=L[1].style.height=t[0].style.height=Z[0].style.height=$[0].style.height=z.style.height}var i,q=Math.max((ca.innerHeight||document.documentElement.clientHeight)-a.h-x-C,0)/
2+p.scrollTop(),n=Math.max(p.width()-a.w-y-D,0)/2+p.scrollLeft();i=k.width()===a.w+y&&k.height()===a.h+x?0:b;B[0].style.width=B[0].style.height="9999px";k.dequeue().animate({width:a.w+y,height:a.h+x,top:q,left:n},{duration:i,complete:function(){e(this);F=false;B[0].style.width=a.w+y+D+"px";B[0].style.height=a.h+x+C+"px";d&&d()},step:function(){e(this)}})};f.resize=function(b){if(u){b=b||{};if(b.width)a.w=r(b.width,"x")-y-D;if(b.innerWidth)a.w=r(b.innerWidth,"x");m.css({width:a.w});if(b.height)a.h=
r(b.height,"y")-x-C;if(b.innerHeight)a.h=r(b.innerHeight,"y");if(!b.innerHeight&&!b.height){b=m.wrapInner("<div style='overflow:auto'></div>").children();a.h=b.height();b.replaceWith(b.children())}m.css({height:a.h});f.position(a.transition==="none"?0:a.speed)}};f.prep=function(b){function d(q){var n,z,G,ba,M=j.length,ka=a.loop;f.position(q,function(){if(u){A&&e&&m.fadeIn(100);m.show();v(ja);W.show().html(a.title);if(M>1){V.html(a.current.replace(/\{current\}/,h+1).replace(/\{total\}/,M)).show();
J[ka||h<M-1?"show":"hide"]().html(a.next);I[ka||h?"show":"hide"]().html(a.previous);n=h?j[h-1]:j[M-1];G=h<M-1?j[h+1]:j[0];a.slideshow&&E.show();if(a.preloading){ba=c.data(G,s).href||G.href;z=c.data(n,s).href||n.href;if(Q(ba,G))c("<img/>")[0].src=ba;if(Q(z,n))c("<img/>")[0].src=z}}L.hide();if(a.transition==="fade")k.fadeTo(i,1,function(){if(A)k[0].style.filter=false});else if(A)k[0].style.filter=false;p.bind("resize."+l,function(){f.position(0)});v(R,a.onComplete)}})}if(u){var e,i=a.transition==="none"?
0:a.speed;p.unbind("resize."+l);m.remove();m=g("LoadedContent").html(b);m.hide().appendTo(K.show()).css({width:function(){a.w=a.w||m.width();a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}(),overflow:a.scrolling?"auto":"hidden"}).css({height:function(){a.h=a.h||m.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}()}).prependTo(t);K.hide();c("#"+l+"Photo").css({cssFloat:"none",marginLeft:"auto",marginRight:"auto"});U&&c("select").not(k.find("select")).filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one(ia,
function(){this.style.visibility="inherit"});a.transition==="fade"?k.fadeTo(i,0,function(){d(0)}):d(i)}};f.load=function(b){var d,e,i,q=f.prep;F=true;o=j[h];b||(a=da(c.extend({},c.data(o,s))));v(P);v(S,a.onLoad);a.h=a.height?r(a.height,"y")-x-C:a.innerHeight&&r(a.innerHeight,"y");a.w=a.width?r(a.width,"x")-y-D:a.innerWidth&&r(a.innerWidth,"x");a.mw=a.w;a.mh=a.h;if(a.maxWidth){a.mw=r(a.maxWidth,"x")-y-D;a.mw=a.w&&a.w<a.mw?a.w:a.mw}if(a.maxHeight){a.mh=r(a.maxHeight,"y")-x-C;a.mh=a.h&&a.h<a.mh?a.h:
a.mh}d=a.href;L.show();if(a.inline){g().hide().insertBefore(c(d)[0]).one(P,function(){c(this).replaceWith(m.children())});q(c(d))}else if(a.iframe){k.one(ja,function(){var n=c("<iframe name='"+(new Date).getTime()+"' frameborder=0"+(a.scrolling?"":" scrolling='no'")+(A?" allowtransparency='true'":"")+" style='width:100%; height:100%; border:0; display:block;'/>");n[0].src=a.href;n.appendTo(m).one(P,function(){n[0].src="about:blank"})});q(" ")}else if(a.html)q(a.html);else if(Q(d,o)){e=new Image;e.onload=
function(){var n;e.onload=null;e.id=l+"Photo";c(e).css({border:"none",display:"block",cssFloat:"left"});if(a.scalePhotos){i=function(){e.height-=e.height*n;e.width-=e.width*n};if(a.mw&&e.width>a.mw){n=(e.width-a.mw)/e.width;i()}if(a.mh&&e.height>a.mh){n=(e.height-a.mh)/e.height;i()}}if(a.h)e.style.marginTop=Math.max(a.h-e.height,0)/2+"px";if(j[1]&&(h<j.length-1||a.loop))c(e).css({cursor:"pointer"}).click(f.next);if(A)e.style.msInterpolationMode="bicubic";setTimeout(function(){q(e)},1)};setTimeout(function(){e.src=
d},1)}else g().appendTo(K).load(d,function(n,z,G){q(z==="error"?"Request unsuccessful: "+G.statusText:this)})};f.next=function(){if(!F){h=h<j.length-1?h+1:0;f.load()}};f.prev=function(){if(!F){h=h?h-1:j.length-1;f.load()}};f.close=function(){if(u&&!N){N=true;u=false;v(ia,a.onCleanup);p.unbind("."+l+" ."+O);w.fadeTo("fast",0);k.stop().fadeTo("fast",0,function(){v(P);m.remove();k.add(w).css({opacity:1,cursor:"auto"}).hide();try{T.focus()}catch(b){}setTimeout(function(){N=false;v(ea,a.onClosed)},1)})}};
f.element=function(){return c(o)};f.settings=ha;c(f.init)})(jQuery,this);
/**!
 * jQuery Colorbox bootstrap
 * Initializes flexible-sized, iframed overlays on matches to 'a.overlay[href]'
 * Selector is vague for flexibility--at the cost of speed--
 * Do not include this boostrap on pages that will not use it.
 *
 * @author Dan Drinkard <drinkarddp@washpost.com>
 * @requires jquery 1.3.2+
 * @requires plugin.jquery.colorbox-1.3.10+.js
 * @see <http://colorpowered.com/colorbox/>
 */
 (function($, window, undefined){
     $.colorbox.defaultSettings = {
          iframe: true,
          speed: 500,
          opacity: 0.66,
          initialWidth: 160,
          initialHeight: 80,
          width: 160,
          height: 80,
          maxWidth: 990,
          maxHeight: 650,
          onLoad: function(){
              $('#cboxClose').hide();
              // hack for IE/quirks
              if($.browser.msie){
                  $('#cboxOverlay').css({
                      position:'absolute',
                      height:$(document).height()
                  });
              }
          },
          onComplete: function(){
              var frame = $('#colorbox').find('iframe').eq(0),
              width = $.colorbox.defaultSettings.maxWidth,
              height = $.colorbox.defaultSettings.maxHeight;
              frame.fadeTo(0, 0);
              $.colorbox.resizeTimeout = window.setTimeout(function(){
                  $.colorbox.resize({innerWidth:width, innerHeight:height+20});
                  setTimeout(function(){
                      frame.fadeTo(1000, 1);
                      $('#cboxClose').fadeIn("fast");
                  }, 500);
              }, 5000);
              frame.load(function(){
                  var doc = frame.contents();
                  window.clearTimeout($.colorbox.resizeTimeout);
                  try{
                      // we grab 1st child div of body (hopefully a wrapper) for firefox to get proper width...
                      // and reset values on null b/c webkit swallows permission denied exception
                      width = doc.find('body').children('div').eq(0).width() || width;
                      if($.browser.msie){
                          height = (doc.height() || height) + 20;
                      }else{
                          height = (doc.find('body').height() || height) + 5;
                      }
                  }catch(e){
                      // access denied
                      window.console && console.log && console.log(e);
                  }
                  $.colorbox.resize({innerWidth:width, innerHeight:height});
                  setTimeout(function(){
                      frame.fadeTo(1000, 1);
                      $('#cboxClose').fadeIn("fast");
                  }, 500);
              });
          },
          onClosed: function(){
              // var hash = window.location.hash;
              // if(hash){
              //     window.location.href = window.location.href.replace(hash, '');
              //     return;
              // }
              // window.location.reload(true);
          }
      }
      
      // dom ready bindings
     $(function(){
         var hash = window.location.hash;
         window.console && console.log && console.log(hash);
         if(hash && $(hash).is('a.cbox[href]')){
             window.console && console.log && console.log('hash is valid');
             $.colorbox($.extend({}, $.colorbox.defaultSettings, {href: $(hash).attr('href'), open: true}))
         }else{
             window.console && console.log && console.log('hash is not a valid cbox ref');
         }
         $('a.cbox[href]').colorbox($.colorbox.defaultSettings);
     });
 })(jQuery, window);
