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