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

