text: /*!
   * NETEYE Touch-Gallery jQuery Plugin
   *
   * Copyright (c) 2010 NETEYE GmbH
   * Licensed under the MIT license
   *
   * Author: Felix Gnass [fgnass at neteye dot de]
   * Version: @{VERSION}
   */
  !function(e){function t(t,n,s){n.activity();var o=new Image;o.onload=function(){n.activity(!1),i(t,t.index(n),this,s.getSource)},o.src=e.proxy(s.getSource,n.get(0))()}function i(t,i,n,r){var l=d(x(e('<div id="galleryViewport">').css({position:"fixed",top:0,left:0,overflow:"hidden"}).transform(!1).appendTo("body"))),c=e('<div id="galleryStripe">').css({position:"absolute",height:"100%",top:0,left:-i*v()+"px"}).width(t.length*v()).transform(!1).appendTo(l);h(c,v(),i,t.length-1),e(window).bind("orientationchange.gallery",function(){d(l),c.find("img").each(o)}),t.each(function(h){var d=e("<div>").addClass("galleryPage").css({display:"block",position:"absolute",left:h*v()+"px",overflow:"hidden",height:"100%"}).width(v()).data("thumbs",t).data("thumb",e(this)).transform(!1).appendTo(c);if(h==i){var p=e(n).css({position:"absolute",display:"block"}).transform(!1);b(o(i,n,p)).appendTo(d),a(e(this),p,function(){c.addClass("ready"),u(i)}),s(l)}else{d.activity({color:"#fff"});var f=new Image,m=e.proxy(r,this)();d.one("loadImage",function(){f.src=m}),f.onload=function(){var t=e(this).css({position:"absolute",display:"block"}).transform(!1);o(h,this,t).appendTo(d.activity(!1)),d.trigger("loaded")}}})}function n(t){if(t.is(".ready")&&!t.is(".panning")){e("#galleryShade").remove();var i=t.find(".galleryPage").eq(t.data("galleryIndex"));i.data("thumbs").removeClass("open");var n=i.data("thumb");t.add(window).add(document).unbind(".gallery"),r(i.find("img"),n,function(){_(n).transform(!1),e("#galleryViewport").remove()})}}function s(t,i){var n=e('<div id="galleryShade">').css({top:0,left:0,background:"#000",opacity:0});if(k){var s=Math.max(screen.width,screen.height)*(window.devicePixelRatio||1)+Math.max(g(),m())+100;n.css({position:"absolute"}).width(s).height(s)}else n.css({position:"fixed",width:"100%",height:"100%"});n.insertBefore(t).transform(!1).transition({opacity:1},{delay:200,duration:.8,onFinish:i})}function o(t,i,n){n=n||e(i),i.naturalWidth||(i.naturalWidth=i.width,i.naturalHeight=i.height);var s=Math.min(p(),Math.min(y()/i.naturalHeight,v()/i.naturalWidth));return n.css({top:Math.round((y()-i.naturalHeight*s)/2)+"px",left:Math.round((v()-i.naturalWidth*s)/2)+"px"}).width(Math.round(i.naturalWidth*s)),n}function a(e,t,i){var n=w(t),s=w(e),o=Math.max(s.width/t.width(),s.height/t.height()),a=k?0:g(),r=k?0:m();t.transform({translate:{x:s.left-n.left-a-Math.round((n.width*o-s.width)/2),y:s.top-n.top-r-Math.round((n.height*o-s.height)/2)},scale:o}),setTimeout(function(){_(t),b(e),t.transformTransition({reset:!0,onFinish:i})},1)}function r(t,i,n){if(0===t.length||!e.fn.transition.supported)return n&&n(),void 0;var s=w(t),o=w(i),a=Math.min(s.height*o.width/o.height,s.width),r=Math.min(s.width*o.height/o.width,s.height),l=Math.max(o.width/a,o.height/r),c=e("<div>").css({overflow:"hidden",position:"absolute",width:a+"px",height:r+"px",top:m()+Math.round((y()-r)/2)+"px",left:g()+Math.round((v()-a)/2)+"px"}).appendTo("body").append(t.css({top:1-Math.floor((s.height-r)/2)+"px",left:-Math.floor((s.width-a)/2)+"px"})).transform(!1);s=w(c),c.transformTransition({translate:{x:o.left-s.left-Math.round((a*l-o.width)/2),y:o.top-s.top-Math.round((r*l-o.height)/2)},scale:l,onFinish:function(){n(),c.remove()}})}function l(t){return e("#galleryStripe .galleryPage").eq(t)}function c(e){return l(e).data("thumb")}function u(e){function t(){l(e-1).add(l(e+1)).trigger("loadImage")}var i=l(e);i.find("img").length>0?t():i.one("loaded",t)}function h(t,i,s,o){function a(n){var s=t.data("galleryIndex");if(_(c(s)),s=Math.max(0,Math.min(s+n,o)),t.data("galleryIndex",s),b(c(s)),u(s),e.fn.transform.supported){var a=-s*i-l;a!=t.transform().translate.x&&t.addClass("panning").transformTransition({translate:{x:a},onFinish:function(){this.removeClass("panning")}})}else t.css("left",-s*i+"px")}var r=p(),l=parseInt(t.css("left"),10);t.data("galleryIndex",s),e(document).bind("keydown.gallery",function(e){return 37==e.keyCode?t.trigger("prev"):39==e.keyCode&&t.trigger("next"),(27==e.keyCode||32==e.keyCode)&&t.trigger("close"),!1}),t.bind("touchstart",function(){return e(this).data("pan",{startX:event.targetTouches[0].screenX,lastX:event.targetTouches[0].screenX,startTime:(new Date).getTime(),startOffset:e(this).transform().translate.x,distance:function(){return Math.round(r*(this.startX-this.lastX))},delta:function(){var e=event.targetTouches[0].screenX;this.dir=this.lastX>e?1:-1;var t=Math.round(r*(this.lastX-e));return this.lastX=e,t},duration:function(){return(new Date).getTime()-this.startTime}}),!1}).bind("touchmove",function(){var t=e(this).data("pan");return e(this).transform({translateBy:{x:-t.delta()}}),!1}).bind("touchend",function(){var t=e(this).data("pan");return 0===t.distance()&&t.duration()<500?e(event.target).trigger("click"):a(t.dir),!1}).bind("prev",function(){a(-1)}).bind("next",function(){a(1)}).bind("click close",function(){n(t)})}function d(e){return k&&e.css({top:m()+"px",left:g()+"px"}),e.width(v()).height(y())}function p(){return v()/document.documentElement.clientWidth}function f(e,t){if(void 0!==window[e])return window[e];var i=document.documentElement;return i&&i[t]?i[t]:document.body[t]}function m(){return f("pageYOffset","scrollTop")}function g(){return f("pageXOffset","scrollLeft")}function v(){return f("innerWidth","clientWidth")}function y(){return f("innerHeight","clientHeight")}function _(e){return e.css("visibility","visible")}function b(e){return e.css("visibility","hidden")}function w(t){var i=t.get(0);return i&&i.getBoundingClientRect?i.getBoundingClientRect():e.extend({width:t.width(),height:t.height()},t.offset())}function x(e){return e.bind("touchstart",function(){return!1})}var k=/Mobile.*Safari/.test(navigator.userAgent);e.fn.touchGallery=function(i){i=e.extend({},e.fn.touchGallery.defaults,i);var n=this;return this.live("click",function(s){s.preventDefault();var o=e(this);o.is(".open")||(n.addClass("open"),t(n,o,i))}),this},e.fn.touchGallery.defaults={getSource:function(){return this.href}}}(jQuery);