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