(function(c,ka){function f(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 T(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(U,function(){if(h<j.length-1||a.loop)b=setTimeout(g.next,a.slideshowSpeed)}).bind(V,function(){clearTimeout(b)}).one(d+" "+P,q);m.removeClass(e+"off").addClass(e+"on");b=setTimeout(g.next,a.slideshowSpeed)};q=function(){clearTimeout(b);H.text(a.slideshowStart).unbind([U,V,P,d].join(" ")).one(d,i);m.removeClass(e+
"on").addClass(e+"off")};a.slideshowAuto?i():q()}}function da(b){if(!Q){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");g.position(0);W&&p.bind("resize."+R+" scroll."+R,function(){x.css({width:p.width(),height:p.height(),top:p.scrollTop(),left:p.scrollLeft()})}).trigger("scroll."+R);w(fa,a.onOpen);X.add(J).add(K).add(H).add(L).hide();Y.html(a.close).show()}g.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",V=k+"_load",U=k+"_complete",P=k+"_cleanup",ea=
k+"_closed",S=k+"_purge",ha=k+"_loaded",F=c.browser.msie&&!c.support.opacity,W=F&&c.browser.version<7,R=k+"_IE6",x,m,A,u,Z,$,aa,ba,j,p,n,M,N,L,X,H,K,J,Y,B,C,y,z,o,h,a,v,E,Q=false,g,I=k+"Element";g=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};
g.init=function(){p=c(ka);m=f().attr({id:t,"class":F?k+"IE":""});x=f("Overlay",W?"position:absolute":"").hide();A=f("Wrapper");L=f("Title");L.append($leftTitle=f("LeftTitle"),f("CenterTitle"),$rightTitle=f("RightTitle"));u=f("Content").append(n=f("LoadedContent","width:0; height:0; overflow:hidden"),N=f("LoadingOverlay").add(f("LoadingGraphic")),L,X=f("Current"),K=f("Next"),J=f("Previous"),H=f("Slideshow").bind(fa,la),Y=f("Close"));A.append(f().append(f("TopLeft"),Z=f("TopCenter"),f("TopRight")),
f(false,"clear:left").append($=f("MiddleLeft"),u,aa=f("MiddleRight")),f(false,"clear:left").append(f("BottomLeft"),ba=f("BottomCenter"),f("BottomRight"))).children().children().css({"float":"left"});M=f(false,"position:absolute; width:9999px; visibility:hidden; display:none");c("body").prepend(x,m.append(A,M));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(g.next);J.click(g.prev);Y.click(g.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&&g.close()});c(document).bind("keydown",function(b){if(v&&a.escKey&&b.keyCode===27){b.preventDefault();g.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()}})};g.remove=function(){m.add(x).remove();c("."+I).die("click").removeData(t).removeClass(I)};g.position=function(b,e){function d(s){Z[0].style.width=ba[0].style.width=u[0].style.width=s.style.width;N[0].style.height=N[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)}})};g.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});g.position(a.transition==="none"?0:a.speed)}};g.prep=function(b){function e(q){var l,s,G,D,O=j.length,ia=a.loop;g.position(q,function(){function ja(){F&&m[0].style.removeAttribute("filter")}if(v){F&&d&&n.fadeIn(100);n.show();w(ha);L.show().html(a.title);if(O>1){typeof a.current==="string"&&
X.html(a.current.replace(/\{current\}/,h+1).replace(/\{total\}/,O)).show();K[ia||h<O-1?"show":"hide"]().html(a.next);J[ia||h?"show":"hide"]().html(a.previous);l=h?j[h-1]:j[O-1];G=h<O-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(T(D))c("<img/>")[0].src=D;if(T(s))c("<img/>")[0].src=s}}N.hide();a.transition==="fade"?m.fadeTo(i,1,function(){ja()}):ja();p.bind("resize."+k,function(){g.position(0)});
w(U,a.onComplete)}})}if(v){var d,i=a.transition==="none"?0:a.speed;p.unbind("resize."+k);n.remove();n=f("LoadedContent").html(b);n.hide().appendTo(M.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);M.hide();c("#"+k+"Photo").css({cssFloat:"none",marginLeft:"auto",marginRight:"auto"});W&&c("select").not(m.find("select")).filter(function(){return this.style.visibility!==
"hidden"}).css({visibility:"hidden"}).one(P,function(){this.style.visibility="inherit"});a.transition==="fade"?m.fadeTo(i,0,function(){e(0)}):e(i)}};g.load=function(b){var e,d,i,q=g.prep;E=true;o=j[h];b||(a=ca(c.extend({},c.data(o,t))));w(S);w(V,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;N.show();if(a.inline){f().hide().insertBefore(c(e)[0]).one(S,function(){c(this).replaceWith(n.children())});q(c(e))}else if(a.iframe){m.one(ha,function(){var l=c("<iframe 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(S,function(){l.src="//about:blank"})});q(" ")}else if(a.html)q(a.html);else if(T(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(g.next);if(F)d.style.msInterpolationMode="bicubic";setTimeout(function(){q(d)},
1)};setTimeout(function(){d.src=e},1)}else e&&M.load(e,function(l,s,G){q(s==="error"?"Request unsuccessful: "+G.statusText:c(this).children())})};g.next=function(){if(!E){h=h<j.length-1?h+1:0;g.load()}};g.prev=function(){if(!E){h=h?h-1:j.length-1;g.load()}};g.close=function(){if(v&&!Q){Q=true;v=false;w(P,a.onCleanup);p.unbind("."+k+" ."+R);x.fadeTo("fast",0);m.stop().fadeTo("fast",0,function(){w(S);n.remove();m.add(x).css({opacity:1,cursor:"auto"}).hide();setTimeout(function(){Q=false;w(ea,a.onClosed)},
1)})}};g.element=function(){return c(o)};g.settings=ga;c(g.init)})(jQuery,this);
