/*
 * jQuery BBQ: Back Button & Query Library - v1.2.1 - 2/17/2010
 * http://benalman.com/projects/jquery-bbq-plugin/
 * 
 * Copyright (c) 2010 "Cowboy" Ben Alman
 * Dual licensed under the MIT and GPL licenses.
 * http://benalman.com/about/license/
 */
(function($,p){var i,m=Array.prototype.slice,r=decodeURIComponent,a=$.param,c,l,v,b=$.bbq=$.bbq||{},q,u,j,e=$.event.special,d="hashchange",A="querystring",D="fragment",y="elemUrlAttr",g="location",k="href",t="src",x=/^.*\?|#.*$/g,w=/^.*\#/,h,C={};function E(F){return typeof F==="string"}function B(G){var F=m.call(arguments,1);return function(){return G.apply(this,F.concat(m.call(arguments)))}}function n(F){return F.replace(/^[^#]*#?(.*)$/,"$1")}function o(F){return F.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}function f(H,M,F,I,G){var O,L,K,N,J;if(I!==i){K=F.match(H?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);J=K[3]||"";if(G===2&&E(I)){L=I.replace(H?w:x,"")}else{N=l(K[2]);I=E(I)?l[H?D:A](I):I;L=G===2?I:G===1?$.extend({},I,N):$.extend({},N,I);L=a(L);if(H){L=L.replace(h,r)}}O=K[1]+(H?"#":L||!K[1]?"?":"")+L+J}else{O=M(F!==i?F:p[g][k])}return O}a[A]=B(f,0,o);a[D]=c=B(f,1,n);c.noEscape=function(G){G=G||"";var F=$.map(G.split(""),encodeURIComponent);h=new RegExp(F.join("|"),"g")};c.noEscape(",/");$.deparam=l=function(I,F){var H={},G={"true":!0,"false":!1,"null":null};$.each(I.replace(/\+/g," ").split("&"),function(L,Q){var K=Q.split("="),P=r(K[0]),J,O=H,M=0,R=P.split("]["),N=R.length-1;if(/\[/.test(R[0])&&/\]$/.test(R[N])){R[N]=R[N].replace(/\]$/,"");R=R.shift().split("[").concat(R);N=R.length-1}else{N=0}if(K.length===2){J=r(K[1]);if(F){J=J&&!isNaN(J)?+J:J==="undefined"?i:G[J]!==i?G[J]:J}if(N){for(;M<=N;M++){P=R[M]===""?O.length:R[M];O=O[P]=M<N?O[P]||(R[M+1]&&isNaN(R[M+1])?{}:[]):J}}else{if($.isArray(H[P])){H[P].push(J)}else{if(H[P]!==i){H[P]=[H[P],J]}else{H[P]=J}}}}else{if(P){H[P]=F?i:""}}});return H};function z(H,F,G){if(F===i||typeof F==="boolean"){G=F;F=a[H?D:A]()}else{F=E(F)?F.replace(H?w:x,""):F}return l(F,G)}l[A]=B(z,0);l[D]=v=B(z,1);$[y]||($[y]=function(F){return $.extend(C,F)})({a:k,base:k,iframe:t,img:t,input:t,form:"action",link:k,script:t});j=$[y];function s(I,G,H,F){if(!E(H)&&typeof H!=="object"){F=H;H=G;G=i}return this.each(function(){var L=$(this),J=G||j()[(this.nodeName||"").toLowerCase()]||"",K=J&&L.attr(J)||"";L.attr(J,a[I](K,H,F))})}$.fn[A]=B(s,A);$.fn[D]=B(s,D);b.pushState=q=function(I,F){if(E(I)&&/^#/.test(I)&&F===i){F=2}var H=I!==i,G=c(p[g][k],H?I:{},H?F:2);p[g][k]=G+(/#/.test(G)?"":"#")};b.getState=u=function(F,G){return F===i||typeof F==="boolean"?v(F):v(G)[F]};b.removeState=function(F){var G={};if(F!==i){G=u();$.each($.isArray(F)?F:arguments,function(I,H){delete G[H]})}q(G,2)};e[d]=$.extend(e[d],{add:function(F){var H;function G(J){var I=J[D]=c();J.getState=function(K,L){return K===i||typeof K==="boolean"?l(I,K):l(I,L)[K]};H.apply(this,arguments)}if($.isFunction(F)){H=F;return G}else{H=F.handler;F.handler=G}}})})(jQuery,this);
/*
 * jQuery hashchange event - v1.2 - 2/11/2010
 * http://benalman.com/projects/jquery-hashchange-plugin/
 * 
 * Copyright (c) 2010 "Cowboy" Ben Alman
 * Dual licensed under the MIT and GPL licenses.
 * http://benalman.com/about/license/
 */
(function($,i,b){var j,k=$.event.special,c="location",d="hashchange",l="href",f=$.browser,g=document.documentMode,h=f.msie&&(g===b||g<8),e="on"+d in i&&!h;function a(m){m=m||i[c][l];return m.replace(/^[^#]*#?(.*)$/,"$1")}$[d+"Delay"]=100;k[d]=$.extend(k[d],{setup:function(){if(e){return false}$(j.start)},teardown:function(){if(e){return false}$(j.stop)}});j=(function(){var m={},r,n,o,q;function p(){o=q=function(s){return s};if(h){n=$('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow;q=function(){return a(n.document[c][l])};o=function(u,s){if(u!==s){var t=n.document;t.open().close();t[c].hash="#"+u}};o(a())}}m.start=function(){if(r){return}var t=a();o||p();(function s(){var v=a(),u=q(t);if(v!==t){o(t=v,u);$(i).trigger(d)}else{if(u!==t){i[c][l]=i[c][l].replace(/#.*/,"")+"#"+u}}r=setTimeout(s,$[d+"Delay"])})()};m.stop=function(){if(!n){r&&clearTimeout(r);r=0}};return m})()})(jQuery,this);
/*
 Galleria v 1.2.5 2011-08-03
 http://galleria.aino.se

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

 Copyright 2011, Aino
 Licensed under the MIT license.
*/
Galleria.requires(1.25,"The Picasa Plugin requires Galleria version 1.2.5 or later.");(function(a){var b=Galleria.utils.getScriptPath();Galleria.Picasa=function(){this.options={max:30,imageSize:"medium",thumbSize:"thumb",description:!1,complete:function(){}}};Galleria.Picasa.prototype={constructor:Galleria.Picasa,search:function(a,b){return this._call("search","all",{q:a},b)},user:function(a,b){return this._call("user","user/"+a,b)},useralbum:function(a,b,c){return this._call("useralbum","user/"+a+"/album/"+b,c)},setOptions:function(b){a.extend(this.options,b);return this},_call:function(b,c,d,e){c="https://picasaweb.google.com/data/feed/api/"+c+"?";typeof d=="function"&&(e=d,d={});var g=this,d=a.extend({kind:"photo",access:"public","max-results":this.options.max,thumbsize:this._getSizes().join(","),alt:"json-in-script",callback:"?"},d);a.each(d,function(a,b){c+="&"+a+"="+b});var h=!1;Galleria.utils.wait({until:function(){return h},success:function(){g._parse.call(g,h.feed.entry,e)},error:function(){var a="";b=="user"?a="user not found.":b=="useralbum"&&(a="album or user not found.");Galleria.raise("Picasa request failed"+(a?": "+a:"."))},timeout:5e3});a.getJSON(c,function(a){h=a});return g},_getSizes:function(){var b={small:"72c",thumb:"104u",medium:"640u",big:"1024u",original:"1600u"},c=this.options,d={},e,g=[32,48,64,72,94,104,110,128,144,150,160,200,220,288,320,400,512,576,640,720,800,912,1024,1152,1280,1440,1600];a(["thumbSize","imageSize"]).each(function(){c[this]in b?d[this]=b[c[this]]:(e=Galleria.utils.parseValue(c[this]),e>1600?e=1600:a.each(g,function(a){if(e<this)return e=g[a-1],!1}),d[this]=e)});return[d.thumbSize,d.imageSize,"1280u"]},_parse:function(b,c){var d=this,e=[],g;a.each(b,function(){g=this.media$group.media$thumbnail;e.push({thumb:g[0].url,image:g[1].url,big:g[2].url,title:this.title.$t,description:d.options.description?this.summary.$t:""})});c.call(this,e)}};var c=Galleria.prototype.load;Galleria.prototype.load=function(){if(arguments.length||typeof this._options.picasa!=="string")c.apply(this,Galleria.utils.array(arguments));else{var d=this,e=Galleria.utils.array(arguments),g=this._options.picasa.split(":"),j,k=a.extend({},d._options.picasaOptions),l=typeof k.loader!=="undefined"?k.loader:a("<div>").css({width:48,height:48,opacity:.7,background:"#000 url("+b+"loader.gif) no-repeat 50% 50%"});if(g.length){if(typeof Galleria.Picasa.prototype[g[0]]!=="function")return Galleria.raise(g[0]+" method not found in Picasa plugin"),c.apply(this,e);if(!g[1])return Galleria.raise("No picasa argument found"),c.apply(this,e);window.setTimeout(function(){d.$("target").append(l)},100);j=new Galleria.Picasa;typeof d._options.picasaOptions==="object"&&j.setOptions(d._options.picasaOptions);e=[];if(g[0]=="useralbum"){if(e=g[1].split("/"),e.length!=2){Galleria.raise("Picasa useralbum not correctly formatted (should be [user]/[album])");return}}else e.push(g[1]);e.push(function(a){d._data=a;l.remove();d.trigger(Galleria.DATA);j.options.complete.call(j,a)});j[g[0]].apply(j,e)}else c.apply(this,e)}}})(jQuery)
/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 */
jQuery.easing['jswing']=jQuery.easing['swing'];jQuery.extend(jQuery.easing,{def:'easeOutQuad',swing:function(x,t,b,c,d){return jQuery.easing[jQuery.easing.def](x,t,b,c,d)},easeInQuad:function(x,t,b,c,d){return c*(t/=d)*t+b},easeOutQuad:function(x,t,b,c,d){return-c*(t/=d)*(t-2)+b},easeInOutQuad:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b},easeInCubic:function(x,t,b,c,d){return c*(t/=d)*t*t+b},easeOutCubic:function(x,t,b,c,d){return c*((t=t/d-1)*t*t+1)+b},easeInOutCubic:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t+b;return c/2*((t-=2)*t*t+2)+b},easeInQuart:function(x,t,b,c,d){return c*(t/=d)*t*t*t+b},easeOutQuart:function(x,t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b},easeInOutQuart:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b},easeInQuint:function(x,t,b,c,d){return c*(t/=d)*t*t*t*t+b},easeOutQuint:function(x,t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b},easeInOutQuint:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b},easeInSine:function(x,t,b,c,d){return-c*Math.cos(t/d*(Math.PI/2))+c+b},easeOutSine:function(x,t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b},easeInOutSine:function(x,t,b,c,d){return-c/2*(Math.cos(Math.PI*t/d)-1)+b},easeInExpo:function(x,t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b},easeOutExpo:function(x,t,b,c,d){return(t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b},easeInOutExpo:function(x,t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b},easeInCirc:function(x,t,b,c,d){return-c*(Math.sqrt(1-(t/=d)*t)-1)+b},easeOutCirc:function(x,t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b},easeInOutCirc:function(x,t,b,c,d){if((t/=d/2)<1)return-c/2*(Math.sqrt(1-t*t)-1)+b;return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b},easeInElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b},easeOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b},easeInOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*(.3*1.5);if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b},easeInBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b},easeOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},easeInOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b},easeInBounce:function(x,t,b,c,d){return c-jQuery.easing.easeOutBounce(x,d-t,0,c,d)+b},easeOutBounce:function(x,t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b}},easeInOutBounce:function(x,t,b,c,d){if(t<d/2)return jQuery.easing.easeInBounce(x,t*2,0,c,d)*.5+b;return jQuery.easing.easeOutBounce(x,t*2-d,0,c,d)*.5+c*.5+b}});
/*
 * Agile Carousel v alpha 1.1
 * http://agilecarousel.com/
 * Copyright 2011, Ed Talmadge
 * Dual licensed under the MIT or GPL Version 2 licenses.
 */
