(function(h){var a,d=this,A=d.document,l=h(A),w=h(d),x=1.26,e=true,s=30000,t=false,p=navigator.userAgent.toLowerCase(),n=d.location.hash.replace(/#\//,""),m=(function(){var B=3,D=A.createElement("div"),C=D.getElementsByTagName("i");do{D.innerHTML="<!--[if gt IE "+(++B)+"]><i></i><![endif]-->"}while(C[0]);return B>4?B:a}()),y=function(){return{html:A.documentElement,body:A.body,head:A.getElementsByTagName("head")[0],title:A.title}},j="data ready thumbnail loadstart loadfinish image play pause progress fullscreen_enter fullscreen_exit idle_enter idle_exit rescale lightbox_open lightbox_close lightbox_image",r=(function(){var B=[];h.each(j.split(" "),function(C,D){B.push(D);if(/_/.test(D)){B.push(D.replace(/_/g,""))}});return B}()),v=function(B){var C;if(typeof B!=="object"){return B}h.each(B,function(D,E){if(/^[a-z]+_/.test(D)){C="";h.each(D.split("_"),function(G,F){C+=G>0?F.substr(0,1).toUpperCase()+F.substr(1):F});B[C]=E;delete B[D]}});return B},q=function(B){if(h.inArray(B,r)>-1){return Galleria[B.toUpperCase()]}return B},i={trunk:{},add:function(F,E,D,C){C=C||false;this.clear(F);if(C){var B=E;E=function(){B();i.add(F,E,D)}}this.trunk[F]=d.setTimeout(E,D)},clear:function(D){var B=function(E){d.clearTimeout(this.trunk[E]);delete this.trunk[E]},C;if(!!D&&D in this.trunk){B.call(i,D)}else{if(typeof D==="undefined"){for(C in this.trunk){if(this.trunk.hasOwnProperty(C)){B.call(i,C)}}}}}},c=[],z=[],o=false,u=false,g=[],f=function(B){Galleria.theme=B;h.each(g,function(D,C){if(!C._initialized){C._init.call(C)}})},b=(function(){return{array:function(B){return Array.prototype.slice.call(B,0)},create:function(B,D){D=D||"div";var C=A.createElement(D);C.className=B;return C},getScriptPath:function(C){C=C||h("script:last").attr("src");var B=C.split("/");if(B.length==1){return""}B.pop();return B.join("/")+"/"},animate:(function(){var E=(function(P){var O="transition WebkitTransition MozTransition OTransition".split(" "),N;if(d.opera){return false}for(N=0;O[N];N++){if(typeof P[O[N]]!=="undefined"){return O[N]}}return false}((A.body||A.documentElement).style));var M={MozTransition:"transitionend",OTransition:"oTransitionEnd",WebkitTransition:"webkitTransitionEnd",transition:"transitionend"}[E];var G={_default:[0.25,0.1,0.25,1],galleria:[0.645,0.045,0.355,1],galleriaIn:[0.55,0.085,0.68,0.53],galleriaOut:[0.25,0.46,0.45,0.94],ease:[0.25,0,0.25,1],linear:[0.25,0.25,0.75,0.75],"ease-in":[0.42,0,1,1],"ease-out":[0,0,0.58,1],"ease-in-out":[0.42,0,0.58,1]};var J=function(O,P,Q){var N={};Q=Q||"transition";h.each("webkit moz ms o".split(" "),function(){N["-"+this+"-"+Q]=P});O.css(N)};var B=function(N){J(N,"none","transition");if(Galleria.WEBKIT&&Galleria.TOUCH){J(N,"translate3d(0,0,0)","transform");if(N.data("revert")){N.css(N.data("revert"));N.data("revert",null)}}};var L,K,D,H,C,F,I;return function(O,P,N){N=h.extend({duration:400,complete:function(){},stop:false},N);O=h(O);if(!N.duration){O.css(P);N.complete.call(O[0]);return}if(!E){O.animate(P,N);return}if(N.stop){O.unbind(M);B(O)}L=false;h.each(P,function(Q,R){I=O.css(Q);if(b.parseValue(I)!=b.parseValue(R)){L=true}O.css(Q,I)});if(!L){d.setTimeout(function(){N.complete.call(O[0])},N.duration);return}K=[];D=N.easing in G?G[N.easing]:G._default;H=" "+N.duration+"ms cubic-bezier("+D.join(",")+")";d.setTimeout(function(){O.one(M,(function(Q){return function(){B(Q);N.complete.call(Q[0])}}(O)));if(Galleria.WEBKIT&&Galleria.TOUCH){C={};F=[0,0,0];h.each(["left","top"],function(R,Q){if(Q in P){F[R]=(b.parseValue(P[Q])-b.parseValue(O.css(Q)))+"px";C[Q]=P[Q];delete P[Q]}});if(F[0]||F[1]){O.data("revert",C);K.push("-webkit-transform"+H);J(O,"translate3d("+F.join(",")+")","transform")}}h.each(P,function(Q,R){K.push(Q+H)});J(O,K.join(","));O.css(P)},1)}}()),removeAlpha:function(E){if(m<9&&E){var D=E.style,C=E.currentStyle,B=C&&C.filter||D.filter||"";if(/alpha/.test(B)){D.filter=B.replace(/alpha\([^)]*\)/i,"")}}},forceStyles:function(C,B){C=h(C);if(C.attr("style")){C.data("styles",C.attr("style")).removeAttr("style")}C.css(B)},revertStyles:function(){h.each(b.array(arguments),function(B,C){C=h(C);C.removeAttr("style");C.attr("style","");if(C.data("styles")){C.attr("style",C.data("styles")).data("styles",null)}})},moveOut:function(B){b.forceStyles(B,{position:"absolute",left:-10000})},moveIn:function(){b.revertStyles.apply(b,b.array(arguments))},elem:function(B){if(B instanceof h){return{$:B,dom:B[0]}}else{return{$:h(B),dom:B}}},hide:function(F,G,H){H=H||function(){};var D=b.elem(F),B=D.$;F=D.dom;if(!B.data("opacity")){B.data("opacity",B.css("opacity"))}var C={opacity:0};if(G){var E=m<9&&F?function(){b.removeAlpha(F);F.style.visibility="hidden";H.call(F)}:H;b.animate(F,C,{duration:G,complete:E,stop:true})}else{if(m<9&&F){b.removeAlpha(F);F.style.visibility="hidden"}else{B.css(C)}}},show:function(G,H,I){I=I||function(){};var D=b.elem(G),B=D.$;G=D.dom;var F=parseFloat(B.data("opacity"))||1,C={opacity:F};if(H){if(m<9){B.css("opacity",0);G.style.visibility="visible"}var E=m<9&&G?function(){if(C.opacity==1){b.removeAlpha(G)}I.call(G)}:I;b.animate(G,C,{duration:H,complete:E,stop:true})}else{if(m<9&&C.opacity==1&&G){b.removeAlpha(G);G.style.visibility="visible"}else{B.css(C)}}},optimizeTouch:(function(){var H,E,D,I,C={},G=function(J){J.preventDefault();C=h.extend({},J,true)},F=function(){this.evt=C},B=function(){this.handler.call(H,this.evt)};return function(J){h(J).bind("touchend",function(K){H=K.target;I=true;while(H.parentNode&&H!=K.currentTarget&&I){E=h(H).data("events");D=h(H).data("fakes");if(E&&"click" in E){I=false;K.preventDefault();h(H).click(G).click();E.click.pop();h.each(E.click,F);h(H).data("fakes",E.click);delete E.click}else{if(D){I=false;K.preventDefault();h.each(D,B)}}H=H.parentNode}})}}()),addTimer:function(){i.add.apply(i,b.array(arguments));return this},clearTimer:function(){i.clear.apply(i,b.array(arguments));return this},wait:function(C){C=h.extend({until:function(){return false},success:function(){},error:function(){Galleria.raise("Could not complete wait function.")},timeout:3000},C);var F=b.timestamp(),E,B,D=function(){B=b.timestamp();E=B-F;if(C.until(E)){C.success();return false}if(B>=F+C.timeout){C.error();return false}d.setTimeout(D,10)};d.setTimeout(D,10)},toggleQuality:function(B,C){if((m!==7&&m!==8)||!B){return}if(typeof C==="undefined"){C=B.style.msInterpolationMode==="nearest-neighbor"}B.style.msInterpolationMode=C?"bicubic":"nearest-neighbor"},insertStyleTag:function(B){var D=A.createElement("style");y().head.appendChild(D);if(D.styleSheet){D.styleSheet.cssText=B}else{var C=A.createTextNode(B);D.appendChild(C)}},loadScript:function(C,E){var B=false,D=h("<script>").attr({src:C,async:true}).get(0);D.onload=D.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;D.onload=D.onreadystatechange=null;if(typeof E==="function"){E.call(this,this)}}};y().head.appendChild(D)},parseValue:function(C){if(typeof C==="number"){return C}else{if(typeof C==="string"){var B=C.match(/\-?\d|\./g);return B&&B.constructor===Array?B.join("")*1:0}else{return 0}}},timestamp:function(){return new Date().getTime()},loadCSS:function(C,G,F){var E,D=false,B;h("link[rel=stylesheet]").each(function(){if(new RegExp(C).test(this.href)){E=this;return false}});if(typeof G==="function"){F=G;G=a}F=F||function(){};if(E){F.call(E,E);return E}B=A.styleSheets.length;if(e){C+="?"+b.timestamp()}if(h("#"+G).length){h("#"+G).attr("href",C);B--;D=true}else{E=h("<link>").attr({rel:"stylesheet",href:C,id:G}).get(0);d.setTimeout(function(){var H=h('link[rel="stylesheet"], style');if(H.length){H.get(0).parentNode.insertBefore(E,H[0])}else{y().head.appendChild(E)}if(m){if(B>=31){Galleria.raise("You have reached the browser stylesheet limit (31)",true);return}E.onreadystatechange=function(I){if(!D&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){D=true}}}else{if(!(new RegExp("file://","i").test(C))){h.ajax({url:C,success:function(){D=true},error:function(I){if(I.isRejected()&&Galleria.WEBKIT){D=true}}})}else{D=true}}},10)}if(typeof F==="function"){b.wait({until:function(){return D&&A.styleSheets.length>B},success:function(){d.setTimeout(function(){F.call(E,E)},100)},error:function(){Galleria.raise("Theme CSS could not load",true)},timeout:10000})}return E}}}()),k=(function(){var B=function(G,D,F,C){var E=this.getOptions("easing"),J=this.getStageWidth(),I={left:J*(G.rewind?-1:1)},H={left:0};if(F){I.opacity=0;H.opacity=1}else{I.opacity=1}h(G.next).css(I);b.animate(G.next,H,{duration:G.speed,complete:(function(K){return function(){D();K.css({left:0})}}(h(G.next).add(G.prev))),queue:false,easing:E});if(C){G.rewind=!G.rewind}if(G.prev){I={left:0};H={left:J*(G.rewind?1:-1)};if(F){I.opacity=1;H.opacity=0}h(G.prev).css(I);b.animate(G.prev,H,{duration:G.speed,queue:false,easing:E,complete:function(){h(this).css("opacity",0)}})}};return{fade:function(D,C){h(D.next).css("opacity",0).show();b.animate(D.next,{opacity:1},{duration:D.speed,complete:C});if(D.prev){h(D.prev).css("opacity",1).show();b.animate(D.prev,{opacity:0},{duration:D.speed})}},flash:function(D,C){h(D.next).css("opacity",0);if(D.prev){b.animate(D.prev,{opacity:0},{duration:D.speed/2,complete:function(){b.animate(D.next,{opacity:1},{duration:D.speed,complete:C})}})}else{b.animate(D.next,{opacity:1},{duration:D.speed,complete:C})}},pulse:function(D,C){if(D.prev){h(D.prev).hide()}h(D.next).css("opacity",0).show();b.animate(D.next,{opacity:1},{duration:D.speed,complete:C})},slide:function(D,C){B.apply(this,b.array(arguments))},fadeslide:function(D,C){B.apply(this,b.array(arguments).concat([true]))},doorslide:function(D,C){B.apply(this,b.array(arguments).concat([false,true]))}}}());Galleria=function(){var J=this;this._theme=a;this._options={};this._playing=false;this._playtime=5000;this._active=null;this._queue={length:0};this._data=[];this._dom={};this._thumbnails=[];this._layers=[];this._initialized=false;this._firstrun=false;this._stageWidth=0;this._stageHeight=0;this._target=a;this._id=Math.random();var F="container stage images image-nav image-nav-left image-nav-right info info-text info-title info-description thumbnails thumbnails-list thumbnails-container thumb-nav-left thumb-nav-right loader counter tooltip",E="current total";h.each(F.split(" "),function(L,M){J._dom[M]=b.create("galleria-"+M)});h.each(E.split(" "),function(L,M){J._dom[M]=b.create("galleria-"+M,"span")});var D=this._keyboard={keys:{UP:38,DOWN:40,LEFT:37,RIGHT:39,RETURN:13,ESCAPE:27,BACKSPACE:8,SPACE:32},map:{},bound:false,press:function(M){var L=M.keyCode||M.which;if(L in D.map&&typeof D.map[L]==="function"){D.map[L].call(J,M)}},attach:function(N){var M,L;for(M in N){if(N.hasOwnProperty(M)){L=M.toUpperCase();if(L in D.keys){D.map[D.keys[L]]=N[M]}else{D.map[L]=N[M]}}}if(!D.bound){D.bound=true;l.bind("keydown",D.press)}},detach:function(){D.bound=false;D.map={};l.unbind("keydown",D.press)}};var I=this._controls={0:a,1:a,active:0,swap:function(){I.active=I.active?0:1},getActive:function(){return I[I.active]},getNext:function(){return I[1-I.active]}};var K=this._carousel={next:J.$("thumb-nav-right"),prev:J.$("thumb-nav-left"),width:0,current:0,max:0,hooks:[],update:function(){var M=0,N=0,L=[0];h.each(J._thumbnails,function(P,O){if(O.ready){M+=O.outerWidth||h(O.container).outerWidth(true);L[P+1]=M;N=Math.max(N,O.outerHeight||h(O.container).outerHeight(true))}});J.$("thumbnails").css({width:M,height:N});K.max=M;K.hooks=L;K.width=J.$("thumbnails-list").width();K.setClasses();J.$("thumbnails-container").toggleClass("galleria-carousel",M>K.width);K.width=J.$("thumbnails-list").width()},bindControls:function(){var L;K.next.bind("click",function(M){M.preventDefault();if(J._options.carouselSteps==="auto"){for(L=K.current;L<K.hooks.length;L++){if(K.hooks[L]-K.hooks[K.current]>K.width){K.set(L-2);break}}}else{K.set(K.current+J._options.carouselSteps)}});K.prev.bind("click",function(M){M.preventDefault();if(J._options.carouselSteps==="auto"){for(L=K.current;L>=0;L--){if(K.hooks[K.current]-K.hooks[L]>K.width){K.set(L+2);break}else{if(L===0){K.set(0);break}}}}else{K.set(K.current-J._options.carouselSteps)}})},set:function(L){L=Math.max(L,0);while(K.hooks[L-1]+K.width>=K.max&&L>=0){L--}K.current=L;K.animate()},getLast:function(L){return(L||K.current)-1},follow:function(L){if(L===0||L===K.hooks.length-2){K.set(L);return}var M=K.current;while(K.hooks[M]-K.hooks[K.current]<K.width&&M<=K.hooks.length){M++}if(L-1<K.current){K.set(L-1)}else{if(L+2>M){K.set(L-M+K.current+2)}}},setClasses:function(){K.prev.toggleClass("disabled",!K.current);K.next.toggleClass("disabled",K.hooks[K.current]+K.width>=K.max)},animate:function(M){K.setClasses();var L=K.hooks[K.current]*-1;if(isNaN(L)){return}b.animate(J.get("thumbnails"),{left:L},{duration:J._options.carouselSpeed,easing:J._options.easing,queue:false})}};var G=this._tooltip={initialized:false,open:false,init:function(){G.initialized=true;var L=".galleria-tooltip{padding:3px 8px;max-width:50%;background:#ffe;color:#000;z-index:3;position:absolute;font-size:11px;line-height:1.3opacity:0;box-shadow:0 0 2px rgba(0,0,0,.4);-moz-box-shadow:0 0 2px rgba(0,0,0,.4);-webkit-box-shadow:0 0 2px rgba(0,0,0,.4);}";b.insertStyleTag(L);J.$("tooltip").css("opacity",0.8);b.hide(J.get("tooltip"))},move:function(S){var P=J.getMousePosition(S).x,Q=J.getMousePosition(S).y,N=J.$("tooltip"),U=P,T=Q,V=N.outerHeight(true)+1,O=N.outerWidth(true),R=V+15;var M=J.$("container").width()-O-2,L=J.$("container").height()-V-2;if(!isNaN(U)&&!isNaN(T)){U+=10;T-=30;U=Math.max(0,Math.min(M,U));T=Math.max(0,Math.min(L,T));if(Q<R){T=R}N.css({left:U,top:T})}},bind:function(M,N){if(Galleria.TOUCH){return}if(!G.initialized){G.init()}var L=function(O,P){G.define(O,P);h(O).hover(function(){b.clearTimer("switch_tooltip");J.$("container").unbind("mousemove",G.move).bind("mousemove",G.move).trigger("mousemove");G.show(O);Galleria.utils.addTimer("tooltip",function(){J.$("tooltip").stop().show().animate({opacity:1});G.open=true},G.open?0:500)},function(){J.$("container").unbind("mousemove",G.move);b.clearTimer("tooltip");J.$("tooltip").stop().animate({opacity:0},200,function(){J.$("tooltip").hide();b.addTimer("switch_tooltip",function(){G.open=false},1000)})})};if(typeof N==="string"){L((M in J._dom?J.get(M):M),N)}else{h.each(M,function(P,O){L(J.get(P),O)})}},show:function(L){L=h(L in J._dom?J.get(L):L);var N=L.data("tt"),M=function(O){d.setTimeout((function(P){return function(){G.move(P)}}(O)),10);L.unbind("mouseup",M)};N=typeof N==="function"?N():N;if(!N){return}J.$("tooltip").html(N.replace(/\s/,"&nbsp;"));L.bind("mouseup",M)},define:function(M,N){if(typeof N!=="function"){var L=N;N=function(){return L}}M=h(M in J._dom?J.get(M):M).data("tt",N);G.show(M)}};var H=this._fullscreen={scrolled:0,crop:a,transition:a,active:false,keymap:J._keyboard.map,enter:function(S){H.active=true;b.hide(J.getActiveImage());J.$("container").addClass("fullscreen");H.scrolled=w.scrollTop();b.forceStyles(J.get("container"),{position:"fixed",top:0,left:0,width:"100%",height:"100%",zIndex:10000});var P={height:"100%",overflow:"hidden",margin:0,padding:0},R=J.getData(),Q=J._options;b.forceStyles(y().html,P);b.forceStyles(y().body,P);H.keymap=h.extend({},J._keyboard.map);J.attachKeyboard({escape:J.exitFullscreen,right:J.next,left:J.prev});H.crop=Q.imageCrop;H.transition=Q.transition;h.each({fullscreenCrop:"imageCrop",fullscreenTransition:"imageTransition"},function(T,U){if(Q[T]!=a){Q[U]=Q[T]}});if(R&&R.big&&R.image!==R.big){var L=new Galleria.Picture(),N=L.isCached(R.big),O=J.getIndex(),M=J._thumbnails[O];J.trigger({type:Galleria.LOADSTART,cached:N,rewind:false,index:O,imageTarget:J.getActiveImage(),thumbTarget:M});L.load(R.big,function(T){J._scaleImage(T,{complete:function(U){J.trigger({type:Galleria.LOADFINISH,cached:N,index:O,rewind:false,imageTarget:U.image,thumbTarget:M});var V=J._controls.getActive().image;if(V){h(V).width(U.image.width).height(U.image.height).attr("style",h(U.image).attr("style")).attr("src",U.image.src)}}})})}J.rescale(function(){b.addTimer("fullscreen_enter",function(){b.show(J.getActiveImage());if(typeof S==="function"){S.call(J)}},100);J.trigger(Galleria.FULLSCREEN_ENTER)});w.resize(function(){H.scale()})},scale:function(){J.rescale()},exit:function(N){H.active=false;b.hide(J.getActiveImage());J.$("container").removeClass("fullscreen");b.revertStyles(J.get("container"),y().html,y().body);d.scrollTo(0,H.scrolled);J.detachKeyboard();J.attachKeyboard(H.keymap);J._options.imageCrop=H.crop;J._options.transition=H.transition;var L=J.getData().big,M=J._controls.getActive().image;if(L&&L==M.src){d.setTimeout(function(O){return function(){M.src=O}}(J.getData().image),1)}J.rescale(function(){b.addTimer("fullscreen_exit",function(){b.show(J.getActiveImage());if(typeof N==="function"){N.call(J)}},50);J.trigger(Galleria.FULLSCREEN_EXIT)});w.unbind("resize",H.scale)}};var C=this._idle={trunk:[],bound:false,add:function(M,O){if(!M){return}if(!C.bound){C.addEvent()}M=h(M);var N={},L;for(L in O){if(O.hasOwnProperty(L)){N[L]=M.css(L)}}M.data("idle",{from:N,to:O,complete:true,busy:false});C.addTimer();C.trunk.push(M)},remove:function(L){L=jQuery(L);h.each(C.trunk,function(M,N){if(N.length&&!N.not(L).length){J._idle.show(L);J._idle.trunk.splice(M,1)}});if(!C.trunk.length){C.removeEvent();b.clearTimer("idle")}},addEvent:function(){C.bound=true;J.$("container").bind("mousemove click",C.showAll)},removeEvent:function(){C.bound=false;J.$("container").unbind("mousemove click",C.showAll)},addTimer:function(){b.addTimer("idle",function(){J._idle.hide()},J._options.idleTime)},hide:function(){if(!J._options.idleMode){return}J.trigger(Galleria.IDLE_ENTER);h.each(C.trunk,function(L,M){var N=M.data("idle");if(!N){return}M.data("idle").complete=false;b.animate(M,N.to,{duration:J._options.idleSpeed})})},showAll:function(){b.clearTimer("idle");h.each(J._idle.trunk,function(L,M){J._idle.show(M)})},show:function(L){var M=L.data("idle");if(!M.busy&&!M.complete){M.busy=true;J.trigger(Galleria.IDLE_EXIT);b.clearTimer("idle");b.animate(L,M.from,{duration:J._options.idleSpeed/2,complete:function(){h(this).data("idle").busy=false;h(this).data("idle").complete=true}})}C.addTimer()}};var B=this._lightbox={width:0,height:0,initialized:false,active:null,image:null,elems:{},keymap:false,init:function(){J.trigger(Galleria.LIGHTBOX_OPEN);if(B.initialized){return}B.initialized=true;var L="overlay box content shadow title info close prevholder prev nextholder next counter image",M={},Q=J._options,P="",T="position:absolute;",N="lightbox-",O={overlay:"position:fixed;display:none;opacity:"+Q.overlayOpacity+";filter:alpha(opacity="+(Q.overlayOpacity*100)+");top:0;left:0;width:100%;height:100%;background:"+Q.overlayBackground+";z-index:99990",box:"position:fixed;display:none;width:400px;height:400px;top:50%;left:50%;margin-top:-200px;margin-left:-200px;z-index:99991",shadow:T+"background:#000;width:100%;height:100%;",content:T+"background-color:#fff;top:10px;left:10px;right:10px;bottom:10px;overflow:hidden",info:T+"bottom:10px;left:10px;right:10px;color:#444;font:11px/13px arial,sans-serif;height:13px",close:T+"top:10px;right:10px;height:20px;width:20px;background:#fff;text-align:center;cursor:pointer;color:#444;font:16px/22px arial,sans-serif;z-index:99999",image:T+"top:10px;left:10px;right:10px;bottom:30px;overflow:hidden;display:block;",prevholder:T+"width:50%;top:0;bottom:40px;cursor:pointer;",nextholder:T+"width:50%;top:0;bottom:40px;right:-1px;cursor:pointer;",prev:T+"top:50%;margin-top:-20px;height:40px;width:30px;background:#fff;left:20px;display:none;text-align:center;color:#000;font:bold 16px/36px arial,sans-serif",next:T+"top:50%;margin-top:-20px;height:40px;width:30px;background:#fff;right:20px;left:auto;display:none;font:bold 16px/36px arial,sans-serif;text-align:center;color:#000",title:"float:left",counter:"float:right;margin-left:8px;"},R=function(U){return U.hover(function(){h(this).css("color","#bbb")},function(){h(this).css("color","#444")})},S={};if(m===8){O.nextholder+="background:#000;filter:alpha(opacity=0);";O.prevholder+="background:#000;filter:alpha(opacity=0);"}h.each(O,function(U,V){P+=".galleria-"+N+U+"{"+V+"}"});b.insertStyleTag(P);h.each(L.split(" "),function(U,V){J.addElement("lightbox-"+V);M[V]=B.elems[V]=J.get("lightbox-"+V)});B.image=new Galleria.Picture();h.each({box:"shadow content close prevholder nextholder",info:"title counter",content:"info image",prevholder:"prev",nextholder:"next"},function(V,W){var U=[];h.each(W.split(" "),function(X,Y){U.push(N+Y)});S[N+V]=U});J.append(S);h(M.image).append(B.image.container);h(y().body).append(M.overlay,M.box);b.optimizeTouch(M.box);R(h(M.close).bind("click",B.hide).html("&#215;"));h.each(["Prev","Next"],function(X,V){var W=h(M[V.toLowerCase()]).html(/v/.test(V)?"&#8249;&nbsp;":"&nbsp;&#8250;"),U=h(M[V.toLowerCase()+"holder"]);U.bind("click",function(){B["show"+V]()});if(m<8||Galleria.TOUCH){W.show();return}U.hover(function(){W.show()},function(Y){W.stop().fadeOut(200)})});h(M.overlay).bind("click",B.hide);if(Galleria.IPAD){J._options.lightboxTransitionSpeed=0}},rescale:function(O){var N=Math.min(w.width()-40,B.width),P=Math.min(w.height()-60,B.height),M=Math.min(N/B.width,P/B.height),L=Math.round(B.width*M)+40,R=Math.round(B.height*M)+60,Q={width:L,height:R,"margin-top":Math.ceil(R/2)*-1,"margin-left":Math.ceil(L/2)*-1};if(O){h(B.elems.box).css(Q)}else{h(B.elems.box).animate(Q,{duration:J._options.lightboxTransitionSpeed,easing:J._options.easing,complete:function(){var T=B.image,S=J._options.lightboxFadeSpeed;J.trigger({type:Galleria.LIGHTBOX_IMAGE,imageTarget:T.image});h(T.container).show();b.show(T.image,S);b.show(B.elems.info,S)}})}},hide:function(){B.image.image=null;w.unbind("resize",B.rescale);h(B.elems.box).hide();b.hide(B.elems.info);J.detachKeyboard();J.attachKeyboard(B.keymap);B.keymap=false;b.hide(B.elems.overlay,200,function(){h(this).hide().css("opacity",J._options.overlayOpacity);J.trigger(Galleria.LIGHTBOX_CLOSE)})},showNext:function(){B.show(J.getNext(B.active))},showPrev:function(){B.show(J.getPrev(B.active))},show:function(L){B.active=L=typeof L==="number"?L:J.getIndex();if(!B.initialized){B.init()}if(!B.keymap){B.keymap=h.extend({},J._keyboard.map);J.attachKeyboard({escape:B.hide,right:B.showNext,left:B.showPrev})}w.unbind("resize",B.rescale);var P=J.getData(L),N=J.getDataLength(),S=J.getNext(L),O,R,M;b.hide(B.elems.info);try{for(M=J._options.preload;M>0;M--){R=new Galleria.Picture();O=J.getData(S);R.preload("big" in O?O.big:O.image);S=J.getNext(S)}}catch(Q){}B.image.load(P.big||P.image,function(T){B.width=T.original.width;B.height=T.original.height;h(T.image).css({width:"100.5%",height:"100.5%",top:0,zIndex:99998});b.hide(T.image);B.elems.title.innerHTML=P.title||"";B.elems.counter.innerHTML=(L+1)+" / "+N;w.resize(B.rescale);B.rescale()});h(B.elems.overlay).show();h(B.elems.box).show()}};return this};Galleria.prototype={constructor:Galleria,init:function(D,C){var B=this;C=v(C);this._original={target:D,options:C,data:null};this._target=this._dom.target=D.nodeName?D:h(D).get(0);z.push(this);if(!this._target){Galleria.raise("Target not found.",true);return}this._options={autoplay:false,carousel:true,carouselFollow:true,carouselSpeed:400,carouselSteps:"auto",clicknext:false,dataConfig:function(E){return{}},dataSelector:"img",dataSource:this._target,debug:a,dummy:a,easing:"galleria",extend:function(E){},fullscreenCrop:a,fullscreenDoubleTap:true,fullscreenTransition:a,height:"auto",idleMode:true,idleTime:3000,idleSpeed:200,imageCrop:false,imageMargin:0,imagePan:false,imagePanSmoothness:12,imagePosition:"50%",imageTimeout:a,initialTransition:a,keepSource:false,layerFollow:true,lightbox:false,lightboxFadeSpeed:200,lightboxTransitionSpeed:200,linkSourceImages:true,maxScaleRatio:a,minScaleRatio:a,overlayOpacity:0.85,overlayBackground:"#0b0b0b",pauseOnInteraction:true,popupLinks:false,preload:2,queue:true,show:0,showInfo:true,showCounter:true,showImagenav:true,swipe:true,thumbCrop:true,thumbEventType:"click",thumbFit:true,thumbMargin:0,thumbQuality:"auto",thumbnails:true,touchTransition:a,transition:"fade",transitionInitial:a,transitionSpeed:400,useCanvas:false,width:"auto"};this._options.initialTransition=this._options.initialTransition||this._options.transitionInitial;if(C&&C.debug===false){e=false}if(C&&typeof C.imageTimeout==="number"){s=C.imageTimeout}if(C&&typeof C.dummy==="string"){t=C.dummy}h(this._target).children().hide();if(typeof Galleria.theme==="object"){this._init()}else{g.push(this)}return this},_init:function(){var C=this,D=this._options;if(this._initialized){Galleria.raise("Init failed: Gallery instance already initialized.");return this}this._initialized=true;if(!Galleria.theme){Galleria.raise("Init failed: No theme found.");return this}h.extend(true,D,Galleria.theme.defaults,this._original.options);if(typeof D.touchTransition==="string"&&Galleria.TOUCH){D.transition=D.touchTransition}(function(F){if(!("getContext" in F)){F=null;return}u=u||{elem:F,context:F.getContext("2d"),cache:{},length:0}}(A.createElement("canvas")));this.bind(Galleria.DATA,function(){if(Galleria.QUIRK){Galleria.raise("Your page is in Quirks mode, Galleria may not render correctly. Please validate your HTML.")}this._original.data=this._data;this.get("total").innerHTML=this.getDataLength();var H=this.$("container");var G={width:0,height:0};var F=function(){return C.$("stage").height()};b.wait({until:function(){h.each(["width","height"],function(J,I){if(D[I]&&typeof D[I]==="number"){G[I]=D[I]}else{G[I]=Math.max(b.parseValue(H.css(I)),b.parseValue(C.$("target").css(I)),H[I](),C.$("target")[I]())}H[I](G[I])});return F()&&G.width&&G.height>10},success:function(){if(Galleria.WEBKIT){d.setTimeout(function(){C._run()},1)}else{C._run()}},error:function(){if(F()){Galleria.raise("Could not extract sufficient width/height of the gallery container. Traced measures: width:"+G.width+"px, height: "+G.height+"px.",true)}else{Galleria.raise("Could not extract a stage height from the CSS. Traced height: "+F()+"px.",true)}},timeout:2000})});this.append({"info-text":["info-title","info-description"],info:["info-text"],"image-nav":["image-nav-right","image-nav-left"],stage:["images","loader","counter","image-nav"],"thumbnails-list":["thumbnails"],"thumbnails-container":["thumb-nav-left","thumbnails-list","thumb-nav-right"],container:["stage","thumbnails-container","info","tooltip"]});b.hide(this.$("counter").append(this.get("current")," / ",this.get("total")));this.setCounter("&#8211;");b.hide(C.get("tooltip"));this.$("container").addClass(Galleria.TOUCH?"touch":"notouch");h.each(new Array(2),function(F){var G=new Galleria.Picture();h(G.container).css({position:"absolute",top:0,left:0}).prepend(C._layers[F]=h(b.create("galleria-layer")).css({position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:2})[0]);C.$("images").append(G.container);C._controls[F]=G});this.$("images").css({position:"relative",top:0,left:0,width:"100%",height:"100%"});this.$("thumbnails, thumbnails-list").css({overflow:"hidden",position:"relative"});this.$("image-nav-right, image-nav-left").bind("click",function(G){if(D.clicknext){G.stopPropagation()}if(D.pauseOnInteraction){C.pause()}var F=/right/.test(this.className)?"next":"prev";C[F]()});h.each(["info","counter","image-nav"],function(F,G){if(D["show"+G.substr(0,1).toUpperCase()+G.substr(1).replace(/-/,"")]===false){b.moveOut(C.get(G.toLowerCase()))}});this.load();if(!D.keepSource&&!m){this._target.innerHTML=""}if(this.get("errors")){this.appendChild("target","errors")}this.appendChild("target","container");if(D.carousel){var E=0,B=D.show;this.bind(Galleria.THUMBNAIL,function(){this.updateCarousel();if(++E==this.getDataLength()&&typeof B=="number"&&B>0){this._carousel.follow(B)}})}if(D.swipe){(function(F){var N=[0,0],Q=[0,0],J=30,L=100,M=false,H=0,I,P={start:"touchstart",move:"touchmove",stop:"touchend"},G=function(R){return R.originalEvent.touches?R.originalEvent.touches[0]:R},K=function(R){if(R.originalEvent.touches&&R.originalEvent.touches.length>1){return}I=G(R);Q=[I.pageX,I.pageY];if(!N[0]){N=Q}if(Math.abs(N[0]-Q[0])>10){R.preventDefault()}},O=function(R){F.unbind(P.move,K);if((R.originalEvent.touches&&R.originalEvent.touches.length)||M){M=!M;return}if(b.timestamp()-H<1000&&Math.abs(N[0]-Q[0])>J&&Math.abs(N[1]-Q[1])<L){R.preventDefault();C[N[0]>Q[0]?"next":"prev"]()}N=Q=[0,0]};F.bind(P.start,function(R){if(R.originalEvent.touches&&R.originalEvent.touches.length>1){return}I=G(R);H=b.timestamp();N=Q=[I.pageX,I.pageY];F.bind(P.move,K).one(P.stop,O)})}(C.$("images")));if(D.fullscreenDoubleTap){this.$("stage").bind("touchstart",(function(){var I,F,L,K,H,G,J=function(M){return M.originalEvent.touches?M.originalEvent.touches[0]:M};return function(M){G=Galleria.utils.timestamp();F=J(M).pageX;L=J(M).pageY;if((G-I<500)&&(F-K<20)&&(L-H<20)){C.toggleFullscreen();M.preventDefault();C.$("stage").unbind("touchend",arguments.callee);return}I=G;K=F;H=L}}()))}}b.optimizeTouch(this.get("container"));return this},_createThumbnails:function(){this.get("total").innerHTML=this.getDataLength();var F,C,B,G,N,M=this,D=this._options,H=(function(){var O=M.$("thumbnails").find(".active");if(!O.length){return false}return O.find("img").attr("src")}()),I=typeof D.thumbnails==="string"?D.thumbnails.toLowerCase():null,J=function(O){return A.defaultView&&A.defaultView.getComputedStyle?A.defaultView.getComputedStyle(B.container,null)[O]:N.css(O)},K=function(Q,O,P){return function(){h(P).append(Q);M.trigger({type:Galleria.THUMBNAIL,thumbTarget:Q,index:O})}},L=function(P){if(D.pauseOnInteraction){M.pause()}var O=h(P.currentTarget).data("index");if(M.getIndex()!==O){M.show(O)}P.preventDefault()},E=function(O){O.scale({width:O.data.width,height:O.data.height,crop:D.thumbCrop,margin:D.thumbMargin,canvas:D.useCanvas,complete:function(R){var T=["left","top"],Q=["Width","Height"],P,S;h.each(Q,function(U,V){P=V.toLowerCase();if((D.thumbCrop!==true||D.thumbCrop===P)&&D.thumbFit){S={};S[P]=R[P];h(R.container).css(S);S={};S[T[U]]=0;h(R.image).css(S)}R["outer"+V]=h(R.container)["outer"+V](true)});b.toggleQuality(R.image,D.thumbQuality===true||(D.thumbQuality==="auto"&&R.original.width<R.width*3));M.trigger({type:Galleria.THUMBNAIL,thumbTarget:R.image,index:R.data.order})}})};this._thumbnails=[];this.$("thumbnails").empty();for(F=0;this._data[F];F++){G=this._data[F];if(D.thumbnails===true){B=new Galleria.Picture(F);C=G.thumb||G.image;this.$("thumbnails").append(B.container);N=h(B.container);B.data={width:b.parseValue(J("width")),height:b.parseValue(J("height")),order:F};if(D.thumbFit&&D.thumbCrop!==true){N.css({width:0,height:0})}else{N.css({width:B.data.width,height:B.data.height})}B.load(C,E);if(D.preload==="all"){B.preload(G.image)}}else{if(I==="empty"||I==="numbers"){B={container:b.create("galleria-image"),image:b.create("img","span"),ready:true};if(I==="numbers"){h(B.image).text(F+1)}this.$("thumbnails").append(B.container);d.setTimeout((K)(B.image,F,B.container),50+(F*20))}else{B={container:null,image:null}}}h(B.container).add(D.keepSource&&D.linkSourceImages?G.original:null).data("index",F).bind(D.thumbEventType,L);if(H===C){h(B.container).addClass("active")}this._thumbnails.push(B)}},_run:function(){var B=this;B._createThumbnails();b.wait({until:function(){if(Galleria.OPERA){B.$("stage").css("display","inline-block")}B._stageWidth=B.$("stage").width();B._stageHeight=B.$("stage").height();return(B._stageWidth&&B._stageHeight>50)},success:function(){c.push(B);b.show(B.get("counter"));if(B._options.carousel){B._carousel.bindControls()}if(B._options.autoplay){B.pause();if(typeof B._options.autoplay==="number"){B._playtime=B._options.autoplay}B.trigger(Galleria.PLAY);B._playing=true}if(B._firstrun){if(typeof B._options.show==="number"){B.show(B._options.show)}return}B._firstrun=true;if(B._options.clicknext&&!Galleria.TOUCH){h.each(B._data,function(C,D){delete D.link});B.$("stage").css({cursor:"pointer"}).bind("click",function(C){if(B._options.pauseOnInteraction){B.pause()}B.next()})}if(Galleria.History){Galleria.History.change(function(C){if(isNaN(C)){d.history.go(-1)}else{B.show(C,a,true)}})}h.each(Galleria.ready.callbacks,function(){this.call(B,B._options)});B.trigger(Galleria.READY);Galleria.theme.init.call(B,B._options);B._options.extend.call(B,B._options);if(/^[0-9]{1,4}$/.test(n)&&Galleria.History){B.show(n,a,true)}else{if(B._data[B._options.show]){B.show(B._options.show)}}},error:function(){Galleria.raise("Stage width or height is too small to show the gallery. Traced measures: width:"+B._stageWidth+"px, height: "+B._stageHeight+"px.",true)}})},load:function(C,B,E){var D=this;this._data=[];this._thumbnails=[];this.$("thumbnails").empty();if(typeof B==="function"){E=B;B=null}C=C||this._options.dataSource;B=B||this._options.dataSelector;E=E||this._options.dataConfig;if(/^function Object/.test(C.constructor)){C=[C]}if(C.constructor===Array){if(this.validate(C)){this._data=C;this._parseData().trigger(Galleria.DATA)}else{Galleria.raise("Load failed: JSON Array not valid.")}return this}h(C).find(B).each(function(J,I){I=h(I);var K={},H=I.parent(),G=H.attr("href"),F=H.attr("rel");if(G){K.image=K.big=G}if(F){K.big=F}D._data.push(h.extend({title:I.attr("title")||"",thumb:I.attr("src"),image:I.attr("src"),big:I.attr("src"),description:I.attr("alt")||"",link:I.attr("longdesc"),original:I.get(0)},K,E(I)))});if(this.getDataLength()){this.trigger(Galleria.DATA)}else{Galleria.raise("Load failed: no data found.")}return this},_parseData:function(){var B=this;h.each(this._data,function(C,D){if("thumb" in D===false){B._data[C].thumb=D.image}if(!"big" in D){B._data[C].big=D.image}});return this},splice:function(){Array.prototype.splice.apply(this._data,b.array(arguments));return this._parseData()._createThumbnails()},push:function(){Array.prototype.push.apply(this._data,b.array(arguments));return this._parseData()._createThumbnails()},_getActive:function(){return this._controls.getActive()},validate:function(B){return true},bind:function(C,B){C=q(C);this.$("container").bind(C,this.proxy(B));return this},unbind:function(B){B=q(B);this.$("container").unbind(B);return this},trigger:function(B){B=typeof B==="object"?h.extend(B,{scope:this}):{type:q(B),scope:this};this.$("container").trigger(B);return this},addIdleState:function(C,B){this._idle.add.apply(this._idle,b.array(arguments));return this},removeIdleState:function(B){this._idle.remove.apply(this._idle,b.array(arguments));return this},enterIdleMode:function(){this._idle.hide();return this},exitIdleMode:function(){this._idle.showAll();return this},enterFullscreen:function(B){this._fullscreen.enter.apply(this,b.array(arguments));return this},exitFullscreen:function(B){this._fullscreen.exit.apply(this,b.array(arguments));return this},toggleFullscreen:function(B){this._fullscreen[this.isFullscreen()?"exit":"enter"].apply(this,b.array(arguments));return this},bindTooltip:function(B,C){this._tooltip.bind.apply(this._tooltip,b.array(arguments));return this},defineTooltip:function(B,C){this._tooltip.define.apply(this._tooltip,b.array(arguments));return this},refreshTooltip:function(B){this._tooltip.show.apply(this._tooltip,b.array(arguments));return this},openLightbox:function(){this._lightbox.show.apply(this._lightbox,b.array(arguments));return this},closeLightbox:function(){this._lightbox.hide.apply(this._lightbox,b.array(arguments));return this},getActiveImage:function(){return this._getActive().image||a},getActiveThumb:function(){return this._thumbnails[this._active].image||a},getMousePosition:function(B){return{x:B.pageX-this.$("container").offset().left,y:B.pageY-this.$("container").offset().top}},addPan:function(H){if(this._options.imageCrop===false){return}H=h(H||this.getActiveImage());var R=this,P=H.width()/2,O=H.height()/2,Q=parseInt(H.css("left"),10),N=parseInt(H.css("top"),10),D=Q||0,C=N||0,M=0,L=0,G=false,K=b.timestamp(),B=0,E=0,J=function(U,T,V){if(U>0){E=Math.round(Math.max(U*-1,Math.min(0,T)));if(B!==E){B=E;if(m===8){H.parent()["scroll"+V](E*-1)}else{var S={};S[V.toLowerCase()]=E;H.css(S)}}}},F=function(S){if(b.timestamp()-K<50){return}G=true;P=R.getMousePosition(S).x;O=R.getMousePosition(S).y},I=function(S){if(!G){return}M=H.width()-R._stageWidth;L=H.height()-R._stageHeight;Q=P/R._stageWidth*M*-1;N=O/R._stageHeight*L*-1;D+=(Q-D)/R._options.imagePanSmoothness;C+=(N-C)/R._options.imagePanSmoothness;J(L,C,"Top");J(M,D,"Left")};if(m===8){H.parent().scrollTop(C*-1).scrollLeft(D*-1);H.css({top:0,left:0})}this.$("stage").unbind("mousemove",F).bind("mousemove",F);b.addTimer("pan",I,50,true);return this},proxy:function(C,B){if(typeof C!=="function"){return function(){}}B=B||this;return function(){return C.apply(B,b.array(arguments))}},removePan:function(){this.$("stage").unbind("mousemove");b.clearTimer("pan");return this},addElement:function(C){var B=this._dom;h.each(b.array(arguments),function(E,D){B[D]=b.create("galleria-"+D)});return this},attachKeyboard:function(B){this._keyboard.attach.apply(this._keyboard,b.array(arguments));return this},detachKeyboard:function(){this._keyboard.detach.apply(this._keyboard,b.array(arguments));return this},appendChild:function(C,B){this.$(C).append(this.get(B)||B);return this},prependChild:function(C,B){this.$(C).prepend(this.get(B)||B);return this},remove:function(B){this.$(b.array(arguments).join(",")).remove();return this},append:function(D){var C,B;for(C in D){if(D.hasOwnProperty(C)){if(D[C].constructor===Array){for(B=0;D[C][B];B++){this.appendChild(C,D[C][B])}}else{this.appendChild(C,D[C])}}}return this},_scaleImage:function(F,C){F=F||this._controls.getActive();var B=this,D,E=function(G){h(G.container).children(":first").css({top:Math.max(0,b.parseValue(G.image.style.top)),left:Math.max(0,b.parseValue(G.image.style.left)),width:b.parseValue(G.image.width),height:b.parseValue(G.image.height)})};C=h.extend({width:this._stageWidth,height:this._stageHeight,crop:this._options.imageCrop,max:this._options.maxScaleRatio,min:this._options.minScaleRatio,margin:this._options.imageMargin,position:this._options.imagePosition},C);if(this._options.layerFollow&&this._options.imageCrop!==true){if(typeof C.complete=="function"){D=C.complete;C.complete=function(){D.call(F,F);E(F)}}else{C.complete=E}}else{h(F.container).children(":first").css({top:0,left:0})}F.scale(C);return this},updateCarousel:function(){this._carousel.update();return this},rescale:function(C,E,D){var B=this;if(typeof C==="function"){D=C;C=a}var F=function(){B._stageWidth=C||B.$("stage").width();B._stageHeight=E||B.$("stage").height();B._scaleImage();if(B._options.carousel){B.updateCarousel()}B.trigger(Galleria.RESCALE);if(typeof D==="function"){D.call(B)}};if(Galleria.WEBKIT&&!C&&!E){b.addTimer("scale",F,10)}else{F.call(B)}return this},refreshImage:function(){this._scaleImage();if(this._options.imagePan){this.addPan()}return this},show:function(C,D,B){if(C===false||(!this._options.queue&&this._queue.stalled)){return}C=Math.max(0,Math.min(parseInt(C,10),this.getDataLength()-1));D=typeof D!=="undefined"?!!D:C<this.getIndex();B=B||false;if(!B&&Galleria.History){Galleria.History.set(C.toString());return}this._active=C;Array.prototype.push.call(this._queue,{index:C,rewind:D});if(!this._queue.stalled){this._show()}return this},_show:function(){var O=this,K=this._queue[0],G=this.getData(K.index);if(!G){return}var C=this.isFullscreen()&&"big" in G?G.big:G.image,H=this._controls.getActive(),J=this._controls.getNext(),I=J.isCached(C),B=this._thumbnails[K.index];var M=(function(S,R,T,P,Q){return function(){var U;O._queue.stalled=false;b.toggleQuality(R.image,O._options.imageQuality);O._layers[O._controls.active].innerHTML="";h(T.container).css({zIndex:0,opacity:0}).show();h(R.container).css({zIndex:1}).show();O._controls.swap();if(O._options.imagePan){O.addPan(R.image)}if(S.link||O._options.lightbox){h(R.image).css({cursor:"pointer"}).bind("mouseup",function(){if(S.link){if(O._options.popupLinks){U=d.open(S.link,"_blank")}else{d.location.href=S.link}return}O.openLightbox()})}Array.prototype.shift.call(O._queue);if(O._queue.length){O._show()}O._playCheck();O.trigger({type:Galleria.IMAGE,index:P.index,imageTarget:R.image,thumbTarget:Q.image})}}(G,J,H,K,B));if(this._options.carousel&&this._options.carouselFollow){this._carousel.follow(K.index)}if(this._options.preload){var D,F,E=this.getNext(),N;try{for(F=this._options.preload;F>0;F--){D=new Galleria.Picture();N=O.getData(E);D.preload(this.isFullscreen()&&"big" in N?N.big:N.image);E=O.getNext(E)}}catch(L){}}b.show(J.container);h(O._thumbnails[K.index].container).addClass("active").siblings(".active").removeClass("active");O.trigger({type:Galleria.LOADSTART,cached:I,index:K.index,rewind:K.rewind,imageTarget:J.image,thumbTarget:B.image});J.load(C,function(Q){var P=h(O._layers[1-O._controls.active]).html(G.layer||"").hide();O._scaleImage(Q,{complete:function(R){if("image" in H){b.toggleQuality(H.image,false)}b.toggleQuality(R.image,false);O._queue.stalled=true;O.removePan();O.setInfo(K.index);O.setCounter(K.index);if(G.layer){P.show();if(G.link||O._options.clicknext){P.css("cursor","pointer").one("click",function(){if(G.link){h(R.image).trigger("mouseup")}else{O.$("stage").trigger("click")}})}}O.trigger({type:Galleria.LOADFINISH,cached:I,index:K.index,rewind:K.rewind,imageTarget:R.image,thumbTarget:O._thumbnails[K.index].image});var T=O._options.transition;h.each({initial:H.image===null,touch:Galleria.TOUCH,fullscreen:O.isFullscreen()},function(V,U){if(U&&O._options[V+"Transition"]!==a){T=O._options[V+"Transition"];return false}});if(T in k===false){M()}else{var S={prev:H.container,next:R.container,rewind:K.rewind,speed:O._options.transitionSpeed||400};k[T].call(O,S,M)}}})})},getNext:function(B){B=typeof B==="number"?B:this.getIndex();return B===this.getDataLength()-1?0:B+1},getPrev:function(B){B=typeof B==="number"?B:this.getIndex();return B===0?this.getDataLength()-1:B-1},next:function(){if(this.getDataLength()>1){this.show(this.getNext(),false)}return this},prev:function(){if(this.getDataLength()>1){this.show(this.getPrev(),true)}return this},get:function(B){return B in this._dom?this._dom[B]:null},getData:function(B){return B in this._data?this._data[B]:this._data[this._active]},getDataLength:function(){return this._data.length},getIndex:function(){return typeof this._active==="number"?this._active:false},getStageHeight:function(){return this._stageHeight},getStageWidth:function(){return this._stageWidth},getOptions:function(B){return typeof B==="undefined"?this._options:this._options[B]},setOptions:function(B,C){if(typeof B==="object"){h.extend(this._options,B)}else{this._options[B]=C}return this},play:function(B){this._playing=true;this._playtime=B||this._playtime;this._playCheck();this.trigger(Galleria.PLAY);return this},pause:function(){this._playing=false;this.trigger(Galleria.PAUSE);return this},playToggle:function(B){return(this._playing)?this.pause():this.play(B)},isPlaying:function(){return this._playing},isFullscreen:function(){return this._fullscreen.active},_playCheck:function(){var D=this,B=0,C=20,E=b.timestamp(),G="play"+this._id;if(this._playing){b.clearTimer(G);var F=function(){B=b.timestamp()-E;if(B>=D._playtime&&D._playing){b.clearTimer(G);D.next();return}if(D._playing){D.trigger({type:Galleria.PROGRESS,percent:Math.ceil(B/D._playtime*100),seconds:Math.floor(B/1000),milliseconds:B});b.addTimer(G,F,C)}};b.addTimer(G,F,C)}},setPlaytime:function(B){this._playtime=B;return this},setIndex:function(B){this._active=B;return this},setCounter:function(B){if(typeof B==="number"){B++}else{if(typeof B==="undefined"){B=this.getIndex()+1}}this.get("current").innerHTML=B;if(m){var D=this.$("counter"),C=D.css("opacity");if(parseInt(C,10)===1){b.removeAlpha(D[0])}else{this.$("counter").css("opacity",C)}}return this},setInfo:function(C){var B=this,D=this.getData(C);h.each(["title","description"],function(E,F){var G=B.$("info-"+F);if(!!D[F]){G[D[F].length?"show":"hide"]().html(D[F])}else{G.empty().hide()}});return this},hasInfo:function(C){var B="title description".split(" "),D;for(D=0;B[D];D++){if(!!this.getData(C)[B[D]]){return true}}return false},jQuery:function(E){var B=this,C=[];h.each(E.split(","),function(F,G){G=h.trim(G);if(B.get(G)){C.push(G)}});var D=h(B.get(C.shift()));h.each(C,function(F,G){D=D.add(B.get(G))});return D},$:function(B){return this.jQuery.apply(this,b.array(arguments))}};h.each(r,function(B,D){var C=/_/.test(D)?D.replace(/_/g,""):D;Galleria[D.toUpperCase()]="galleria."+C});h.extend(Galleria,{IE9:m===9,IE8:m===8,IE7:m===7,IE6:m===6,IE:m,WEBKIT:/webkit/.test(p),SAFARI:/safari/.test(p),CHROME:/chrome/.test(p),QUIRK:(m&&A.compatMode&&A.compatMode==="BackCompat"),MAC:/mac/.test(navigator.platform.toLowerCase()),OPERA:!!d.opera,IPHONE:/iphone/.test(p),IPAD:/ipad/.test(p),ANDROID:/android/.test(p),TOUCH:("ontouchstart" in A)});Galleria.addTheme=function(D){if(!D.name){Galleria.raise("No theme name specified")}if(typeof D.defaults!=="object"){D.defaults={}}else{D.defaults=v(D.defaults)}var B=false,C;if(typeof D.css==="string"){h("link").each(function(E,F){C=new RegExp(D.css);if(C.test(F.href)){B=true;f(D);return false}});if(!B){h("script").each(function(E,F){C=new RegExp("galleria\\."+D.name.toLowerCase()+"\\.");if(C.test(F.src)){B=F.src.replace(/[^\/]*$/,"")+D.css;b.addTimer("css",function(){b.loadCSS(B,"galleria-theme",function(){f(D)})},1)}})}if(!B){Galleria.raise("No theme CSS loaded")}}else{f(D)}return D};Galleria.loadTheme=function(F,D){var C=false,B=c.length,E=d.setTimeout(function(){Galleria.raise("Theme at "+F+" could not load, check theme path.",true)},5000);Galleria.theme=a;b.loadScript(F,function(){d.clearTimeout(E);if(B){var G=[];h.each(Galleria.get(),function(I,H){var K=h.extend(H._original.options,{data_source:H._data},D);H.$("container").remove();var J=new Galleria();J._id=H._id;J.init(H._original.target,K);G.push(J)});c=G}})};Galleria.get=function(B){if(!!z[B]){return z[B]}else{if(typeof B!=="number"){return z}else{Galleria.raise("Gallery index "+B+" not found")}}};Galleria.addTransition=function(B,C){k[B]=C};Galleria.utils=b;Galleria.log=(function(){if("console" in d&&"log" in d.console){return d.console.log}else{return function(){d.alert(b.array(arguments).join(", "))}}}());Galleria.ready=function(B){h.each(c,function(C,D){B.call(D,D._options)});Galleria.ready.callbacks.push(B)};Galleria.ready.callbacks=[];Galleria.raise=function(F,E){var D=E?"Fatal error":"Error",C=this,B=function(H){var G='<div style="padding:4px;margin:0 0 2px;background:#'+(E?"811":"222")+'";>'+(E?"<strong>"+D+": </strong>":"")+H+"</div>";h.each(z,function(){var I=this.$("errors"),J=this.$("target");if(!I.length){J.css("position","relative");I=this.addElement("errors").appendChild("target","errors").$("errors").css({color:"#fff",position:"absolute",top:0,left:0,zIndex:100000})}I.append(G)})};if(e){B(F);if(E){throw new Error(D+": "+F)}}else{if(E){if(o){return}o=true;E=false;B("Image gallery could not load.")}}};Galleria.version=x;Galleria.requires=function(B,C){C=C||"You need to upgrade Galleria to version "+B+" to use one or more components.";if(Galleria.version<B){Galleria.raise(C,true)}};Galleria.Picture=function(B){this.id=B||null;this.image=null;this.container=b.create("galleria-image");h(this.container).css({overflow:"hidden",position:"relative"});this.original={width:0,height:0};this.ready=false;this.tid=null};Galleria.Picture.prototype={cache:{},show:function(){b.show(this.image)},hide:function(){b.moveOut(this.image)},clear:function(){this.image=null},isCached:function(B){return !!this.cache[B]},preload:function(B){h(new Image()).load((function(D,C){return function(){C[D]=D}}(B,this.cache))).attr("src",B)},load:function(G,E){this.tid=d.setTimeout((function(I){return function(){Galleria.raise("Image not loaded in "+Math.round(s/1000)+" seconds: "+I)}}(G)),s);this.image=new Image();var C=0,B=false,F=h(this.container),D=h(this.image),H=(function(I,J,K){return function(){var L=function(){h(this).unbind("load");I.original={height:this.height,width:this.width};I.cache[K]=K;d.clearTimeout(I.tid);if(typeof J=="function"){d.setTimeout(function(){J.call(I,I)},1)}};if((!this.width||!this.height)){d.setTimeout((function(M){return function(){if(M.width&&M.height){L.call(M)}else{Galleria.raise("Could not extract width/height from image: "+M.src+". Traced measures: width:"+M.width+"px, height: "+M.height+"px.")}}}(this)),2)}else{L.call(this)}}}(this,E,G));F.find("img").remove();D.css("display","block").appendTo(this.container);b.hide(this.image);if(this.cache[G]){this.image.src=G;H.call(this.image);return this.container}h(this.image).load(H).error(function(){if(!B){B=true;d.setTimeout((function(I,J){return function(){I.attr("src",J+"?"+b.timestamp())}}(h(this),G)),50)}else{if(t){h(this).attr("src",t)}else{Galleria.raise("Image not found: "+G)}}}).attr("src",G);return this.container},scale:function(C){C=h.extend({width:0,height:0,min:a,max:a,margin:0,complete:function(){},position:"center",crop:false,canvas:false},C);if(!this.image){return this.container}var D,F,B=this,G=h(B.container),E;b.wait({until:function(){D=C.width||G.width()||b.parseValue(G.css("width"));F=C.height||G.height()||b.parseValue(G.css("height"));return D&&F},success:function(){var H=(D-C.margin*2)/B.original.width,J=(F-C.margin*2)/B.original.height,P={"true":Math.max(H,J),width:H,height:J,"false":Math.min(H,J)},I=P[C.crop.toString()],N="";if(C.max){I=Math.min(C.max,I)}if(C.min){I=Math.max(C.min,I)}h.each(["width","height"],function(R,Q){h(B.image)[Q](B[Q]=B.image[Q]=Math.round(B.original[Q]*I))});h(B.container).width(D).height(F);if(C.canvas&&u){u.elem.width=B.width;u.elem.height=B.height;N=B.image.src+":"+B.width+"x"+B.height;B.image.src=u.cache[N]||(function(Q){u.context.drawImage(B.image,0,0,B.original.width*I,B.original.height*I);try{E=u.elem.toDataURL();u.length+=E.length;u.cache[Q]=E;return E}catch(R){return B.image.src}}(N))}var L={},O={},M=function(U,S,R){var T=0;if(/\%/.test(U)){var V=parseInt(U,10)/100,Q=B.image[S]||h(B.image)[S]();T=Math.ceil(Q*-1*V+R*V)}else{T=b.parseValue(U)}return T},K={top:{top:0},left:{left:0},right:{left:"100%"},bottom:{top:"100%"}};h.each(C.position.toLowerCase().split(" "),function(Q,R){if(R==="center"){R="50%"}L[Q?"top":"left"]=R});h.each(L,function(Q,R){if(K.hasOwnProperty(R)){h.extend(O,K[R])}});L=L.top?h.extend(L,O):O;L=h.extend({top:"50%",left:"50%"},L);h(B.image).css({position:"absolute",top:M(L.top,"height",F),left:M(L.left,"width",D)});B.show();B.ready=true;C.complete.call(B,B)},error:function(){Galleria.raise("Could not scale image: "+B.image.src)},timeout:1000});return this}};h.extend(h.easing,{galleria:function(C,D,B,F,E){if((D/=E/2)<1){return F/2*D*D*D+B}return F/2*((D-=2)*D*D+2)+B},galleriaIn:function(C,D,B,F,E){return F*(D/=E)*D+B},galleriaOut:function(C,D,B,F,E){return -F*(D/=E)*(D-2)+B}});h.fn.galleria=function(B){return this.each(function(){h(this).data("galleria",new Galleria().init(this,B))})}}(jQuery));
