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