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