"undefined"==typeof Modernizr&&(window.Modernizr=function(t,i,e){function s(t){u.cssText=t}function r(t,i){return s(c.join(t+";")+(i||""))}function n(t,i){return typeof t===i}function o(t,i){return!!~(""+t).indexOf(i)}function a(t,i,s){for(var r in t){var o=i[t[r]];if(o!==e)return s===!1?t[r]:n(o,"function")?o.bind(s||i):o}return!1}var d="2.8.3",h={},l=i.documentElement,g="modernizr",f=i.createElement(g),u=f.style,m,p={}.toString,c=" -webkit- -moz- -o- -ms- ".split(" "),b={},_={},v={},w=[],y=w.slice,x,T=function(t,e,s,r){var n,o,a,d,h=i.createElement("div"),f=i.body,u=f||i.createElement("body");if(parseInt(s,10))for(;s--;)a=i.createElement("div"),a.id=r?r[s]:g+(s+1),h.appendChild(a);return n=["",'"].join(""),h.id=g,(f?h:u).innerHTML+=n,u.appendChild(h),f||(u.style.background="",u.style.overflow="hidden",d=l.style.overflow,l.style.overflow="hidden",l.appendChild(u)),o=e(h,t),f?h.parentNode.removeChild(h):(u.parentNode.removeChild(u),l.style.overflow=d),!!o},C={}.hasOwnProperty,D;D=n(C,"undefined")||n(C.call,"undefined")?function(t,i){return i in t&&n(t.constructor.prototype[i],"undefined")}:function(t,i){return C.call(t,i)},Function.prototype.bind||(Function.prototype.bind=function(t){var i=this;if("function"!=typeof i)throw new TypeError;var e=y.call(arguments,1),s=function(){if(this instanceof s){var r=function(){};r.prototype=i.prototype;var n=new r,o=i.apply(n,e.concat(y.call(arguments)));return Object(o)===o?o:n}return i.apply(t,e.concat(y.call(arguments)))};return s}),b.touch=function(){var e;return"ontouchstart"in t||t.DocumentTouch&&i instanceof DocumentTouch?e=!0:T(["@media (",c.join("touch-enabled),("),g,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(t){e=9===t.offsetTop}),e};for(var B in b)D(b,B)&&(x=B.toLowerCase(),h[x]=b[B](),w.push((h[x]?"":"no-")+x));return h.addTest=function(t,i){if("object"==typeof t)for(var s in t)D(t,s)&&h.addTest(s,t[s]);else{if(t=t.toLowerCase(),h[t]!==e)return h;i="function"==typeof i?i():i,"undefined"!=typeof enableClasses&&enableClasses&&(l.className+=" "+(i?"":"no-")+t),h[t]=i}return h},s(""),f=m=null,h._version=d,h._prefixes=c,h.testStyles=T,h}(this,this.document)),jQuery(document).ready(function($){"undefined"==typeof $.easing.easeInOutQuad&&$.extend($.easing,{easeInOutBack:function(t,i,e,s,r,n){return void 0===n&&(n=1.70158),(i/=r/2)<1?s/2*i*i*(((n*=1.525)+1)*i-n)+e:s/2*((i-=2)*i*(((n*=1.525)+1)*i+n)+2)+e}})}),function($,t,i,e){function s(t,i){this.element=t,"undefined"==typeof i&&(i=$(this.element).data()),this.settings=$.extend({},n,i),this.settings.splitBorder=this.settings.splitBorder===!0||"true"===this.settings.splitBorder||"1"===this.settings.splitBorder,this.settings["return"]=this.settings["return"]===!0||"true"===this.settings["return"]||"1"===this.settings["return"],this._defaults=n,this._name=r,this.init()}var r="gambitBeforeAfter",n={width:400,height:300,direction:"vertical",slideOn:"hover",rotation:0,start:.5,"return":!0,returnDelay:5e3,returnDuration:1e3,arrows:!0,arrowColor:"#fff",arrowSize:7,arrowGap:0,arrowOffset:0,splitBorder:!0,splitBorderColor:"#fff",splitBorderWidth:2,slider:!1,sliderLocation:"bottom",sliderBarColor:"rgba(255,255,255,.3)",sliderBarThickness:8,sliderButtonColor:"rgba(255,255,255,.8)",sliderThickness:30,complete:function(){}};$.extend(s.prototype,{init:function(){this.setup(),this.settings.complete()},setup:function(){var i=$(this.element);this.settings.arrowSize=7,i.css({maxWidth:this.settings.width,height:this.settings.height}),"undefined"==typeof i.attr("id")&&i.attr("id","gambit_baa_"+parseInt(1e5*Math.random())),$(this.element).find("> *:eq(0)").addClass("image_after").wrap('
').find("> *:eq(0)").addClass("image_after_content"),this.settings.splitBorder===!0&&i.find(".image_after_container").css({boxShadow:"0 0 0 "+this.settings.splitBorderWidth+"px "+this.settings.splitBorderColor+", inset 0 0 0 .1px "+this.settings.splitBorderColor}),this.settings.slider!==!0||this.isMobile()||this.createSlider(),this.settings.arrows&&("vertical"===this.settings.direction?(i.append(''),i.append('')):(i.append(''),i.append('')),i.find("[class^=gambit_baa_arrow]").css("borderWidth",this.settings.arrowSize),i.find("[class^=gambit_baa_arrow]").css("borderColor",this.settings.arrowColor)),$(t).resize($.proxy(this.adjustStartingPosition,this)),$(t).resize($.proxy(this.resizeContainerAspectRatio,this)),this.resizeContainerAspectRatio(),this.adjustStartingPosition(),i.addClass("slide_on_"+this.settings.slideOn),"hover"===this.settings.slideOn||this.isMobile()?$("body").on("mousemove touchmove touchstart","#"+i.attr("id"),$.proxy(this.moveHandler,this)):"click"===this.settings.slideOn&&$("body").on("mousedown","#"+i.attr("id"),$.proxy(this.slideDragStartHandler,this)),this.returnTimeout=null,this.returnAnimating=!1},resizeContainerAspectRatio:function(){var t=$(this.element);t.height(this.settings.height/this.settings.width*t.width())},adjustStartingPosition:function(){this.move(this.settings.start)},createSlider:function(){var i=$(this.element),e="bottom"===this.settings.sliderLocation||"top"===this.settings.sliderLocation?"height":"width",s="bottom"===this.settings.sliderLocation||"top"===this.settings.sliderLocation?"width":"height",r=$("").addClass("gambit_baa_slider");r.css({backgroundColor:this.settings.sliderBarColor}).css(e,this.settings.sliderBarThickness).appendTo(i);var n=$("").addClass("gambit_baa_slider_button");n.css({backgroundColor:this.settings.sliderButtonColor}).css(e,this.settings.sliderBarThickness).css(s,this.settings.sliderButtonThickness).appendTo(r),$("body").on("mousedown","#"+i.attr("id")+" .gambit_baa_slider",$.proxy(this.sliderAreaDragStartHandler,this)),$("body").on("mousedown","#"+i.attr("id")+" .gambit_baa_slider_button",$.proxy(this.sliderDragStartHandler,this)),this.sliderAdjustLocation(this.settings.start),$(t).resize($.proxy(this.sliderAdjustLocation,this))},sliderAdjustLocation:function(t){"undefined"==typeof t&&(t=this.settings.start);var i=$(this.element).find(".gambit_baa_slider"),e=$(this.element).find(".gambit_baa_slider_button");if("top"===this.settings.sliderLocation||"bottom"===this.settings.sliderLocation){var s=0,r=i.width()-e.width(),n=r*t+s;e.css("left",n)}else{var o=0,a=i.height()-e.height(),d=a*t+o;e.css("top",d)}},sliderAreaDragStartHandler:function(t){t.preventDefault(),this.sliderDragStartHandler(t),this.sliderDragMoveHandler(t)},sliderDragStartHandler:function(t){return t.preventDefault(),this.returnAnimating?!1:$(this.element).find(".gambit_baa_slider_button").hasClass("gambit_dragging")?!1:void $(this.element).find(".gambit_baa_slider_button").addClass("gambit_dragging").parents().on("mousemove",$.proxy(this.sliderDragMoveHandler,this)).on("mouseup",$.proxy(this.sliderDragEndHandler,this))},sliderDragMoveHandler:function(t){if(t.preventDefault(),this.returnAnimating)return!1;var i=$(this.element).find(".gambit_baa_slider"),e=$(this.element).find(".gambit_baa_slider_button"),s=0;if("top"===this.settings.sliderLocation||"bottom"===this.settings.sliderLocation){var r=0,n=i.width()-e.width(),o=t.pageX-i.offset().left-e.width()/2;r>o?o=r:o>n&&(o=n),s=o/(n-r),e.css("left",o)}else{var a=0,d=i.height()-e.height(),h=t.pageY-i.offset().top-e.height()/2;a>h?h=a:h>d&&(h=d),s=h/(d-a),e.css("top",h)}this.move(s)},sliderDragEndHandler:function(t){t.preventDefault(),$(this.element).find(".gambit_baa_slider_button").removeClass("gambit_dragging").parents().off("mousemove",$.proxy(this.sliderDragMoveHandler,this)).off("mouseup",$.proxy(this.sliderDragEndHandler,this))},slideDragStartHandler:function(t){return t.preventDefault(),this.returnAnimating?!1:$(this.element).hasClass("gambit_dragging")?!1:void $(this.element).addClass("gambit_dragging").parents().on("mousemove",$.proxy(this.slideDragHandler,this)).on("mouseup",$.proxy(this.slideDragEndHandler,this))},slideDragHandler:function(t){if(t.preventDefault(),this.returnAnimating)return!1;var i=$(this.element),e;e="vertical"===this.settings.direction?(t.pageX-i.offset().left)/i.width():(t.pageY-i.offset().top)/i.height(),this.move(e)},slideDragEndHandler:function(t){t.preventDefault(),$(this.element).removeClass("gambit_dragging").parents().off("mousemove",$.proxy(this.slideDragHandler,this)).off("mouseup",$.proxy(this.slideDragEndHandler,this))},moveHandler:function(t){if(t.preventDefault(),!this.returnAnimating){var i=$(this.element),e;e="vertical"===this.settings.direction?"undefined"!=typeof t.pageX?(t.pageX-i.offset().left)/i.width():(t.originalEvent.touches[0].pageX-i.offset().left)/i.width():"undefined"!=typeof t.pageY?(t.pageY-i.offset().top)/i.height():(t.originalEvent.touches[0].pageY-i.offset().top)/i.height(),this.move(e)}},move:function(t){var i=$(this.element),e=i.width(),s=i.height(),r=this.settings.rotation*Math.PI/180,n=Math.tan(r),o=Math.cos(r),a=e*n,d=s*n,h=e/o-(e/2+s/2*n),l=h+e+d,g=s/o-(s/2+e/2*n),f=g+s+a;if(this.settings.splitBorder){var u=2*(this.settings.splitBorderWidth+2)*n+1;l+=u,f+=u}this.settings.rotation<0&&(h+=d,l-=d,g+=a,f-=a);var m,p,c,b,_,v,w,y,x,T,C;"vertical"===this.settings.direction?(m=-t*(l-h)+l,p="translateX("+-m+"px) rotate("+this.settings.rotation+"deg) translateZ(0)",c="rotate("+-this.settings.rotation+"deg) translateX("+m+"px) translateZ(0)",b="translateX("+-m+"px) rotate("+this.settings.rotation+"deg)",_="rotate("+-this.settings.rotation+"deg) translateX("+m+"px)",i.find(".image_after_container").css({top:"-"+s/2*5+"px",bottom:"-"+s/2*5+"px",left:"-"+e/2+"px",right:"-"+e/2+"px",webkitTransform:p,mozTransform:p,msTransform:b,otransform:p,transform:p}),i.find(".image_after").css({top:s/2*5+"px",bottom:s/2*5+"px",left:e/2+"px",right:e/2+"px",webkitTransform:c,mozTransform:c,msTransform:_,oTransform:c,transform:c}),this.settings.arrows&&(v=n*this.settings.splitBorderWidth,y=this.settings.splitBorderWidth/Math.sin((90-this.settings.rotation)*Math.PI/180),x=this.settings.arrowSize/Math.sin((90-this.settings.rotation)*Math.PI/180),w=t*(e+n*(s/2)*2+y+x/2)-n*(s/2)-y/2-x/2,T="translateY(-50%) translateX("+(w-x-v-this.settings.arrowGap+1)+"px) rotate("+this.settings.rotation+"deg) translateY("+-this.settings.arrowOffset+"px)",C="translateY(-50%) translateX("+(w-v+y+this.settings.arrowGap)+"px) rotate("+this.settings.rotation+"deg) translateY("+this.settings.arrowOffset+"px)",i.find(".gambit_baa_arrow_left").css({webkitTransform:T,mozTransform:T,msTransform:T,oTransform:T,transform:T}),i.find(".gambit_baa_arrow_right").css({webkitTransform:C,mozTransform:C,msTransform:C,oTransform:C,transform:C}))):(m=-t*(f-g)+f,p="translateY("+-m+"px) rotate("+this.settings.rotation+"deg) translateZ(0)",c="rotate("+-this.settings.rotation+"deg) translateY("+m+"px) translateZ(0)",b="translateY("+-m+"px) rotate("+this.settings.rotation+"deg)",_="rotate("+-this.settings.rotation+"deg) translateY("+m+"px)",i.find(".image_after_container").css({top:"-"+s/2+"px",bottom:"-"+s/2+"px",left:"-"+e/2*5+"px",right:"-"+e/2*5+"px",webkitTransform:p,mozTransform:p,msTransform:b,oTransform:p,transform:p}),i.find(".image_after").css({top:s/2+"px",bottom:s/2+"px",left:e/2*5+"px",right:e/2*5+"px",webkitTransform:c,mozTransform:c,msTransform:_,oTransform:c,transform:c}),this.settings.arrows&&(v=n*this.settings.splitBorderWidth,y=this.settings.splitBorderWidth/Math.sin((90-this.settings.rotation)*Math.PI/180),x=this.settings.arrowSize/Math.sin((90-this.settings.rotation)*Math.PI/180),w=t*(s+n*(e/2)*2+y+x/2)-n*(e/2)-y/2-x/2,T="translateX(-50%) translateY("+(w-x-v-this.settings.arrowGap+1)+"px) rotate("+this.settings.rotation+"deg) translateX("+-this.settings.arrowOffset+"px)",C="translateX(-50%) translateY("+(w-v+y+this.settings.arrowGap)+"px) rotate("+this.settings.rotation+"deg) translateX("+this.settings.arrowOffset+"px)",i.find(".gambit_baa_arrow_up").css({webkitTransform:T,mozTransform:T,msTransform:T,oTransform:T,transform:T}),i.find(".gambit_baa_arrow_down").css({webkitTransform:C,mozTransform:C,msTransform:C,oTransform:C,transform:C}))),this.sliderAdjustLocation(t),this.settings["return"]&&(this.position=t,null!==this.returnTimeout&&(clearTimeout(this.returnTimeout),this.returnTimeout=null),this.returnTimeout=setTimeout($.proxy(this.returnPosition,this),this.settings.returnDelay))},returnPosition:function(){$({z:this.position}).animate({z:this.settings.start},{duration:this.settings.returnDuration,easing:"easeInOutBack",step:$.proxy(this._returnPositionStep,this),start:$.proxy(this._returnPositionStart,this),complete:$.proxy(this._returnPositionComplete,this)})},_returnPositionStart:function(){this.returnAnimating=!0},_returnPositionComplete:function(){this.returnAnimating=!1},_returnPositionStep:function(t){this.move(t)},isMobile:function(){return Modernizr.touch&&jQuery(t).width()<=1024||t.screen.width<=1281&&t.devicePixelRatio>1?!0:!1}}),$.fn[r]=function(t){return this.each(function(){$.data(this,"plugin_"+r)||$.data(this,"plugin_"+r,new s(this,t))}),this}}(jQuery,window,document),jQuery(document).ready(function($){$(".gambit_baa").gambitBeforeAfter()});