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