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