(function(b){var r='colorbox',z='hover',m=true,g=false,f,A=!b.support.opacity,P=A&&!window.XMLHttpRequest,bg='cbox_open',I='cbox_load',Q='cbox_complete',R='cbox_cleanup',bb='cbox_closed',S='resize.cbox_resize',u,k,v,q,T,U,V,W,i,o,n,J,K,L,M,X,w,D,E,Y,B,C,x,y,j,Z,l,a,F,G,bc={transition:"elastic",speed:350,width:g,height:g,innerWidth:g,innerHeight:g,initialWidth:"400",initialHeight:"400",maxWidth:g,maxHeight:g,scalePhotos:m,scrolling:m,inline:g,html:g,iframe:g,photo:g,href:g,title:g,rel:g,opacity:0.9,preloading:m,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:g,overlayClose:m,slideshow:g,slideshowAuto:m,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:g,onLoad:g,onComplete:g,onCleanup:g,onClosed:g};function t(c,d){d=d==='x'?o.width():o.height();return(typeof c==='string')?Math.round((c.match(/%/)?(d/100)*parseInt(c,10):parseInt(c,10))):c}function ba(c){c=b.isFunction(c)?c.call(j):c;return a.photo||c.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i)}function bd(){for(var c in a){if(b.isFunction(a[c])&&c.substring(0,2)!=='on'){a[c]=a[c].call(j)}}}function be(d){j=d;a=b(j).data(r);bd();var h=a.rel||j.rel;if(h&&h!=='nofollow'){i=b('.cboxElement').filter(function(){var c=b(this).data(r).rel||this.rel;return(c===h)});l=i.index(j);if(l<0){i=i.add(j);l=i.length-1}}else{i=b(j);l=0}if(!F){F=m;G=m;Z=j;Z.blur();b().bind("keydown.cbox_close",function(c){if(c.keyCode===27){c.preventDefault();f.close()}}).bind("keydown.cbox_arrows",function(c){if(i.length>1){if(c.keyCode===37){c.preventDefault();E.click()}else if(c.keyCode===39){c.preventDefault();D.click()}}});if(a.overlayClose){u.css({"cursor":"pointer"}).one('click',f.close)}b.event.trigger(bg);if(a.onOpen){a.onOpen.call(j)}u.css({"opacity":a.opacity}).show();a.w=t(a.initialWidth,'x');a.h=t(a.initialHeight,'y');f.position(0);if(P){o.bind('resize.cboxie6 scroll.cboxie6',function(){u.css({width:o.width(),height:o.height(),top:o.scrollTop(),left:o.scrollLeft()})}).trigger("scroll.cboxie6")}}X.add(E).add(D).add(w).add(M).hide();Y.html(a.close).show();f.slideshow();f.load()}f=b.fn.colorbox=function(d,h){var e=this;if(!e.length){if(e.selector===''){e=b(e);d.open=m}else{return this}}e.each(function(){var c=b.extend({},b(this).data(r)?b(this).data(r):bc,d);b(this).data(r,c).addClass("cboxElement");if(h){b(this).data(r).onComplete=h}});if(d&&d.open){be(e)}return this};f.init=function(){function d(c){return b('<div id="cbox'+c+'"/>')}o=b(window);k=b('<div id="colorbox"/>');u=d("Overlay").hide();v=d("Wrapper");q=d("Content").append(n=d("LoadedContent").css({width:0,height:0}),K=d("LoadingOverlay"),L=d("LoadingGraphic"),M=d("Title"),X=d("Current"),w=d("Slideshow"),D=d("Next"),E=d("Previous"),Y=d("Close"));v.append(b('<div/>').append(d("TopLeft"),T=d("TopCenter"),d("TopRight")),b('<div/>').append(U=d("MiddleLeft"),q,V=d("MiddleRight")),b('<div/>').append(d("BottomLeft"),W=d("BottomCenter"),d("BottomRight"))).children().children().css({'float':'left'});J=b("<div style='position:absolute; top:0; left:0; width:9999px; height:0;'/>");b('body').prepend(u,k.append(v,J));if(A){k.addClass('cboxIE');if(P){u.css('position','absolute')}}q.children().addClass(z).mouseover(function(){b(this).addClass(z)}).mouseout(function(){b(this).removeClass(z)});B=T.height()+W.height()+q.outerHeight(m)-q.height();C=U.width()+V.width()+q.outerWidth(m)-q.width();x=n.outerHeight(m);y=n.outerWidth(m);k.css({"padding-bottom":B,"padding-right":C}).hide();D.click(f.next);E.click(f.prev);Y.click(f.close);q.children().removeClass(z);b('.cboxElement').live('click',function(c){if(c.button!==0&&typeof c.button!=='undefined'){return m}else{be(this);return g}})};f.position=function(d,h){var e,s=o.height(),p=Math.max(s-a.h-x-B,0)/2+o.scrollTop(),H=Math.max(document.documentElement.clientWidth-a.w-y-C,0)/2+o.scrollLeft();e=(k.width()===a.w+y&&k.height()===a.h+x)?0:d;v[0].style.width=v[0].style.height="9999px";function N(c){T[0].style.width=W[0].style.width=q[0].style.width=c.style.width;L[0].style.height=K[0].style.height=q[0].style.height=U[0].style.height=V[0].style.height=c.style.height}k.dequeue().animate({width:a.w+y,height:a.h+x,top:p,left:H},{duration:e,complete:function(){N(this);G=g;v[0].style.width=(a.w+y+C)+"px";v[0].style.height=(a.h+x+B)+"px";if(h){h()}},step:function(){N(this)}})};f.resize=function(d){if(!F){return}var h,e,s,p,H,N,bh,O=a.transition==="none"?0:a.speed;o.unbind(S);if(!d){bh=setTimeout(function(){var c=n.wrapInner("<div style='overflow:auto'></div>").children();a.h=c.height();n.css({height:a.h});c.replaceWith(c.children());f.position(O)},1);return}n.remove();n=b('<div id="cboxLoadedContent"/>').html(d);function bi(){a.w=a.w||n.width();a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}function bj(){a.h=a.h||n.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}n.hide().appendTo(J).css({width:bi(),overflow:a.scrolling?'auto':'hidden'}).css({height:bj()}).prependTo(q);b('#cboxPhoto').css({cssFloat:'none'});if(P){b('select:not(#colorbox select)').filter(function(){return this.style.visibility!=='hidden'}).css({'visibility':'hidden'}).one(R,function(){this.style.visibility='inherit'})}function bf(c){f.position(c,function(){if(!F){return}if(A){if(N){n.fadeIn(100)}k[0].style.removeAttribute("filter")}if(a.iframe){n.append("<iframe id='cboxIframe'"+(a.scrolling?" ":"scrolling='no'")+" name='iframe_"+new Date().getTime()+"' frameborder=0 src='"+(a.href||j.href)+"' "+(A?"allowtransparency='true'":'')+" />")}n.show();M.html(a.title||j.title);M.show();if(i.length>1){X.html(a.current.replace(/\{current\}/,l+1).replace(/\{total\}/,i.length)).show();D.html(a.next).show();E.html(a.previous).show();if(a.slideshow){w.show()}}K.hide();L.hide();b.event.trigger(Q);if(a.onComplete){a.onComplete.call(j)}if(a.transition==='fade'){k.fadeTo(O,1,function(){if(A){k[0].style.removeAttribute("filter")}})}o.bind(S,function(){f.position(0)})})}if((a.transition==='fade'&&k.fadeTo(O,0,function(){bf(0)}))||bf(O)){}if(a.preloading&&i.length>1){e=l>0?i[l-1]:i[i.length-1];p=l<i.length-1?i[l+1]:i[0];H=b(p).data(r).href||p.href;s=b(e).data(r).href||e.href;if(ba(H)){b('<img />').attr('src',H)}if(ba(s)){b('<img />').attr('src',s)}}};f.load=function(){var h,e,s,p=f.resize;G=m;j=i[l];a=b(j).data(r);bd();b.event.trigger(I);if(a.onLoad){a.onLoad.call(j)}a.h=a.height?t(a.height,'y')-x-B:a.innerHeight?t(a.innerHeight,'y'):g;a.w=a.width?t(a.width,'x')-y-C:a.innerWidth?t(a.innerWidth,'x'):g;a.mw=a.w;a.mh=a.h;if(a.maxWidth){a.mw=t(a.maxWidth,'x')-y-C;a.mw=a.w&&a.w<a.mw?a.w:a.mw}if(a.maxHeight){a.mh=t(a.maxHeight,'y')-x-B;a.mh=a.h&&a.h<a.mh?a.h:a.mh}h=a.href||b(j).attr("href");K.show();L.show();if(a.inline){b('<div id="cboxInlineTemp" />').hide().insertBefore(b(h)[0]).bind(I+' '+R,function(){b(this).replaceWith(n.children())});p(b(h))}else if(a.iframe){p(" ")}else if(a.html){p(a.html)}else if(ba(h)){e=new Image();e.onload=function(){var c;e.onload=null;e.id='cboxPhoto';b(e).css({margin:'auto',border:'none',display:'block',cssFloat:'left'});if(a.scalePhotos){s=function(){e.height-=e.height*c;e.width-=e.width*c};if(a.mw&&e.width>a.mw){c=(e.width-a.mw)/e.width;s()}if(a.mh&&e.height>a.mh){c=(e.height-a.mh)/e.height;s()}}if(a.h){e.style.marginTop=Math.max(a.h-e.height,0)/2+'px'}p(e);if(i.length>1){b(e).css({cursor:'pointer'}).click(f.next)}if(A){e.style.msInterpolationMode='bicubic'}};e.src=h}else{b('<div />').appendTo(J).load(h,function(c,d){if(d==="success"){p(this)}else{p(b("<p>Request unsuccessful.</p>"))}})}};f.next=function(){if(!G){l=l<i.length-1?l+1:0;f.load()}};f.prev=function(){if(!G){l=l>0?l-1:i.length-1;f.load()}};f.slideshow=function(){var c,d,h='cboxSlideshow_';w.bind(bb,function(){w.unbind();clearTimeout(d);k.removeClass(h+"off "+h+"on")});function e(){w.text(a.slideshowStop).bind(Q,function(){d=setTimeout(f.next,a.slideshowSpeed)}).bind(I,function(){clearTimeout(d)}).one("click",function(){c();b(this).removeClass(z)});k.removeClass(h+"off").addClass(h+"on")}c=function(){clearTimeout(d);w.text(a.slideshowStart).unbind(Q+' '+I).one("click",function(){e();d=setTimeout(f.next,a.slideshowSpeed);b(this).removeClass(z)});k.removeClass(h+"on").addClass(h+"off")};if(a.slideshow&&i.length>1){if(a.slideshowAuto){e()}else{c()}}};f.close=function(){b.event.trigger(R);if(a.onCleanup){a.onCleanup.call(j)}F=g;b().unbind("keydown.cbox_close keydown.cbox_arrows");o.unbind(S+' resize.cboxie6 scroll.cboxie6');u.css({cursor:'auto'}).fadeOut('fast');k.stop(m,g).fadeOut('fast',function(){n.remove();k.css({'opacity':1});try{Z.focus()}catch(er){}b.event.trigger(bb);if(a.onClosed){a.onClosed.call(j)}})};f.element=function(){return b(j)};f.settings=bc;b(f.init)}(jQuery));