(function(e){e.fn.agile_carousel=function(a){a=e.extend({timer:0,continuous_scrolling:!1,transition_type:"slide",transition_time:600,number_slides_visible:1,change_on_hover:"",control_set_1:"",control_set_2:"",control_set_3:"",control_set_4:"",control_set_5:""},a);return this.each(function(){function w(a){if(ba!==""){m="ac_click";var c=ba.split(",");e.inArray(a,c)!=-1&&(m="ac_hover")}return m}function ca(a){if(da===!1&&b<2){if(a==1){if(G>0)q.addClass("ac_disabled"),q.data("options").disabled=!0;if(H>0)r.addClass("ac_disabled"),r.data("options").disabled=!0}else{if(G>0)q.removeClass("ac_disabled"),q.data("options").disabled=!1;if(H>0)r.removeClass("ac_disabled"),r.data("options").disabled=!1}if(a==d){if(I>0)s.addClass("ac_disabled"),s.data("options").disabled=!0;if(J>0)u.addClass("ac_disabled"),u.data("options").disabled=!0}else{if(I>0)s.removeClass("ac_disabled"),s.data("options").disabled=!1;if(J>0)u.removeClass("ac_disabled"),u.data("options").disabled=!1}}if(da===!1&&b>1){if(a<=b){if(G>0)q.addClass("ac_disabled"),q.data("options").disabled=!0;if(H>0)r.addClass("ac_disabled"),r.data("options").disabled=!0}else{if(G>0)q.removeClass("ac_disabled"),q.data("options").disabled=!1;if(H>0)r.removeClass("ac_disabled"),r.data("options").disabled=!1}if(a>=d-b+R){if(I>0)s.addClass("ac_disabled"),s.data("options").disabled=!0;if(J>0)u.addClass("ac_disabled"),u.data("options").disabled=!0}else{if(I>0)s.removeClass("ac_disabled"),s.data("options").disabled=!1;if(J>0)u.removeClass("ac_disabled"),u.data("options").disabled=!1}}}function S(a){g.find(".ac_selected").removeClass("ac_selected");g.find(".slide_number_"+a).addClass("ac_selected")}function z(a){K=e(a)[0];if(K.disabled!==!0){j=K.button_action;a=K.go_to;f!==!1&&(h=f);T=h-1;A=e(B).eq(T);b<2&&(j=="next"&&h<d?f=h+1:j=="next"&&h==d&&(f=1),j=="previous"&&h>1?f=h-1:j=="previous"&&h==1&&(f=d));if(b>1)if(j=="next"&&h<d-b+R?f=D[Math.ceil(h/b)]:j=="next"&&h>=d-b+R&&b>1&&(f=1),j=="previous"&&h>b&&b>1){var c=Math.floor(h/b);c-=1;f=D[c]}else j=="previous"&&h<=b&&b>1&&(f=pa);j=="direct"&&(f=a);U=f-1;y=e(B).eq(U);S(f);ea>0&&V.html(f);if(U!=T){W=="slide"&&b>1&&E.stop().animate({left:(f*n-n)*-1+"px"},{duration:L});if(W=="slide"&&b==1){a="";if(j=="next"||f>h&&j=="direct")y.css({top:0,left:n}),a=n*-1;if(j=="previous"||f<h&&j=="direct")y.css({top:0,left:n*-1}),a=n;A.stop().animate({left:a+"px"},{duration:L,complete:qa});y.stop().animate({left:"0px"},{duration:L})}W=="fade"&&b==1&&(B.not(A,y).css({top:"-5000px",left:0,"z-index":0,opacity:0}),j&&(y.css({top:0,left:0,"z-index":20}),A.css({"z-index":10,opacity:1})),y.stop().animate({opacity:1},{duration:L,complete:ra}))}}ca(f);S(f)}function X(){if(v.length>0)v.html("play"),v.data("options").paused=!0,v.addClass("play_button");clearInterval(F)}function fa(){z(Y)}var d=0,x="",M="",N="",O="",P="",ga="",ha="",ia="",ja="",ka="",la="",ma="",m="ac_click",K="",j="",h="",f=!1,T="",U="",A="",y="",da=a.continuous_scrolling,Q=a.carousel_outer_width,sa=a.carousel_outer_height,o=a.carousel_data,ba=a.change_on_hover,n=a.slide_width,na=a.slide_height,p=a.control_set_1,Z=a.control_set_2,ta=a.control_set_3,ua=a.control_set_4,va=a.control_set_5,wa=a.no_control_set,oa=a.persistent_content,b=a.number_slides_visible,W=a.transition_type,L=a.transition_time,$=a.timer,C="",k="",l=k="",Y="",F="";e.each(o,function(){d++});for(var R=d%b,D=[],C="",i=0,c=0,c=0;c<d;c++)c===0&&(N+="<div class='group_numbered_buttons_container button_container'>"),k=Math.floor((c+1)/b)*b+1,k!==C&&k<=d&&(D[i]=k,N+="<div class='slide_number_"+k+" group_numbered_button slide_button "+w("group_numbered_buttons")+'\' data-options=\'{"button_type":"group_numbered_button","button_action":"direct","go_to":'+k+', "trigger_type":"'+m+'","disabled": false}\'>'+(i+1)+"</div>",C=k,i++),c===d-1&&(N+="</div>");ga+='<span class=\'pause_button slide_button pause\' data-options=\'{"button_type":"pause_button","trigger_type": "none","disabled": false,"paused": false}\'>Pause</span>';ha+="<span class='previous_next_button previous_button slide_button "+w("previous_button")+'\' data-options=\'{"button_type":"previous_button","button_action":"previous","trigger_type": "'+m+'","disabled": false}\'>Prev</span>';ia+="<span class='previous_next_button next_button slide_button "+w("next_button")+'\' data-options=\'{"button_type":"next_button","button_action":"next","trigger_type": "'+m+'","disabled": false}\'>Next</span>';ja+="<div class='hover_previous_next_button hover_previous_button slide_button "+w("hover_previous_button")+'\' data-options=\'{"button_type":"hover_previous_button","button_action":"previous","trigger_type": "'+m+"\",\"disabled\": false}'><span style='opacity: 0;' class='hover_previous_next_button_inner'>Prev</span></div>";ka+="<div class='hover_previous_next_button hover_next_button slide_button "+w("hover_next_button")+'\' data-options=\'{"button_type":"hover_next_button","button_action":"next","trigger_type": "'+m+"\",\"disabled\": false}'><span style='opacity: 0;' class='hover_previous_next_button_inner'>Next</span></div>";la+="<span class='slide_count'>"+d+"</span>";ma+="<span class='current_slide_number'>1</span>";x+="<div class='agile_carousel' style='overflow: hidden; position: relative; width: "+Q+"px; height: "+sa+"px;'>";var g=e(this),c=1,aa;for(aa in o)if(o.hasOwnProperty(aa))k=o[aa],C=k.content,Q=k.thumbnail_button,k=k.content_button,c===1&&(x+="<div class='slides' style='width: "+n*d+"px; height: "+na+"px;'>"),C&&(x+="<div class='slide_"+c+" slide' style='border: none; margin: 0; padding: 0; height: "+na+"px; width: "+n+"px;'>"+C+"</div>"),c===d&&(x+="</div>"),c==1&&(M+="<div class='numbered_buttons_container  button_container'>"),M+="<div class='slide_number_"+c+" numbered_button slide_button "+w("numbered_buttons")+'\' data-options=\'{"button_type":"numbered_button","button_action":"direct","go_to":'+c+', "trigger_type":"'+m+'","disabled": false}\'>'+c+"</div>",c==d&&(M+="</div>"),Q&&(c==1&&(O+="<div class='thumbnail_buttons_container  button_container'>"),O+="<div class='slide_number_"+c+" thumbnail_button slide_button "+w("thumbnails")+'\'  data-options=\'{"button_type":"thumbnail_button","button_action":"direct","go_to":'+c+',"trigger_type": "'+m+'","disabled": false}\'>'+Q+"</div>",c==d&&(O+="</div>")),k&&(c==1&&(P+="<div class='content_buttons_container  button_container'>"),P+="<div class='slide_number_"+c+" content_button_"+c+" content_button slide_button "+w("content_buttons")+'\' data-options=\'{"button_type":"content_button","button_action":"direct","go_to":'+c+',"trigger_type": "'+m+"\",\"disabled\": false}'><div class='content_button_inner'>"+k+"</div></div>",c==d&&(P+="</div>")),c++;o=function(a,c){var b="";if(a!==""){c&&(b+="<div class='control_set_"+c+" control_set'><div class='control_set_"+c+"_inner control_set_inner'>");var d=a.split(",");for(i=0;i<d.length;i++)d[i]=="numbered_buttons"&&(b+=M),d[i]=="group_numbered_buttons"&&(b+=N),d[i]=="thumbnails"&&(b+=O),d[i]=="content_buttons"&&(b+=P),d[i]=="pause_button"&&(b+=ga),d[i]=="previous_button"&&(b+=ha),d[i]=="next_button"&&(b+=ia),d[i]=="hover_previous_button"&&(b+=ja),d[i]=="hover_next_button"&&(b+=ka),d[i]=="slide_count"&&(b+=la),d[i]=="current_slide_number"&&(b+=ma);c&&(b+="</div></div>");x+=b}};a.control_set_1&&o(p,1);a.control_set_2&&o(Z,2);a.control_set_3&&o(ta,3);a.control_set_4&&o(ua,4);a.control_set_5&&o(va,5);a.no_control_set&&o(wa);oa&&(x+=oa);x+="</div>";g.html(x);var B=g.find(".slide"),E=g.find(".slides");g.find(".slide_button");p=g.find(".agile_carousel");g.find(".previous_button, .hover_previous_button");g.find(".next_button, .hover_next_button");var q=g.find(".previous_button"),G=q.length,r=g.find(".hover_previous_button"),H=r.length,s=g.find(".next_button"),I=s.length,u=g.find(".hover_next_button"),J=u.length,V=g.find(".current_slide_number"),ea=V.length;b==1&&(B.eq(0).css({position:"absolute",top:0,left:0}),B.slice(1,d).css({position:"absolute",top:"-5000px",left:0}),E.css("width",n+"px"));if(b>1){p.css("width",b*n+"px");p=0;for(p=1;p<=d;p++)B.eq(p).css({position:"absolute",top:0,left:n*p+"px"})}var ra=function(){A.css({"z-index":10,top:-5E3})},qa=function(){A.css({position:"absolute",top:"-5000px",left:0})};ca(1);ea>0&&V.html(1);S(1);var h=1,pa=D[D.length-1],p=g.find(".ac_click"),Z=g.find(".ac_hover");$!==0&&(F=setInterval(fa,$));var v=g.find(".pause_button");e(p).click(function(){X();if(g.find(":animated").length<1)z(e(this).data().options);else if(l=e(this),l.data("options").button_action!="next"&&l.data("options").button_action!="previous")t=setInterval(function(){E.find(":animated").length<1&&(z(l.data().options),clearInterval(l.data("options").timeout))},30),l.data("options").timeout=t});e(Z).hover(function(){X();E.find(":animated").length<1?z(e(this).data().options):(l=e(this),t=setInterval(function(){E.find(":animated").length<1&&(z(l.data().options),clearInterval(l.data("options").timeout))},30),l.data("options").timeout=t)},function(){l=e(this);clearInterval(l.data("options").timeout)});Y={button_action:"next",button_type:"pause",disabled:!1,trigger_type:"ac_click"};v.click(function(){var a=e(this);a.data("options").paused===!0?(clearInterval(F),v.html("pause"),v.data("options").paused=!1,v.addClass("pause_button"),v.removeClass("play_button"),z(Y),F=setInterval(fa,$)):a.data("options").paused===!1&&(X(),clearInterval(F))});e(".hover_previous_next_button").hover(function(){e(this).find(".hover_previous_next_button_inner").stop().fadeTo("fast",0.85)},function(){e(this).find(".hover_previous_next_button_inner").stop().fadeTo("fast",0)})})}})(jQuery);
/*
 * jquery.myimgscale-0.2.min
 */
