(function(n){Galleria.addTheme({name:"twelve",author:"Galleria",css:"/css/Widgets/twelve/galleria.twelve.css",defaults:{transition:"pulse",transitionSpeed:500,imageCrop:!0,thumbCrop:!0,carousel:!1,_locale:{show_thumbnails:"Show thumbnails",hide_thumbnails:"Hide thumbnails",play:"Play slideshow",pause:"Pause slideshow",enter_fullscreen:"Enter fullscreen",exit_fullscreen:"Exit fullscreen",popout_image:"Popout image",showing_image:"Showing image %s of %s"},_showFullscreen:!0,_showPopout:!0,_showProgress:!0,_showTooltip:!0},init:function(t){this.addElement("bar","fullscreen","play","popout","thumblink","s1","s2","s3","s4","progress"),this.append({stage:"progress",container:["bar","tooltip"],bar:["fullscreen","play","popout","thumblink","info","s1","s2","s3","s4"]}),this.prependChild("info","counter");var i=this,p=this.$("thumbnails-container"),s=this.$("thumblink"),e=this.$("fullscreen"),l=this.$("play"),h=this.$("popout"),o=this.$("bar"),a=this.$("progress"),w=t.transition,r=t._locale,u=!1,c=!1,f=!!t.autoplay,v=!1,y=function(){p.height(i.getStageHeight()).width(i.getStageWidth()).css("top",u?0:i.getStageHeight()+30)};y(),t._showTooltip&&i.bindTooltip({thumblink:r.show_thumbnails,fullscreen:r.enter_fullscreen,play:r.play,popout:r.popout_image,caption:function(){var n=i.getData(),t="";return n&&(n.title&&n.title.length&&(t+="<strong>"+n.title+"</strong>"),n.description&&n.description.length&&(t+="<br>"+n.description)),t},counter:function(){return r.showing_image.replace(/\%s/,i.getIndex()+1).replace(/\%s/,i.getDataLength())}}),this.bind("play",function(){f=!0,l.addClass("playing")}),this.bind("pause",function(){f=!1,l.removeClass("playing"),a.width(0)}),t._showProgress&&this.bind("progress",function(n){a.width(n.percent/100*this.getStageWidth())}),this.bind("loadstart",function(n){n.cached||this.$("loader").show()}),this.bind("loadfinish",function(){a.width(0),this.$("loader").hide(),this.refreshTooltip("counter","caption")}),this.bind("thumbnail",function(t){n(t.thumbTarget).hover(function(){i.setInfo(t.thumbOrder),i.setCounter(t.thumbOrder)},function(){i.setInfo(),i.setCounter()}).click(function(){s.click()})}),this.bind("fullscreen_enter",function(){c=!0,i.setOptions("transition","none"),e.addClass("open"),o.css("bottom",0),this.defineTooltip("fullscreen",r.exit_fullscreen),this.addIdleState(o,{bottom:-31})}),this.bind("fullscreen_exit",function(){c=!1,Galleria.utils.clearTimer("bar"),i.setOptions("transition",w),e.removeClass("open"),o.css("bottom",0),this.defineTooltip("fullscreen",r.enter_fullscreen),this.removeIdleState(o,{bottom:-31})}),this.bind("rescale",y),this.addIdleState(this.get("image-nav-left"),{left:-36}),this.addIdleState(this.get("image-nav-right"),{right:-36}),s.click(function(){u&&v?i.play():(v=f,i.pause()),p.animate({top:u?i.getStageHeight()+30:0},{easing:"galleria",duration:400,complete:function(){i.defineTooltip("thumblink",u?r.show_thumbnails:r.hide_thumbnails),s[u?"removeClass":"addClass"]("open"),u=!u}})}),t._showPopout?h.click(function(n){i.openLightbox(),n.preventDefault()}):(h.remove(),t._showFullscreen&&(this.$("s4").remove(),this.$("info").css("right",40),e.css("right",0))),l.click(function(){i.defineTooltip("play",f?r.play:r.pause),f?i.pause():(u&&s.click(),i.play())}),t._showFullscreen?e.click(function(){c?i.exitFullscreen():i.enterFullscreen()}):(e.remove(),t._show_popout&&(this.$("s4").remove(),this.$("info").css("right",40),h.css("right",0))),t._showFullscreen||t._showPopout||(this.$("s3,s4").remove(),this.$("info").css("right",10)),t.autoplay&&this.trigger("play")}})})($cjq)