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