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