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