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