(function(Ak){function AZ(B,C){C=C==="x"?Ad.width():Ad.height();return typeof B==="string"?Math.round(B.match(/%/)?C/100*parseInt(B,10):parseInt(B,10)):B}function AF(B){B=Ak.isFunction(B)?B.call(Ah):B;return Al.photo||B.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i)}function G(){for(var B in Al){if(Ak.isFunction(Al[B])&&B.substring(0,2)!=="on"){Al[B]=Al[B].call(Ah)}}Al.rel=Al.rel||Ah.rel;Al.href=Al.href||Ah.href;Al.title=Al.title||Ah.title}function A(B){Ah=B;Al=Ak.extend({},Ak(Ah).data(Aa));G();if(Al.rel&&Al.rel!=="nofollow"){Ai=Ak(".cboxElement").filter(function(){return(Ak(this).data(Aa).rel||this.rel)===Al.rel});Ag=Ai.index(Ah);if(Ag<0){Ai=Ai.add(Ah);Ag=Ai.length-1}}else{Ai=Ak(Ah);Ag=0}if(!AO){AN=AO=Ac;AE=Ah;AE.blur();Ak(document).bind("keydown.cbox_close",function(C){if(C.keyCode===27){C.preventDefault();Aj.close()}}).bind("keydown.cbox_arrows",function(C){if(Ai.length>1){if(C.keyCode===37){C.preventDefault();AM.click()}else{if(C.keyCode===39){C.preventDefault();AL.click()}}}});Al.overlayClose&&AY.css({cursor:"pointer"}).one("click",Aj.close);Ak.event.trigger(AP);Al.onOpen&&Al.onOpen.call(Ah);AY.css({opacity:Al.opacity}).show();Al.w=AZ(Al.initialWidth,"x");Al.h=AZ(Al.initialHeight,"y");Aj.position(0);AD&&Ad.bind("resize.cboxie6 scroll.cboxie6",function(){AY.css({width:Ad.width(),height:Ad.height(),top:Ad.scrollTop(),left:Ad.scrollLeft()})}).trigger("scroll.cboxie6")}AC.add(AM).add(AL).add(AX).add(AB).hide();AA.html(Al.close).show();Aj.slideshow();Aj.load()}var Aa="colorbox",AK="hover",Ac=true,Aj,AT=Ak.browser.msie&&!Ak.support.opacity,AD=AT&&Ak.browser.version<7,AP="cbox_open",AJ="cbox_load",o="cbox_complete",h="resize.cbox_resize",AY,Af,AW,Ab,f,d,b,L,Ai,Ad,Ae,AI,AH,AG,AB,AC,AX,AL,AM,AA,AS,AR,AV,AU,Ah,AE,Ag,Al,AO,AN,AQ={transition:"elastic",speed:350,width:false,height:false,innerWidth:false,innerHeight:false,initialWidth:"400",initialHeight:"400",maxWidth:false,maxHeight:false,scalePhotos:Ac,scrolling:Ac,inline:false,html:false,iframe:false,photo:false,href:false,title:false,rel:false,opacity:0.9,preloading:Ac,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:false,overlayClose:Ac,slideshow:false,slideshowAuto:Ac,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:false,onLoad:false,onComplete:false,onCleanup:false,onClosed:false};Aj=Ak.fn.colorbox=function(B,D){var C=this;if(!C.length){if(C.selector===""){C=Ak("<a/>");B.open=Ac}else{return this}}C.each(function(){var E=Ak.extend({},Ak(this).data(Aa)?Ak(this).data(Aa):AQ,B);Ak(this).data(Aa,E).addClass("cboxElement");if(D){Ak(this).data(Aa).onComplete=D}});B&&B.open&&A(C);return this};Aj.init=function(){function B(C){return Ak('<div id="cbox'+C+'"/>')}Ad=Ak(window);Af=Ak('<div id="colorbox"/>');AY=B("Overlay").hide();AW=B("Wrapper");Ab=B("Content").append(Ae=B("LoadedContent").css({width:0,height:0}),AH=B("LoadingOverlay"),AG=B("LoadingGraphic"),AB=B("Title"),AC=B("Current"),AX=B("Slideshow"),AL=B("Next"),AM=B("Previous"),AA=B("Close"));AW.append(Ak("<div/>").append(B("TopLeft"),f=B("TopCenter"),B("TopRight")),Ak("<div/>").append(d=B("MiddleLeft"),Ab,b=B("MiddleRight")),Ak("<div/>").append(B("BottomLeft"),L=B("BottomCenter"),B("BottomRight"))).children().children().css({"float":"left"});AI=Ak("<div style='position:absolute; top:0; left:0; width:9999px; height:0;'/>");Ak("body").prepend(AY,Af.append(AW,AI));if(AT){Af.addClass("cboxIE");AD&&AY.css("position","absolute")}Ab.children().bind("mouseover mouseout",function(){Ak(this).toggleClass(AK)}).addClass(AK);AS=f.height()+L.height()+Ab.outerHeight(Ac)-Ab.height();AR=d.width()+b.width()+Ab.outerWidth(Ac)-Ab.width();AV=Ae.outerHeight(Ac);AU=Ae.outerWidth(Ac);Af.css({"padding-bottom":AS,"padding-right":AR}).hide();AL.click(Aj.next);AM.click(Aj.prev);AA.click(Aj.close);Ab.children().removeClass(AK);Ak(".cboxElement").live("click",function(C){if(C.button!==0&&typeof C.button!=="undefined"){return Ac}else{A(this);return false}})};Aj.position=function(B,F){function C(H){f[0].style.width=L[0].style.width=Ab[0].style.width=H.style.width;AG[0].style.height=AH[0].style.height=Ab[0].style.height=d[0].style.height=b[0].style.height=H.style.height}var D=Ad.height();D=Math.max(D-Al.h-AV-AS,0)/2+Ad.scrollTop();var E=Math.max(document.documentElement.clientWidth-Al.w-AU-AR,0)/2+Ad.scrollLeft();B=Af.width()===Al.w+AU&&Af.height()===Al.h+AV?0:B;AW[0].style.width=AW[0].style.height="9999px";Af.dequeue().animate({width:Al.w+AU,height:Al.h+AV,top:D,left:E},{duration:B,complete:function(){C(this);AN=false;AW[0].style.width=Al.w+AU+AR+"px";AW[0].style.height=Al.h+AV+AS+"px";F&&F()},step:function(){C(this)}})};Aj.resize=function(D){function I(){Al.w=Al.w||Ae.width();Al.w=Al.mw&&Al.mw<Al.w?Al.mw:Al.w;return Al.w}function E(){Al.h=Al.h||Ae.height();Al.h=Al.mh&&Al.mh<Al.h?Al.mh:Al.h;return Al.h}function F(J){Aj.position(J,function(){if(AO){if(AT){C&&Ae.fadeIn(100);Af[0].style.removeAttribute("filter")}if(Al.iframe){Ae.append("<iframe id='cboxIframe'"+(Al.scrolling?" ":"scrolling='no'")+" name='iframe_"+(new Date).getTime()+"' frameborder=0 src='"+Al.href+"' "+(AT?"allowtransparency='true'":"")+" />")}Ae.show();AB.show().html(Al.title);if(Ai.length>1){AC.html(Al.current.replace(/\{current\}/,Ag+1).replace(/\{total\}/,Ai.length)).show();AL.html(Al.next).show();AM.html(Al.previous).show();Al.slideshow&&AX.show()}AH.hide();AG.hide();Ak.event.trigger(o);Al.onComplete&&Al.onComplete.call(Ah);Al.transition==="fade"&&Af.fadeTo(B,1,function(){AT&&Af[0].style.removeAttribute("filter")});Ad.bind(h,function(){Aj.position(0)})}})}if(AO){var H,C,B=Al.transition==="none"?0:Al.speed;Ad.unbind(h);if(D){Ae.remove();Ae=Ak('<div id="cboxLoadedContent"/>').html(D);Ae.hide().appendTo(AI).css({width:I(),overflow:Al.scrolling?"auto":"hidden"}).css({height:E()}).prependTo(Ab);Ak("#cboxPhoto").css({cssFloat:"none"});AD&&Ak("select:not(#colorbox select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("cbox_cleanup",function(){this.style.visibility="inherit"});Al.transition==="fade"&&Af.fadeTo(B,0,function(){F(0)})||F(B);if(Al.preloading&&Ai.length>1){D=Ag>0?Ai[Ag-1]:Ai[Ai.length-1];H=Ag<Ai.length-1?Ai[Ag+1]:Ai[0];H=Ak(H).data(Aa).href||H.href;D=Ak(D).data(Aa).href||D.href;AF(H)&&Ak("<img />").attr("src",H);AF(D)&&Ak("<img />").attr("src",D)}}else{setTimeout(function(){var J=Ae.wrapInner("<div style='overflow:auto'></div>").children();Al.h=J.height();Ae.css({height:Al.h});J.replaceWith(J.children());Aj.position(B)},1)}}};Aj.load=function(){var B,E,C,D=Aj.resize;AN=Ac;Ah=Ai[Ag];Al=Ak.extend({},Ak(Ah).data(Aa));G();Ak.event.trigger(AJ);Al.onLoad&&Al.onLoad.call(Ah);Al.h=Al.height?AZ(Al.height,"y")-AV-AS:Al.innerHeight?AZ(Al.innerHeight,"y"):false;Al.w=Al.width?AZ(Al.width,"x")-AU-AR:Al.innerWidth?AZ(Al.innerWidth,"x"):false;Al.mw=Al.w;Al.mh=Al.h;if(Al.maxWidth){Al.mw=AZ(Al.maxWidth,"x")-AU-AR;Al.mw=Al.w&&Al.w<Al.mw?Al.w:Al.mw}if(Al.maxHeight){Al.mh=AZ(Al.maxHeight,"y")-AV-AS;Al.mh=Al.h&&Al.h<Al.mh?Al.h:Al.mh}B=Al.href;AH.show();AG.show();if(Al.inline){Ak('<div id="cboxInlineTemp" />').hide().insertBefore(Ak(B)[0]).bind(AJ+" cbox_cleanup",function(){Ak(this).replaceWith(Ae.children())});D(Ak(B))}else{if(Al.iframe){D(" ")}else{if(Al.html){D(Al.html)}else{if(AF(B)){E=new Image;E.onload=function(){var F;E.onload=null;E.id="cboxPhoto";Ak(E).css({margin:"auto",border:"none",display:"block",cssFloat:"left"});if(Al.scalePhotos){C=function(){E.height-=E.height*F;E.width-=E.width*F};if(Al.mw&&E.width>Al.mw){F=(E.width-Al.mw)/E.width;C()}if(Al.mh&&E.height>Al.mh){F=(E.height-Al.mh)/E.height;C()}}if(Al.h){E.style.marginTop=Math.max(Al.h-E.height,0)/2+"px"}D(E);Ai.length>1&&Ak(E).css({cursor:"pointer"}).click(Aj.next);if(AT){E.style.msInterpolationMode="bicubic"}};E.src=B}else{Ak("<div />").appendTo(AI).load(B,function(H,F){F==="success"?D(this):D(Ak("<p>Request unsuccessful.</p>"))})}}}}};Aj.next=function(){if(!AN){Ag=Ag<Ai.length-1?Ag+1:0;Aj.load()}};Aj.prev=function(){if(!AN){Ag=Ag>0?Ag-1:Ai.length-1;Aj.load()}};Aj.slideshow=function(){function B(){AX.text(Al.slideshowStop).bind(o,function(){C=setTimeout(Aj.next,Al.slideshowSpeed)}).bind(AJ,function(){clearTimeout(C)}).one("click",function(){E();Ak(this).removeClass(AK)});Af.removeClass(D+"off").addClass(D+"on")}var E,C,D="cboxSlideshow_";AX.bind("cbox_closed",function(){AX.unbind();clearTimeout(C);Af.removeClass(D+"off "+D+"on")});E=function(){clearTimeout(C);AX.text(Al.slideshowStart).unbind(o+" "+AJ).one("click",function(){B();C=setTimeout(Aj.next,Al.slideshowSpeed);Ak(this).removeClass(AK)});Af.removeClass(D+"on").addClass(D+"off")};if(Al.slideshow&&Ai.length>1){Al.slideshowAuto?B():E()}};Aj.close=function(){Ak.event.trigger("cbox_cleanup");Al.onCleanup&&Al.onCleanup.call(Ah);AO=false;Ak(document).unbind("keydown.cbox_close keydown.cbox_arrows");Ad.unbind(h+" resize.cboxie6 scroll.cboxie6");AY.css({cursor:"auto"}).fadeOut("fast");Af.stop(Ac,false).fadeOut("fast",function(){Ak("#colorbox iframe").attr("src","about:blank");Ae.remove();Af.css({opacity:1});try{AE.focus()}catch(B){}Ak.event.trigger("cbox_closed");Al.onClosed&&Al.onClosed.call(Ah)})};Aj.element=function(){return Ak(Ah)};Aj.settings=AQ;Ak(Aj.init)})(jQuery);
