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