(function(a){a.fn.scaleImage=function(c){var d=a.extend({parent:false,scale:"fill",center:true,fade:0},c);return this.each(function(){var g=a(this);var h=d.parent?g.parents(d.parent):g.parent();h.css({opacity:0,overflow:"hidden"});if(h.length>0){g.removeAttr("height").removeAttr("width");if(this.complete){f(g,h)}else{g.load(function(){f(g,h)})}}});function f(h,k){var r=b(h),s=r.width,j=r.height,t=k.width(),m=k.height(),u=parseInt(h.css("borderLeftWidth"),10)+parseInt(h.css("borderRightWidth"),10),n=parseInt(h.css("borderTopWidth"),10)+parseInt(h.css("borderBottomWidth"),10),q,o,p,l,g;if(m===0||t===0){var i=e(k);t=i.width;m=i.height}u=isNaN(u)?0:u;n=isNaN(n)?0:n;q=t/s;o=m/j;if(d.scale==="fit"){p=q<o?q:o}else{if(d.scale==="fill"){p=q>o?q:o}}l=parseInt(s*p,10)-u;g=parseInt(j*p,10)-n;h.css({width:l,height:g}).attr({width:l,height:g});if(d.center){h.css("margin-left",Math.floor((t-l)/2));h.css("margin-top",Math.floor((m-g)/2))}if(d.fade>0){k.animate({opacity:1},d.fade)}else{k.css("opacity",1)}}function b(h){var g=new Image();g.src=h.attr("src");return{width:g.width,height:g.height}}function e(h){var i=h.clone().css({visibility:"hidden",display:"block",position:"absolute"});a("body").append(i);var g={width:i.width(),height:i.height()};i.remove();return g}}})(jQuery);

