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