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