text: /*
  Ascensor.js 
  version: 1.8.21 (2015-03-28)
  description: Ascensor is a jquery plugin which aims to train and adapt content according to an elevator system
  repository: https://github.com/kirkas/Ascensor.js
  license: BSD
  author: Léo Galley <contact@kirkas.ch>
  */
  !function(a,b,c,d){function e(b,c){this.element=b,this.options=a.extend({},n,c),this._defaults=n,this._name=m,this.init()}function f(){var a,e=c.createElement("p"),f={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};c.body.insertBefore(e,null);for(var g in f)e.style[g]!==d&&(e.style[g]="translate3d(1px,1px,1px)",a=b.getComputedStyle(e).getPropertyValue(f[g]));return c.body.removeChild(e),a!==d&&a.length>0&&"none"!==a}function g(a,b){var c=a.indexOf(b);return-1!==c?!0:!1}function h(a){return a===!0}function i(a){return"number"==typeof a}function j(a){return"string"==typeof a}function k(a){return"function"==typeof a}function l(a){return"object"==typeof a}var m="ascensor",n={ascensorFloorName:!1,childType:"div",windowsOn:0,direction:"y",loop:!1,width:"100%",height:"100%",time:250,easing:"linear",keyNavigation:!0,queued:!1,jump:!1,ready:!1,swipeNavigation:"mobile-only",swipeVelocity:.7,wheelNavigation:!1,wheelNavigationDelay:40};Array.prototype.indexOf||(Array.prototype.indexOf=function(a){var b=this.length>>>0,c=Number(arguments[1])||0;for(c=0>c?Math.ceil(c):Math.floor(c),0>c&&(c+=b);b>c;c++)if(c in this&&this[c]===a)return c;return-1}),e.prototype={init:function(){this.AXIS_X=1,this.AXIS_Y=0,this.dataAttributeMap={next:"ascensor-next",prev:"ascensor-prev",down:"ascensor-down",up:"ascensor-up",left:"ascensor-left",right:"ascensor-right"},this.node=a(this.element),this.nodeChildren=this.node.children(this.options.childType),this.floorActive=i(this._getFloorFromHash())?this._getFloorFromHash():this.options.windowsOn,this.NH=this.node.height(),this.NW=this.node.width();var b=!0,c=navigator.userAgent.match(/Android\s+([\d\.]+)/);return c&&(b=parseFloat(c[1])>3),this.directionIsArray=l(this.options.direction),this.supportTransform=f()&&b,l(this.options.ascensorFloorName)&&this.options.ascensorFloorName.length<this.nodeChildren.length?this._emitConsoleMessage("error","floors total ("+this.nodeChildren.length+") & floor name array length ("+this.options.ascensorFloorName.length+") don't match"):this.directionIsArray&&this.options.direction.length<this.nodeChildren.length?this._emitConsoleMessage("error","floors total ("+this.nodeChildren.length+") & direction array lenght ("+this.options.direction.length+") don't match"):void this.setup()},setup:function(){this._positionElement(),this._bindEvents(),this.scrollToFloor(this.floorActive),l(this.options.ascensorFloorName)&&this._updateHash(this.floorActive),k(this.options.ready)&&this.options.ready()},_bindEvents:function(){var d=this;if(this.node.on("scrollToDirection",function(a,b){d.scrollToDirection(b)}),this.node.on("scrollToStage",function(b,c){if("string"==typeof c){var e=a.inArray(c,d.options.ascensorFloorName);-1!==e&&d.scrollToFloor(e)}else if("number"==typeof c){if(c>d.nodeChildren.length)return;d.scrollToFloor(c)}}),this.node.on("next",function(){var a=d.nodeChildren.eq(d.floorActive).data(d.dataAttributeMap.next);return i(a)?d.scrollToFloor(a):void d.next()}),this.node.on("prev",function(){var a=d.nodeChildren.eq(d.floorActive).data(d.dataAttributeMap.prev);return i(a)?d.scrollToFloor(a):void d.prev()}),this.node.on("refresh",function(){d.refresh()}),this.node.on("remove",function(){d.destroy()}),a(b).on("resize.ascensor",function(){d.scrollToFloor(d.floorActive,!1)}),l(this.options.ascensorFloorName)&&a(b).on("hashchange.ascensor",function(a){d._hashchangeHandler(a)}),b.DeviceOrientationEvent&&a(b).on("orientationchange.ascensor",function(){d.scrollToFloor(d.floorActive)}),this.options.keyNavigation&&a(c).on("keydown.ascensor",function(a){d._keypressHandler(a)}),this.options.wheelNavigation&&(this.node.on("mousewheel.ascensor DOMMouseScroll.ascensor wheel.ascensor",function(a){setTimeout(function(){d.scrollInChildren||d._handleMouseWheelEvent(a)},10)}),this.nodeChildren.on("scroll.ascensor",function(){d.scrollInChildren=!0,d.scrollTimeOut&&clearTimeout(d.scrollTimeOut),d.scrollTimeOut=setTimeout(function(){d.scrollInChildren=!1},300)})),this.options.swipeNavigation){var e="touchstart.ascensor touchend.ascensor touchcancel.ascensor";"mobile-only"!==this.options.swipeNavigation&&(e+=" mousedown.ascensor mouseup.ascensor"),this.node.on(e,function(a){d._handleTouchEvent(a)})}},refresh:function(){this.nodeChildren=this.node.children(this.options.childType),this._positionElement()},destroy:function(){this.nodeChildren.off("scroll.ascensor"),this.node.off("mousewheel.ascensor DOMMouseScroll.ascensor wheel.ascensor scrollToDirection scrollToStage next prev refresh remove touchstart.ascensor touchend.ascensor mousedown.ascensor mouseup.ascensor touchcancel.ascensor"),a(b).off("resize.ascensor hashchange.ascensor orientationchange.ascensor"),a(c).off("keydown.ascensor"),this.node.css({position:"",overflow:"",top:"",left:"",width:"",height:""}),this.nodeChildren.css({position:"",overflow:"",top:"",left:"",width:"",height:"",transform:""}),this.node.removeData()},_handleMouseWheelEvent:function(a){if(!this.node.is(":animated")){if(this.scrollTime=(new Date).getTime(),!this.lastScrollTime||this.scrollTime-this.lastScrollTime>this.options.wheelNavigationDelay)return void(this.lastScrollTime=this.scrollTime);this.lastScrollTime=this.scrollTime;var b,c,d;"detail"in a.originalEvent&&(b=-1*a.originalEvent.detail),"wheelDelta"in a.originalEvent&&(b=a.originalEvent.wheelDelta),"wheelDeltaY"in a.originalEvent&&(b=a.originalEvent.wheelDeltaY),"wheelDeltaX"in a.originalEvent&&(c=-1*a.originalEvent.wheelDeltaX),"axis"in a.originalEvent&&a.originalEvent.axis===a.originalEvent.HORIZONTAL_AXIS&&(c=-1*b,b=0),d=0===b?c:b,"deltaY"in a.originalEvent&&(b=-1*a.originalEvent.deltaY,d=b),"deltaX"in a.originalEvent&&(c=a.originalEvent.deltaX,0===b&&(d=-1*c)),Math.abs(c)>Math.abs(b)&&c>0&&this.scrollToDirection("left"),Math.abs(c)>Math.abs(b)&&0>c&&this.scrollToDirection("right"),Math.abs(b)>Math.abs(c)&&b>0&&this.scrollToDirection("up"),Math.abs(b)>Math.abs(c)&&0>b&&this.scrollToDirection("down")}},_handleTouchEvent:function(a){switch(a.type){case"touchstart":case"mousedown":this.touchStartTime=(new Date).getTime(),this.touchStartX="touchstart"==a.type?a.originalEvent.touches[0].pageX:a.pageX,this.touchStartY="touchstart"==a.type?a.originalEvent.touches[0].pageY:a.pageY;break;case"touchend":case"touchcancel":case"mouseup":this.touchEndTime=(new Date).getTime(),this.touchEndX="touchend"==a.type||"touchcancel"==a.type?a.originalEvent.changedTouches[0].pageX:a.pageX,this.touchEndY="touchend"==a.type||"touchcancel"==a.type?a.originalEvent.changedTouches[0].pageY:a.pageY;var b=this.touchStartX-this.touchEndX,c=this.touchStartY-this.touchEndY,d=this.touchEndTime-this.touchStartTime,e=Math.abs(b)/d,f=Math.abs(c)/d;e>this.options.swipeVelocity&&Math.abs(b)>Math.abs(c)&&0>b&&this.scrollToDirection("left"),e>this.options.swipeVelocity&&Math.abs(b)>Math.abs(c)&&b>0&&this.scrollToDirection("right"),f>this.options.swipeVelocity&&Math.abs(b)<Math.abs(c)&&0>c&&this.scrollToDirection("up"),f>this.options.swipeVelocity&&Math.abs(b)<Math.abs(c)&&c>0&&this.scrollToDirection("down")}},_positionElement:function(){var b=this;this.directionIsArray&&this._generateFloorMap(),this.node.css({position:"absolute",overflow:"hidden",top:"0",left:"0",width:this.options.width,height:this.options.height}),this.nodeChildren.css({position:"absolute",overflow:"auto",top:"0",left:"0",width:"100%",height:"100%"}),this.nodeChildren.each(function(c){a(this).css(b.supportTransform?{transform:function(){return"y"===b.options.direction?"translateY("+100*c+"%)":"x"===b.options.direction?"translateX("+100*c+"%)":b.directionIsArray?"translateY("+100*b.options.direction[c][b.AXIS_Y]+"%) translateX("+100*b.options.direction[c][b.AXIS_X]+"%)":void 0}}:{top:function(){return"y"===b.options.direction?100*c+"%":b.directionIsArray?100*b.options.direction[c][b.AXIS_Y]+"%":void 0},left:function(){return"x"===b.options.direction?100*c+"%":b.directionIsArray?100*b.options.direction[c][b.AXIS_X]+"%":void 0}})})},_getFloorFromHash:function(){return this._getHash()&&this.options.ascensorFloorName&&g(this.options.ascensorFloorName,this._getHash())?this.options.ascensorFloorName.indexOf(this._getHash()):!1},_getHash:function(){if(b.location.hash){var a=b.location.hash.split("#").pop();return a}return!1},_hashchangeHandler:function(){i(this._getFloorFromHash())&&this._getFloorFromHash()!==this.floorActive&&!this.node.is(":animated")&&this.scrollToFloor(this._getFloorFromHash())},_updateHash:function(a){l(this.options.ascensorFloorName)&&this._getHash()!==this.options.ascensorFloorName[a]&&b.location.replace((""+b.location).split("#")[0]+"#"+this.options.ascensorFloorName[a])},_emitEvent:function(a,b,c){this.node.trigger(a,floor={from:b,to:c})},_emitConsoleMessage:function(a,b){"error"==a&&console.error("Ascensor.js: "+b),"warn"==a&&console.warn("Ascensor.js: "+b)},_keypressHandler:function(b){var c=this,d=b.keyCode||b.which;if(!a("input, textarea, button").is(":focus"))switch(d){case 40:case 83:c.scrollToDirection("down");break;case 38:case 87:c.scrollToDirection("up");break;case 37:case 65:c.scrollToDirection("left");break;case 39:case 68:c.scrollToDirection("right")}},scrollToFloor:function(a){j(a)&&g(this.options.ascensorFloorName,a)&&(a=this.options.ascensorFloorName.indexOf(a));var b=this,c=a===this.floorActive?!1:!0;this.NW!==this.node.width()&&(this.NW=this.node.width()),this.NH!==this.node.height()&&(this.NH=this.node.height());var d=this._getAnimationSettings(a);c?(this._emitEvent("scrollStart",b.floorActive,a),this.node.stop().animate(d.property,b.options.time,b.options.easing,d.callback)):this.node.stop().scrollTop(d.defaults.scrollTop).scrollLeft(d.defaults.scrollLeft),this.floorActive=a,this.node.data("current-floor",this.floorActive)},prev:function(){var a=this.floorActive-1;if(0>a){if(!this.options.loop)return;a=this.nodeChildren.length-1}this.scrollToFloor(a)},next:function(){var a=this.floorActive+1;if(a>this.nodeChildren.length-1){if(!this.options.loop)return;a=0}this.scrollToFloor(a)},_getAnimationSettings:function(a){var b=this,c=b.floorActive,d={property:{},callback:function(){b._emitEvent("scrollEnd",c,a),b._updateHash(a)},defaults:{}},e={property:{},callback:function(){b._emitEvent("scrollEnd",c,a),b._updateHash(a)}};if(d.defaults.scrollTop=a*b.NH,d.defaults.scrollLeft=a*b.NW,"y"===b.options.direction)return d.property.scrollTop=a*b.NH,d;if("x"===b.options.direction)return d.property.scrollLeft=a*b.NW,d;if(b.directionIsArray){var f=b.options.direction[a][b.AXIS_Y]*b.NH,g=b.options.direction[a][b.AXIS_X]*b.NW;if(d.defaults.scrollTop=f,d.defaults.scrollLeft=g,b.options.queued){{var h=this.node.scrollLeft()===g;this.node.scrollTop()===f}return"x"===b.options.queued&&h?(d.property.scrollTop=f,d):(d.property.scrollLeft=g,e.property.scrollTop=f,d.callback=function(){b.node.stop().animate(e.property,b.options.time,b.options.easing,e.callback)},d)}return d.property.scrollTop=f,d.property.scrollLeft=g,d}return d},scrollToDirection:function(a){var b=this,c=this.nodeChildren.eq(this.floorActive).data(this.dataAttributeMap[a]);if(i(c))return b.scrollToFloor(c);var d="right"==a||"left"==a,e="down"==a||"up"==a;if(!("y"==b.options.direction&&d||"x"==b.options.direction&&e)){if("y"==b.options.direction&&"down"==a||"x"==b.options.direction&&"right"==a)return b.next();if("y"==b.options.direction&&"up"==a||"x"==b.options.direction&&"left"==a)return b.prev();if(b.directionIsArray){var f=b.floorMap[b.floorActive],g=f[a];if(i(g))return b.scrollToFloor(g);var j=f.closest[a];if(h(b.options.jump)&&i(j))return b.scrollToFloor(j);var k=f.furthest[a];if(i(k)&&(h(b.options.loop)||d&&"loop-x"==b.options.loop||e&&"loop-y"==b.options.loop))return b.scrollToFloor(k);var l=f.increment[a];if(i(l)&&("increment"==b.options.loop||e&&"increment-y"==b.options.loop||d&&"increment-x"==b.options.loop))return b.scrollToFloor(l);if("increment-x"==b.options.loop&&d||"increment"==b.options.loop){if(b.floorActive==b.floorMap.furthest_x)return b.scrollToFloor(b.floorMap.closest_x);if(b.floorActive==b.floorMap.closest_x)return b.scrollToFloor(b.floorMap.furthest_x)}if("increment-y"==b.options.loop&&e||"increment"==b.options.loop){if(b.floorActive==b.floorMap.furthest_y)return b.scrollToFloor(b.floorMap.closest_y);if(b.floorActive==b.floorMap.closest_y)return b.scrollToFloor(b.floorMap.furthest_y)}}}},_getDirectFloorIndex:function(b,c,d){var e=this,f=[this.options.direction[c][this.AXIS_Y],this.options.direction[c][this.AXIS_X]];"right"==d&&(f[this.AXIS_X]+=1),"left"==d&&(f[this.AXIS_X]-=1),"up"==d&&(f[this.AXIS_Y]-=1),"down"==d&&(f[this.AXIS_Y]+=1);var g=!1;return a.each(b,function(a,b){return b[e.AXIS_Y]==f[e.AXIS_Y]&&b[e.AXIS_X]==f[e.AXIS_X]?(g=a,!1):void 0}),g},_getAxisFromDirection:function(a){var b,c=this;switch(a){case"up":case"down":b=c.AXIS_Y;break;case"left":case"right":b=c.AXIS_X}return b},_getClosestFloorIndex:function(b,c,d,e){e=e||0;var f=this._getAxisFromDirection(d),g=b[c][f],h=f==this.AXIS_Y?this.AXIS_X:this.AXIS_Y,i=!1,j=!1;return a.each(b,function(a,k){k[h]==b[c][h]+e&&(("right"==d||"down"==d)&&k[f]>g||("left"==d||"up"==d)&&k[f]<g)&&(!j||Math.abs(k[f]-g)<Math.abs(j[f]))&&(i=a,j=k)}),i},_getFurthestFloorIndex:function(b,c,d,e){e=e||0;var f=this._getAxisFromDirection(d),g=b[c][f],h=f==this.AXIS_Y?this.AXIS_X:this.AXIS_Y,i=!1,j=!1;return a.each(b,function(a,d){d[h]==b[c][h]+e&&(!i||Math.abs(d[f]-g)>Math.abs(i[f]-g))&&(i=d,j=a)}),j},_generateFloorMap:function(){function b(a,b){var c=!1;return jQuery.each(a,function(a,d){(c===!1||c[b]<d[b])&&(c=d)}),c}function c(a,b){var c=!1;return jQuery.each(a,function(a,d){(c===!1||c[b]>d[b])&&(c=d)}),c}function d(a,b){return jQuery.grep(f,function(c){var d=c[b]==a[b];return d})}var e=this;this.floorMap=[];var f=jQuery.grep(e.options.direction,function(a,b){return e.nodeChildren.length>b});a.each(f,function(a){e.floorMap[a]={down:e._getDirectFloorIndex(f,a,"down"),up:e._getDirectFloorIndex(f,a,"up"),right:e._getDirectFloorIndex(f,a,"right"),left:e._getDirectFloorIndex(f,a,"left"),increment:{down:e._getFurthestFloorIndex(f,a,"down",1),up:e._getFurthestFloorIndex(f,a,"up",-1),right:e._getFurthestFloorIndex(f,a,"right",1),left:e._getFurthestFloorIndex(f,a,"left",-1)},closest:{down:e._getClosestFloorIndex(f,a,"down"),up:e._getClosestFloorIndex(f,a,"up"),right:e._getClosestFloorIndex(f,a,"right"),left:e._getClosestFloorIndex(f,a,"left")},furthest:{down:e._getFurthestFloorIndex(f,a,"down"),up:e._getFurthestFloorIndex(f,a,"up"),right:e._getFurthestFloorIndex(f,a,"right"),left:e._getFurthestFloorIndex(f,a,"left")}}});var g=b(f,e.AXIS_X),h=d(g,e.AXIS_X),i=b(h,e.AXIS_Y),j=b(f,e.AXIS_Y),k=d(j,e.AXIS_Y),l=b(k,e.AXIS_X);e.floorMap.furthest_x=f.indexOf(l),e.floorMap.furthest_y=f.indexOf(i);var m=c(f,e.AXIS_X),n=d(m,e.AXIS_X),o=c(n,e.AXIS_Y),p=c(f,e.AXIS_Y),q=d(p,e.AXIS_Y),r=c(q,e.AXIS_X);e.floorMap.closest_x=f.indexOf(r),e.floorMap.closest_y=f.indexOf(o)}},a.fn[m]=function(b){return this.each(function(){a.data(this,m)||a.data(this,m,new e(this,b))}),this}}(jQuery,window,document);