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