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

