(function(){var r=false,u=/xyz/.test(function(){})?/\b__super\b/:/.*/,p=function(){},l=this;p.extend=function(a){function b(){!r&&this.__constructor&&this.__constructor.apply(this,arguments)}var d=this.prototype;r=true;var g=new this;r=false;for(var c in a)if(c)g[c]=typeof a[c]=="function"&&typeof d[c]=="function"&&u.test(a[c])?function(i,e){return function(){var h=this.__super;this.__super=d[i];var j=e.apply(this,arguments);this.__super=h;return j}}(c,a[c]):a[c];b.prototype=g;b.constructor=b;b.extend=
arguments.callee;return b};p=p.extend({loop:function(a,b){var d=this;if(typeof a=="number")a=Array(a);jQuery.each(a,function(g,c){b.call(d,c,g)});return a},create:function(a,b){a=a||"div";var d=document.createElement(a);if(b)d.className=b;return d},getElements:function(a){var b={};this.loop(jQuery(a),this.proxy(function(d){this.push(d,b)}));return b},setStyle:function(a,b){jQuery(a).css(b);return this},getStyle:function(a,b,d){a=jQuery(a).css(b);return d?this.parseValue(a):a},cssText:function(a){var b=
document.createElement("style");this.getElements("head")[0].appendChild(b);if(b.styleSheet)b.styleSheet.cssText=a;else{a=document.createTextNode(a);b.appendChild(a)}return this},touch:function(a){var b=a.nextSibling,d=a.parentNode;d.removeChild(a);b?d.insertBefore(a,b):d.appendChild(a);a.styleSheet&&a.styleSheet.imports.length&&this.loop(a.styleSheet.imports,function(g){a.styleSheet.addImport(g.href)})},loadCSS:function(a,b){var d=this.getElements('link[href="'+a+'"]').length;if(d){b.call(null);return d[0]}var g=
this.create("link");g.rel="stylesheet";g.href=a;typeof b=="function"&&this.wait(function(){return!!document.body},function(){var c=this.create("div","galleria-container galleria-stage");this.moveOut(c);document.body.appendChild(c);var i=this.proxy(function(){var h="",j;if(document.defaultView&&document.defaultView.getComputedStyle){j=document.defaultView.getComputedStyle(c,"");this.loop(j,function(k){h+=k+j.getPropertyValue(k)})}else if(c.currentStyle){j=c.currentStyle;this.loop(j,function(k,m){h+=
m+k})}return h}),e=i();this.wait(function(){return i()!==e},function(){document.body.removeChild(c);b.call(g)},function(){f.raise("Could not confirm theme CSS")},2E3)});l.setTimeout(this.proxy(function(){var c=this.getElements('link[rel="stylesheet"],style');c.length?c[0].parentNode.insertBefore(g,c[0]):this.getElements("head")[0].appendChild(g);f.IE&&this.loop(c,function(i){this.touch(i)})}),2);return g},moveOut:function(a){return this.setStyle(a,{position:"absolute",left:"-10000px",display:"block"})},
moveIn:function(a){return this.setStyle(a,{left:"0"})},reveal:function(a){return jQuery(a).show()},hide:function(a){return jQuery(a).hide()},mix:function(){return jQuery.extend.apply(jQuery,arguments)},proxy:function(a,b){if(typeof a!=="function")return function(){};b=b||this;return function(){return a.apply(b,Array.prototype.slice.call(arguments))}},listen:function(a,b,d){jQuery(a).bind(b,d)},forget:function(a,b,d){jQuery(a).unbind(b,d)},dispatch:function(a,b){jQuery(a).trigger(b)},clone:function(a,
b){b=b||false;return jQuery(a).clone(b)[0]},removeAttr:function(a,b){this.loop(b.split(" "),function(d){jQuery(a).removeAttr(d)})},push:function(a,b){if(typeof b.length=="undefined")b.length=0;Array.prototype.push.call(b,a);return a},width:function(a,b){return this.meassure(a,b,"Width")},height:function(a,b){return this.meassure(a,b,"Height")},meassure:function(a,b,d){var g=jQuery(a),c=b?g["outer"+d](true):g[d.toLowerCase()]();if(f.QUIRK)this.loop(d=="Width"?["left","right"]:["top","bottom"],function(i){c+=
g.css("border-"+i+"-width").replace(/[^\d]/g,"")*1;c+=g.css("padding-"+i).replace(/[^\d]/g,"")*1});return c},toggleClass:function(a,b,d){if(typeof d!=="undefined"){d=d?"addClass":"removeClass";jQuery(a)[d](b);return this}jQuery(a).toggleClass(b);return this},hideAll:function(a){jQuery(a).find("*").hide()},animate:function(a,b){b.complete=this.proxy(b.complete);var d=jQuery(a);if(d.length){b.from&&d.css(from);d.animate(b.to,{duration:b.duration||400,complete:b.complete,easing:b.easing||"swing"})}},
wait:function(a,b,d,g){a=this.proxy(a);b=this.proxy(b);d=this.proxy(d);var c=(new Date).getTime()+(g||3E3);l.setTimeout(function(){if(a()){b();return false}if((new Date).getTime()>=c){d();b();return false}l.setTimeout(arguments.callee,2)},2);return this},loadScript:function(a,b){var d=document.createElement("script");d.src=a;d.async=true;var g=false,c=this;d.onload=d.onreadystatechange=function(){if(!g&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){g=true;typeof b=="function"&&
b.call(c,this);d.onload=d.onreadystatechange=null}};var i=document.getElementsByTagName("script")[0];i.parentNode.insertBefore(d,i);return this},parseValue:function(a){if(typeof a=="number")return a;else if(typeof a=="string")return(a=a.match(/\-?\d/g))&&a.constructor==Array?a.join("")*1:0;else return 0}});var q=p.extend({__constructor:function(a){this.image=null;this.elem=this.create("div","galleria-image");this.setStyle(this.elem,{overflow:"hidden",position:"relative"});this.order=a;this.orig={w:0,
h:0,r:1}},cache:{},ready:false,add:function(a){if(this.cache[a])return this.cache[a];var b=new Image;b.src=a;this.setStyle(b,{display:"block"});if(b.complete&&b.width)return this.cache[a]=b;b.onload=function(d){return function(){d.cache[a]=b}}(this);return b},isCached:function(a){return this.cache[a]?this.cache[a].complete:false},make:function(a){return this.clone(this.cache[a]||this.add(a))},load:function(a,b){b=this.proxy(b);this.elem.innerHTML="";this.image=this.make(a);this.moveOut(this.image);
this.elem.appendChild(this.image);this.wait(function(){return this.image.complete&&this.image.width},function(){this.orig={h:this.h||this.image.height,w:this.w||this.image.width};b({target:this.image,scope:this})},function(){f.raise("image not loaded in 20 seconds: "+a)},2E4);return this},scale:function(a){var b=this.mix({width:0,height:0,min:undefined,max:undefined,margin:0,complete:function(){},position:"center",crop:false},a);if(!this.image)return this;var d,g;this.wait(function(){d=b.width||this.width(this.elem);
g=b.height||this.height(this.elem);return d&&g},function(){var c=(d-b.margin*2)/this.orig.w,i=(g-b.margin*2)/this.orig.h;c={"true":Math.max(c,i),width:c,height:i,"false":Math.min(c,i)}[b.crop.toString()];if(b.max)c=Math.min(b.max,c);if(b.min)c=Math.max(b.min,c);this.setStyle(this.elem,{width:d,height:g});this.image.width=Math.ceil(this.orig.w*c);this.image.height=Math.ceil(this.orig.h*c);c=this.proxy(function(k,m,o){var n=0;if(/\%/.test(k)){k=parseInt(k)/100;n=Math.ceil(this.image[m]*-1*k+o*k)}else n=
parseInt(k);return n});var e={top:{top:0},left:{left:0},right:{left:"100%"},bottom:{top:"100%"}},h={},j={};this.loop(b.position.toLowerCase().split(" "),function(k,m){if(k=="center")k="50%";h[m?"top":"left"]=k});this.loop(h,function(k){if(e.hasOwnProperty(k))j=this.mix(j,e[k])});h=h.top?this.mix(h,j):j;h=this.mix({top:"50%",left:"50%"},h);this.setStyle(this.image,{position:"relative",top:c(h.top,"height",g),left:c(h.left,"width",d)});this.ready=true;b.complete.call(this)});return this}}),f=l.Galleria=
p.extend({__constructor:function(a){this.theme=undefined;this.options=a;this.playing=false;this.playtime=5E3;this.active=null;this.queue={};this.data={};this.dom={};var b=this.keyboard={keys:{UP:38,DOWN:40,LEFT:37,RIGHT:39,RETURN:13,ESCAPE:27,BACKSPACE:8},map:{},bound:false,press:this.proxy(function(e){var h=e.keyCode||e.which;b.map[h]&&typeof b.map[h]=="function"&&b.map[h].call(this,e)}),attach:this.proxy(function(e){for(var h in e){var j=h.toUpperCase();if(b.keys[j])b.map[b.keys[j]]=e[h]}if(!b.bound){b.bound=
true;this.listen(document,"keydown",b.press)}}),detach:this.proxy(function(){b.bound=false;this.forget(document,"keydown",b.press)})};this.timeouts={trunk:{},add:function(e,h,j,k){k=k||false;this.clear(e);if(k){var m=this,o=h;h=function(){o();m.add(e,h,j)}}this.trunk[e]=l.setTimeout(h,j)},clear:function(e){if(e&&this.trunk[e]){l.clearTimeout(this.trunk[e]);delete this.trunk[e]}else if(typeof e=="undefined")for(var h in this.trunk){l.clearTimeout(this.trunk[h]);delete this.trunk[h]}}};this.controls=
{0:null,1:null,active:0,swap:function(){this.active=this.active?0:1},getActive:function(){return this[this.active]},getNext:function(){return this[Math.abs(this.active-1)]}};var d=this.fullscreen={scrolled:0,enter:this.proxy(function(){this.toggleClass(this.get("container"),"fullscreen");d.scrolled=jQuery(l).scrollTop();this.loop(d.getElements(),function(h,j){d.styles[j]=h.getAttribute("style");h.removeAttribute("style")});this.setStyle(d.getElements(0),{position:"fixed",top:0,left:0,width:"100%",
height:"100%",zIndex:1E4});var e={height:"100%",overflow:"hidden",margin:0,padding:0};this.setStyle(d.getElements(1),e);this.setStyle(d.getElements(2),e);this.attachKeyboard({escape:this.exitFullscreen,right:this.next,left:this.prev});this.rescale(this.proxy(function(){this.trigger(f.FULLSCREEN_ENTER)}));this.listen(l,"resize",d.scale)}),scale:this.proxy(function(){this.rescale()}),exit:this.proxy(function(){this.toggleClass(this.get("container"),"fullscreen",false);if(d.styles.length){this.loop(d.getElements(),
function(e,h){e.removeAttribute("style");e.setAttribute("style",d.styles[h])});l.scrollTo(0,d.scrolled);this.detachKeyboard();this.rescale(this.proxy(function(){this.trigger(f.FULLSCREEN_EXIT)}));this.forget(l,"resize",d.scale)}}),styles:[],getElements:this.proxy(function(e){var h=[this.get("container"),document.body,this.getElements("html")[0]];return e?h[e]:h})},g=this.idle={trunk:[],bound:false,add:this.proxy(function(e,h,j){if(e){g.bound||g.addEvent();e=jQuery(e);var k={};for(var m in h)k[m]=
e.css(m);e.data("idle",{from:k,to:h,complete:true,busy:false,fn:this.proxy(j)});g.addTimer();g.trunk.push(e)}}),remove:this.proxy(function(e){e=jQuery(e);this.loop(g.trunk,function(h,j){if(h&&!h.not(e).length){g.show(e);g.trunk.splice(j,1)}});if(!g.trunk.length){g.removeEvent();this.clearTimer("idle")}}),addEvent:this.proxy(function(){g.bound=true;this.listen(this.get("container"),"mousemove click",g.showAll)}),removeEvent:this.proxy(function(){g.bound=false;this.forget(this.get("container"),"mousemove click",
g.showAll)}),addTimer:this.proxy(function(){this.addTimer("idle",this.proxy(function(){g.hide()}),this.options.idle_time)}),hide:this.proxy(function(){this.trigger(f.IDLE_ENTER);this.loop(g.trunk,function(e){var h=e.data("idle");h.complete=false;h.fn();e.animate(h.to,{duration:600,queue:false,easing:"swing"})})}),showAll:this.proxy(function(){this.clearTimer("idle");this.loop(g.trunk,function(e){g.show(e)})}),show:this.proxy(function(e){var h=e.data("idle");if(!h.busy&&!h.complete){h.busy=true;this.trigger(f.IDLE_EXIT);
e.animate(h.from,{duration:300,queue:false,easing:"swing",complete:function(){$(this).data("idle").busy=false;$(this).data("idle").complete=true}})}g.addTimer()})},c=this.lightbox={w:0,h:0,initialized:false,active:null,init:this.proxy(function(){if(!c.initialized){c.initialized=true;this.loop("lightbox-overlay lightbox-box lightbox-content lightbox-shadow lightbox-title lightbox-info lightbox-close lightbox-prev lightbox-next lightbox-counter".split(" "),function(e){this.addElement(e);c[e.split("-")[1]]=
this.get(e)});c.image=new Galleria.Picture;this.append({"lightbox-box":["lightbox-shadow","lightbox-content","lightbox-close"],"lightbox-info":["lightbox-title","lightbox-counter","lightbox-next","lightbox-prev"],"lightbox-content":["lightbox-info"]});document.body.appendChild(c.overlay);document.body.appendChild(c.box);c.content.appendChild(c.image.elem);c.close.innerHTML="&#215;";c.prev.innerHTML="&#9668;";c.next.innerHTML="&#9658;";this.listen(c.close,"click",c.hide);this.listen(c.overlay,"click",
c.hide);this.listen(c.next,"click",c.showNext);this.listen(c.prev,"click",c.showPrev);if(this.options.lightbox_clicknext){this.setStyle(c.image.elem,{cursor:"pointer"});this.listen(c.image.elem,"click",c.showNext)}this.setStyle(c.overlay,{position:"fixed",display:"none",opacity:this.options.overlay_opacity,top:0,left:0,width:"100%",height:"100%",background:this.options.overlay_background,zIndex:99990});this.setStyle(c.box,{position:"fixed",display:"none",width:400,height:400,top:"50%",left:"50%",
marginTop:-200,marginLeft:-200,zIndex:99991});this.setStyle(c.shadow,{background:"#000",opacity:0.4,width:"100%",height:"100%",position:"absolute"});this.setStyle(c.content,{backgroundColor:"#fff",position:"absolute",top:10,left:10,right:10,bottom:10,overflow:"hidden"});this.setStyle(c.info,{color:"#444",fontSize:"11px",fontFamily:"arial,sans-serif",height:13,lineHeight:"13px",position:"absolute",bottom:10,left:10,right:10,opacity:0});this.setStyle(c.close,{background:"#fff",height:20,width:20,position:"absolute",
textAlign:"center",cursor:"pointer",top:10,right:10,lineHeight:"22px",fontSize:"16px",fontFamily:"arial,sans-serif",color:"#444",zIndex:99999});this.setStyle(c.image.elem,{top:10,left:10,right:10,bottom:30,position:"absolute"});this.loop("title prev next counter".split(" "),function(e){var h={display:"inline","float":"left"};if(e!="title"){this.mix(h,{"float":"right"});e!="counter"?this.mix(h,{cursor:"pointer"}):this.mix(h,{marginLeft:8})}this.setStyle(c[e],h)});this.loop("prev next close".split(" "),
function(e){this.listen(c[e],"mouseover",this.proxy(function(){this.setStyle(c[e],{color:"#000"})}));this.listen(c[e],"mouseout",this.proxy(function(){this.setStyle(c[e],{color:"#444"})}))});this.trigger(f.LIGHTBOX_OPEN)}}),rescale:this.proxy(function(e){var h=Math.min(this.width(l),c.w),j=Math.min(this.height(l),c.h);j=Math.min((h-60)/c.w,(j-80)/c.h);h=c.w*j+40;j=c.h*j+60;h={width:h,height:j,marginTop:Math.ceil(j/2)*-1,marginLeft:Math.ceil(h)/2*-1};e?this.setStyle(c.box,h):this.animate(c.box,{to:h,
duration:this.options.lightbox_transition_speed,easing:"galleria",complete:function(){this.trigger({type:f.LIGHTBOX_IMAGE,imageTarget:c.image.image});this.moveIn(c.image.image);this.animate(c.image.image,{to:{opacity:1},duration:this.options.lightbox_fade_speed});this.animate(c.info,{to:{opacity:1},duration:this.options.lightbox_fade_speed})}})}),hide:this.proxy(function(){c.image.image=null;this.forget(l,"resize",c.rescale);this.hide(c.box);this.setStyle(c.info,{opacity:0});this.animate(c.overlay,
{to:{opacity:0},duration:200,complete:function(){this.hide(c.overlay);this.setStyle(c.overlay,{opacity:this.options.overlay_opacity});this.trigger(f.LIGHTBOX_CLOSE)}})}),showNext:this.proxy(function(){c.show(this.getNext(c.active))}),showPrev:this.proxy(function(){c.show(this.getPrev(c.active))}),show:this.proxy(function(e){c.initialized||c.init();this.forget(l,"resize",c.rescale);e=typeof e=="number"?e:this.getIndex();c.active=e;var h=this.getData(e),j=this.data.length;this.setStyle(c.info,{opacity:0});
c.image.load(h.image,function(k){c.w=k.scope.orig.w;c.h=k.scope.orig.h;this.setStyle(k.target,{width:"100.5%",height:"100.5%",top:0,zIndex:99998,opacity:0});c.title.innerHTML=h.title;c.counter.innerHTML=e+1+" / "+j;this.listen(l,"resize",c.rescale);c.rescale()});this.reveal(c.overlay);this.reveal(c.box)})};this.thumbnails={width:0};this.stageHeight=this.stageWidth=0;var i="container stage images image-nav image-nav-left image-nav-right info info-text info-title info-description info-author thumbnails thumbnails-list thumbnails-container thumb-nav-left thumb-nav-right loader counter";
i=i.split(" ");this.loop(i,function(e){this.dom[e]=this.create("div","galleria-"+e)});(this.target=this.dom.target=a.target.nodeName?a.target:this.getElements(a.target)[0])||f.raise("Target not found.")},init:function(){this.options=this.mix(f.theme.defaults,this.options);var a=this.options=this.mix({autoplay:false,carousel:true,carousel_follow:true,carousel_speed:400,carousel_steps:"auto",clicknext:false,data_config:function(){return{}},data_image_selector:"img",data_source:this.target,data_type:"auto",
debug:false,extend:function(){},height:"auto",idle_time:3E3,image_crop:false,image_margin:0,image_pan:false,image_pan_smoothness:12,image_position:"50%",keep_source:false,lightbox_clicknext:true,lightbox_fade_speed:200,lightbox_transition_speed:300,link_source_images:true,max_scale_ratio:undefined,min_scale_ratio:undefined,on_image:function(){},overlay_opacity:0.85,overlay_background:"#0b0b0b",popup_links:false,preload:2,queue:true,show:0,show_info:true,show_counter:true,show_imagenav:true,thumb_crop:true,
thumb_fit:true,thumb_margin:0,thumb_quality:"auto",thumbnails:true,transition:f.transitions.fade,transition_speed:400},this.options);this.bind(f.DATA,function(){this.run()});if(a.clicknext){this.loop(this.data,function(b){delete b.link});this.setStyle(this.get("stage"),{cursor:"pointer"});this.listen(this.get("stage"),"click",this.proxy(function(){this.next()}))}this.bind(f.IMAGE,function(b){a.on_image.call(this,b.imageTarget,b.thumbTarget)});this.bind(f.READY,function(){f.History&&f.History.change(this.proxy(function(b){b=
parseInt(b.value.replace(/\//,""));isNaN(b)?l.history.go(-1):this.show(b,undefined,true)}));f.theme.init.call(this,a);a.extend.call(this,a);if(/^[0-9]{1,4}$/.test(s)&&f.History)this.show(s,undefined,true);else typeof a.show=="number"&&this.show(a.show);if(a.autoplay){if(typeof a.autoplay=="number")this.playtime=a.autoplay;this.trigger(f.PLAY);this.playing=true}});this.load();return this},bind:function(a,b){this.listen(this.get("container"),a,this.proxy(b));return this},unbind:function(a){this.forget(this.get("container"),
a)},trigger:function(a){a=typeof a=="object"?this.mix(a,{scope:this}):{type:a,scope:this};this.dispatch(this.get("container"),a);return this},addIdleState:function(){this.idle.add.apply(this,arguments);return this},removeIdleState:function(){this.idle.remove.apply(this,arguments);return this},enterIdleMode:function(){this.idle.hide();return this},exitIdleMode:function(){this.idle.show();return this},addTimer:function(){this.timeouts.add.apply(this.timeouts,arguments);return this},clearTimer:function(){this.timeouts.clear.apply(this.timeouts,
arguments);return this},enterFullscreen:function(){this.fullscreen.enter.apply(this,arguments);return this},exitFullscreen:function(){this.fullscreen.exit.apply(this,arguments);return this},openLightbox:function(){this.lightbox.show.apply(this,arguments)},closeLightbox:function(){this.lightbox.hide.apply(this,arguments)},getActive:function(){return this.controls.getActive()},getActiveImage:function(){return this.getActive().image||null},run:function(){var a=this.options;this.data.length||f.raise("Data is empty.");
if(!a.keep_source&&!Galleria.IE)this.target.innerHTML="";this.loop(2,function(){var e=new q;this.setStyle(e.elem,{position:"absolute",top:0,left:0});this.setStyle(this.get("images"),{position:"relative",top:0,left:0,width:"100%",height:"100%"});this.get("images").appendChild(e.elem);this.push(e,this.controls)},this);a.carousel&&this.bind(f.THUMBNAIL,this.parseCarousel);this.build();this.target.appendChild(this.get("container"));this.loop(["info","counter","image-nav"],function(e){a["show_"+e.replace(/-/,
"")]===false&&this.moveOut(this.get(e))});for(var b=0,d=0,g=0;this.data[g];g++){var c;if(a.thumbnails===true){c=new q(g);var i=this.data[g].thumb||this.data[g].image;this.get("thumbnails").appendChild(c.elem);b=this.getStyle(c.elem,"width",true);d=this.getStyle(c.elem,"height",true);a.thumb_fit&&a.thum_crop!==true&&this.setStyle(c.elem,{width:0,height:0});c.load(i,this.proxy(function(e){var h=e.target.width;e.scope.scale({width:b,height:d,crop:a.thumb_crop,margin:a.thumb_margin,complete:this.proxy(function(){var j=
["left","top"],k=["Height","Width"];this.loop(k,function(m,o){if((!a.thumb_crop||a.thumb_crop==m.toLowerCase())&&a.thumb_fit){var n={},t=k[Math.abs(o-1)].toLowerCase();n[t]=e.target[t];this.setStyle(e.target.parentNode,n);n={};n[j[o]]=0;this.setStyle(e.target,n)}e.scope["outer"+m]=this[m.toLowerCase()](e.target.parentNode,true)});this.toggleQuality(e.target,a.thumb_quality===true||a.thumb_quality=="auto"&&h<e.target.width*3);this.trigger({type:f.THUMBNAIL,thumbTarget:e.target,thumbOrder:e.scope.order})})})}));
a.preload=="all"&&c.add(this.data[g].image)}else if(a.thumbnails=="empty"){c={elem:this.create("div","galleria-image"),image:this.create("span","img")};c.elem.appendChild(c.image);this.get("thumbnails").appendChild(c.elem)}else c={elem:false,image:false};i=this.proxy(function(e){this.pause();e.preventDefault();e=e.currentTarget.rel;this.active!==e&&this.show(e)});if(a.thumbnails!==false){c.elem.rel=g;this.listen(c.elem,"click",i)}if(a.link_source_images&&a.keep_source&&this.data[g].elem){this.data[g].elem.rel=
g;this.listen(this.data[g].elem,"click",i)}this.push(c,this.thumbnails)}this.setStyle(this.get("thumbnails"),{opacity:0});a.height&&a.height!="auto"&&this.setStyle(this.get("container"),{height:a.height});this.wait(function(){this.getStyle(this.get("container"),"height",true);this.stageWidth=this.width(this.get("stage"));this.stageHeight=this.height(this.get("stage"));if(this.stageHeight<50&&a.height=="auto"){this.setStyle(this.get("container"),{height:Math.round(this.stageWidth*9/16)});this.stageHeight=
this.height(this.get("stage"))}return this.stageHeight&&this.stageWidth},function(){this.listen(this.get("image-nav-right"),"click",this.proxy(function(e){a.clicknext&&e.stopPropagation();this.pause();this.next()}));this.listen(this.get("image-nav-left"),"click",this.proxy(function(e){a.clicknext&&e.stopPropagation();this.pause();this.prev()}));this.setStyle(this.get("thumbnails"),{opacity:1});this.trigger(f.READY)},function(){f.raise("Galleria could not load properly. Make sure stage has a height and width.")},
5E3)},mousePosition:function(a){return{x:a.pageX-this.$("stage").offset().left+jQuery(document).scrollLeft(),y:a.pageY-this.$("stage").offset().top+jQuery(document).scrollTop()}},addPan:function(a){if(this.options.image_crop!==false)if(this.options.image_crop!==false){a=a||this.controls.getActive().image;a.tagName.toUpperCase()!="IMG"&&f.raise("Could not add pan");var b=a.width/2,d=a.height/2,g=destX=this.getStyle(a,"left",true)||0,c=destY=this.getStyle(a,"top",true)||0,i=0,e=0,h=false,j=(new Date).getTime(),
k=this.proxy(function(o){if(!((new Date).getTime()-j<50)){h=true;b=this.mousePosition(o).x;d=this.mousePosition(o).y}}),m=this.proxy(function(){if(h){i=a.width-this.stageWidth;e=a.height-this.stageHeight;destX=b/this.stageWidth*i*-1;destY=d/this.stageHeight*e*-1;g+=(destX-g)/this.options.image_pan_smoothness;c+=(destY-c)/this.options.image_pan_smoothness;e>0&&this.setStyle(a,{top:Math.max(e*-1,Math.min(0,c))});i>0&&this.setStyle(a,{left:Math.max(i*-1,Math.min(0,g))})}});this.forget(this.get("stage"),
"mousemove");this.listen(this.get("stage"),"mousemove",k);this.addTimer("pan",m,30,true)}},removePan:function(){this.forget(this.get("stage"),"mousemove");this.clearTimer("pan")},parseCarousel:function(){var a=0,b=0,d=[0];this.loop(this.thumbnails,function(g,c){if(g.ready){a+=g.outerWidth||this.width(g.elem,true);d[c+1]=a;b=Math.max(b,this.height(g.elem))}});this.toggleClass(this.get("thumbnails-container"),"galleria-carousel",a>this.stageWidth);this.setStyle(this.get("thumbnails-list"),{overflow:"hidden",
position:"relative"});this.setStyle(this.get("thumbnails"),{width:a,height:b,position:"relative",overflow:"hidden"});this.carousel||this.initCarousel();this.carousel.max=a;this.carousel.hooks=d;this.carousel.width=this.width(this.get("thumbnails-list"));this.carousel.setClasses()},initCarousel:function(){var a=this.carousel={right:this.get("thumb-nav-right"),left:this.get("thumb-nav-left"),update:this.proxy(function(){this.parseCarousel()}),width:0,current:0,set:function(b){for(b=Math.max(b,0);a.hooks[b-
1]+a.width>a.max&&b>=0;)b--;a.current=b;a.animate()},hooks:[],getLast:function(b){b=b||a.current;return b-1},follow:function(b){if(b==0||b==a.hooks.length-2)a.set(b);else{for(var d=a.current;a.hooks[d]-a.hooks[a.current]<a.width&&d<=a.hooks.length;)d++;if(b-1<a.current)a.set(b-1);else b+2>d&&a.set(b-d+a.current+2)}},max:0,setClasses:this.proxy(function(){this.toggleClass(a.left,"disabled",!a.current);this.toggleClass(a.right,"disabled",a.hooks[a.current]+a.width>a.max)}),animate:this.proxy(function(){a.setClasses();
this.animate(this.get("thumbnails"),{to:{left:a.hooks[a.current]*-1},duration:this.options.carousel_speed,easing:"galleria",queue:false})})};this.listen(a.right,"click",this.proxy(function(){if(this.options.carousel_steps=="auto")for(var b=a.current;b<a.hooks.length;b++){if(a.hooks[b]-a.hooks[a.current]>a.width){a.set(b-2);break}}else a.set(a.current+this.options.carousel_steps)}));this.listen(a.left,"click",this.proxy(function(){if(this.options.carousel_steps=="auto")for(var b=a.current;b>=0;b--)if(a.hooks[a.current]-
a.hooks[b]>a.width){a.set(b+2);break}else{if(b==0){a.set(0);break}}else a.set(a.current-this.options.carousel_steps)}))},addElement:function(){this.loop(arguments,function(a){this.dom[a]=this.create("div","galleria-"+a)});return this},getDimensions:function(a){return{w:a.width,h:a.height,cw:this.stageWidth,ch:this.stageHeight,top:(this.stageHeight-a.height)/2,left:(this.stageWidth-a.width)/2}},attachKeyboard:function(a){this.keyboard.attach(a);return this},detachKeyboard:function(){this.keyboard.detach();
return this},build:function(){this.append({"info-text":["info-title","info-description","info-author"],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"]});this.current=this.create("span","current");this.current.innerHTML="-";this.get("counter").innerHTML=' / <span class="total">'+
this.data.length+"</span>";this.prependChild("counter",this.current)},appendChild:function(a,b){try{this.get(a).appendChild(this.get(b))}catch(d){}},prependChild:function(a,b){b=this.get(b)||b;try{this.get(a).insertBefore(b,this.get(a).firstChild)}catch(d){}},remove:function(){this.jQuery(Array.prototype.slice.call(arguments).join(",")).remove()},append:function(a){for(var b in a)if(a[b].constructor==Array)for(var d=0;a[b][d];d++)this.appendChild(b,a[b][d]);else this.appendChild(b,a[b]);return this},
rescale:function(a,b,d){var g=this.options;d=this.proxy(d);if(typeof a=="function"){d=this.proxy(a);a=undefined}var c=this.proxy(function(){this.stageWidth=a||this.width(this.get("stage"));this.stageHeight=b||this.height(this.get("stage"));this.controls.getActive().scale({width:this.stageWidth,height:this.stageHeight,crop:g.image_crop,max:g.max_scale_ratio,min:g.min_scale_ratio,margin:g.image_margin,position:g.image_position});this.carousel&&this.carousel.update();this.trigger(f.RESCALE);d()});f.WEBKIT&&
!a&&!b?this.addTimer("scale",c,5):c.call(this)},show:function(a,b,d){if(!(!this.options.queue&&this.queue.stalled)){b=typeof b!="undefined"?!!b:a<this.active;d=d||false;a=Math.max(0,Math.min(parseInt(a),this.data.length-1));if(!d&&f.History)f.History.value(a.toString());else{this.active=a;this.push([a,b],this.queue);this.queue.stalled||this.showImage();return this}}},showImage:function(){var a=this.options,b=this.queue[0],d=b[0],g=!!b[1];a.carousel&&this.carousel&&a.carousel_follow&&this.carousel.follow(d);
b=this.getData(d).image;var c=this.controls.getActive(),i=this.controls.getNext(),e=i.isCached(b),h=this.proxy(function(){this.queue.stalled=false;this.toggleQuality(i.image,a.image_quality);this.setStyle(c.elem,{zIndex:0});this.setStyle(i.elem,{zIndex:1});this.trigger({type:f.IMAGE,index:d,imageTarget:i.image,thumbTarget:this.thumbnails[d].image});a.image_pan&&this.addPan(i.image);this.controls.swap();this.moveOut(c.image);if(this.getData(d).link){this.setStyle(i.image,{cursor:"pointer"});this.listen(i.image,
"click",this.proxy(function(){if(a.popup_links)l.open(this.getData(d).link,"_blank");else l.location.href=this.getData(d).link}))}Array.prototype.shift.call(this.queue);this.queue.length&&this.showImage();this.playCheck()});if(typeof a.preload=="number"&&a.preload>0){var j,k=this.getNext();try{for(var m=a.preload;m>0;m--){j=new q;j.add(this.getData(k).image);k=this.getNext(k)}}catch(o){}}this.trigger({type:f.LOADSTART,cached:e,index:d,imageTarget:i.image,thumbTarget:this.thumbnails[d].image});jQuery(this.thumbnails[d].elem).addClass("active").siblings(".active").removeClass("active");
i.load(b,this.proxy(function(){i.scale({width:this.stageWidth,height:this.stageHeight,crop:a.image_crop,max:a.max_scale_ratio,min:a.min_scale_ratio,margin:a.image_margin,position:a.image_position,complete:this.proxy(function(){c.image&&this.toggleQuality(c.image,false);this.toggleQuality(i.image,false);this.trigger({type:f.LOADFINISH,cached:e,index:d,imageTarget:i.image,thumbTarget:this.thumbnails[d].image});this.queue.stalled=true;var n=f.transitions[a.transition]||a.transition;this.removePan();
this.setInfo(d);this.setCounter(d);typeof n=="function"?n.call(this,{prev:c.image,next:i.image,rewind:g,speed:a.transition_speed||400},h):h()})})}))},getNext:function(a){a=typeof a=="number"?a:this.active;return a==this.data.length-1?0:a+1},getPrev:function(a){a=typeof a=="number"?a:this.active;return a===0?this.data.length-1:a-1},next:function(){this.data.length>1&&this.show(this.getNext(),false);return this},prev:function(){this.data.length>1&&this.show(this.getPrev(),true);return this},get:function(a){return a in
this.dom?this.dom[a]:null},getData:function(a){return this.data[a]||this.data[this.active]},getIndex:function(){return typeof this.active==="number"?this.active:0},play:function(a){this.trigger(f.PLAY);this.playing=true;this.playtime=a||this.playtime;this.playCheck();return this},pause:function(){this.trigger(f.PAUSE);this.playing=false;return this},playCheck:function(){var a=0,b=(new Date).getTime();if(this.playing){this.clearTimer("play");var d=this.proxy(function(){a=(new Date).getTime()-b;if(a>=
this.playtime&&this.playing){this.clearTimer("play");this.next()}else if(this.playing){this.trigger({type:f.PROGRESS,percent:Math.ceil(a/this.playtime*100),seconds:Math.floor(a/1E3),milliseconds:a});this.addTimer("play",d,20)}});this.addTimer("play",d,20)}},setActive:function(a){this.active=a;return this},setCounter:function(a){a=a||this.active;this.current.innerHTML=a+1;return this},setInfo:function(a){var b=this.getData(a||this.active);this.loop(["title","description","author"],function(d){var g=
this.get("info-"+d);this[b[d]&&b[d].length?"reveal":"hide"](g);if(b[d])g.innerHTML=b[d]});return this},hasInfo:function(a){a=this.getData(a);for(var b="title description author".split(" "),d=0;b[d];d++)if(a[b[d]]&&a[b[d]].length)return true;return false},getDataObject:function(a){var b={image:"",thumb:"",title:"",description:"",author:"",link:""};return a?this.mix(b,a):b},jQuery:function(a){var b=[];this.loop(a.split(","),this.proxy(function(g){g=g.replace(/^\s\s*/,"").replace(/\s\s*$/,"");this.get(g)&&
b.push(g)}));var d=jQuery(this.get(b.shift()));this.loop(b,this.proxy(function(g){d=d.add(this.get(g))}));return d},$:function(a){return this.jQuery(a)},toggleQuality:function(a,b){if(!f.IE7||typeof a=="undefined"||!a)return this;if(typeof b==="undefined")b=a.style.msInterpolationMode=="nearest-neighbor";a.style.msInterpolationMode=b?"bicubic":"nearest-neighbor";return this},unload:function(){},load:function(){var a=0,b=this.options;if(b.data_type=="auto"&&typeof b.data_source=="object"&&!(b.data_source instanceof
jQuery)&&!b.data_source.tagName||b.data_type=="json"||b.data_source.constructor==Array){this.data=b.data_source;this.trigger(f.DATA)}else{var d=jQuery(b.data_source).find(b.data_image_selector),g=this.proxy(function(c){var i,e,h=c.parentNode;if(h&&h.nodeName=="A")if(h.href.match(/\.(png|gif|jpg|jpeg)/i))i=h.href;else e=h.href;return this.mix(this.getDataObject({title:c.title,thumb:c.src,image:i||c.src,description:c.alt,link:e||c.getAttribute("longdesc"),elem:c}),b.data_config(c))});this.loop(d,function(c){a++;
this.push(g(c),this.data);!b.keep_source&&!Galleria.IE&&c.parentNode.removeChild(c);a==d.length&&this.trigger(f.DATA)})}}});f.log=function(){try{console.log.apply(console,Array.prototype.slice.call(arguments))}catch(a){try{opera.postError.apply(opera,arguments)}catch(b){alert(Array.prototype.join.call(arguments," "))}}};p=navigator.userAgent.toLowerCase();var s=l.location.hash.replace(/#\//,"");f.DATA="data";f.READY="ready";f.THUMBNAIL="thumbnail";f.LOADSTART="loadstart";f.LOADFINISH="loadfinish";
f.IMAGE="image";f.THEMELOAD="themeload";f.PLAY="play";f.PAUSE="pause";f.PROGRESS="progress";f.FULLSCREEN_ENTER="fullscreen_enter";f.FULLSCREEN_EXIT="fullscreen_exit";f.IDLE_ENTER="idle_enter";f.IDLE_EXIT="idle_exit";f.RESCALE="rescale";f.LIGHTBOX_OPEN="lightbox_open";f.LIGHTBOX_CLOSE="lightbox_cloe";f.LIGHTBOX_IMAGE="lightbox_image";f.IE8=typeof XDomainRequest!=="undefined";f.IE7=!!(l.XMLHttpRequest&&document.expando);f.IE6=!l.XMLHttpRequest;f.IE=!!(f.IE6||f.IE7);f.WEBKIT=/webkit/.test(p);f.SAFARI=
/safari/.test(p);f.CHROME=/chrome/.test(p);f.QUIRK=f.IE&&document.compatMode&&document.compatMode=="BackCompat";f.MAC=/mac/.test(navigator.platform.toLowerCase());f.OPERA=!!l.opera;f.Picture=q;f.addTheme=function(a){var b={},d=f.prototype;d.loop(["name","author","version","defaults","init"],function(c){a[c]||f.raise(c+" not specified in theme.");if(c!="name"&&c!="init")b[c]=a[c]});b.init=a.init;if(a.css){var g;d.loop(d.getElements("script"),function(c){if(RegExp("galleria."+a.name.toLowerCase()+".js").test(c.src)){g=
c.src.replace(/[^\/]*$/,"")+a.css;d.loadCSS(g,function(){f.theme=b;jQuery(document).trigger(f.THEMELOAD)})}});g||f.raise("No theme CSS loaded")}return b};f.raise=function(a){if(f.debug)throw Error(a);};f.loadTheme=function(a){f.prototype.loadScript(a)};f.galleries=[];f.get=function(a){if(f.galleries[a])return f.galleries[a];else if(typeof a!=="number")return f.galleries;else f.raise("Gallery index not found")};jQuery.easing.galleria=function(a,b,d,g,c){if((b/=c/2)<1)return g/2*b*b*b*b+d;return-g/
2*((b-=2)*b*b*b-2)+d};f.transitions={add:function(a,b){if(a!=arguments.callee.name)this[a]=b},fade:function(a,b){jQuery(a.next).show().css("opacity",0).animate({opacity:1},a.speed,b);a.prev&&jQuery(a.prev).css("opacity",1).animate({opacity:0},a.speed)},flash:function(a,b){jQuery(a.next).css("opacity",0);a.prev?jQuery(a.prev).animate({opacity:0},a.speed/2,function(){jQuery(a.next).animate({opacity:1},a.speed,b)}):jQuery(a.next).animate({opacity:1},a.speed,b)},pulse:function(a,b){a.prev&&jQuery(a.prev).css("opacity",
0);jQuery(a.next).css("opacity",0).animate({opacity:1},a.speed,b)},slide:function(a,b){var d=jQuery(a.next).parent(),g=this.$("images"),c=this.stageWidth;d.css({left:c*(a.rewind?-1:1)});g.animate({left:c*(a.rewind?1:-1)},{duration:a.speed,queue:false,easing:"galleria",complete:function(){g.css("left",0);d.css("left",0);b()}})},fadeslide:function(a,b){if(a.prev)jQuery(a.prev).css({opacity:1,left:0}).animate({opacity:0,left:50*(a.rewind?1:-1)},{duration:a.speed,queue:false,easing:"swing"});jQuery(a.next).css({left:50*
(a.rewind?-1:1),opacity:0}).animate({opacity:1,left:0},{duration:a.speed,complete:b,queue:false,easing:"swing"})}};f.addTransition=function(){f.transitions.add.apply(this,arguments)};jQuery.fn.galleria=function(a){a=a||{};return this.each(function(){a.keep_source||jQuery(this).children().hide();a=f.prototype.mix(a,{target:this});var b=f.prototype.height(this)||f.prototype.getStyle(this,"height",true);if(!a.height&&b)a=f.prototype.mix({height:b},a);f.debug=!!a.debug;var d=new f(a);Galleria.galleries.push(d);
f.theme?d.init():jQuery(document).bind(f.THEMELOAD,function(){d.init()})})}})();
