/*! fixto - v0.5.0 - 2016-06-16 * http://github.com/bbarakaci/fixto/*/ var fixto=function(e,t,n){function s(){this._vendor=null}function f(){var e=!1,t=n.createElement("div"),r=n.createElement("div");t.appendChild(r),t.style[u]="translate(0)",t.style.marginTop="10px",t.style.visibility="hidden",r.style.position="fixed",r.style.top=0,n.body.appendChild(t);var i=r.getBoundingClientRect();return i.top>0&&(e=!0),n.body.removeChild(t),e}function d(t,n,r){this.child=t,this._$child=e(t),this.parent=n,this.options={className:"fixto-fixed",top:0,mindViewport:!1},this._setOptions(r)}function v(e,t,n){d.call(this,e,t,n),this._replacer=new i.MimicNode(e),this._ghostNode=this._replacer.replacer,this._saveStyles(),this._saveViewportHeight(),this._proxied_onscroll=this._bind(this._onscroll,this),this._proxied_onresize=this._bind(this._onresize,this),this.start()}function m(e,t,n){d.call(this,e,t,n),this.start()}var r=function(){var e={getAll:function(e){return n.defaultView.getComputedStyle(e)},get:function(e,t){return this.getAll(e)[t]},toFloat:function(e){return parseFloat(e,10)||0},getFloat:function(e,t){return this.toFloat(this.get(e,t))},_getAllCurrentStyle:function(e){return e.currentStyle}};return n.documentElement.currentStyle&&(e.getAll=e._getAllCurrentStyle),e}(),i=function(){function t(e){this.element=e,this.replacer=n.createElement("div"),this.replacer.style.visibility="hidden",this.hide(),e.parentNode.insertBefore(this.replacer,e)}t.prototype={replace:function(){var e=this.replacer.style,t=r.getAll(this.element);e.width=this._width(),e.height=this._height(),e.marginTop=t.marginTop,e.marginBottom=t.marginBottom,e.marginLeft=t.marginLeft,e.marginRight=t.marginRight,e.cssFloat=t.cssFloat,e.styleFloat=t.styleFloat,e.position=t.position,e.top=t.top,e.right=t.right,e.bottom=t.bottom,e.left=t.left,e.display=t.display},hide:function(){this.replacer.style.display="none"},_width:function(){return this.element.getBoundingClientRect().width+"px"},_widthOffset:function(){return this.element.offsetWidth+"px"},_height:function(){return this.element.getBoundingClientRect().height+"px"},_heightOffset:function(){return this.element.offsetHeight+"px"},destroy:function(){e(this.replacer).remove();for(var t in this)this.hasOwnProperty(t)&&(this[t]=null)}};var i=n.documentElement.getBoundingClientRect();return i.width||(t.prototype._width=t.prototype._widthOffset,t.prototype._height=t.prototype._heightOffset),{MimicNode:t,computedStyle:r}}();s.prototype={_vendors:{webkit:{cssPrefix:"-webkit-",jsPrefix:"Webkit"},moz:{cssPrefix:"-moz-",jsPrefix:"Moz"},ms:{cssPrefix:"-ms-",jsPrefix:"ms"},opera:{cssPrefix:"-o-",jsPrefix:"O"}},_prefixJsProperty:function(e,t){return e.jsPrefix+t[0].toUpperCase()+t.substr(1)},_prefixValue:function(e,t){return e.cssPrefix+t},_valueSupported:function(e,t,n){try{return n.style[e]=t,n.style[e]===t}catch(r){return!1}},propertySupported:function(e){return n.documentElement.style[e]!==undefined},getJsProperty:function(e){if(this.propertySupported(e))return e;if(this._vendor)return this._prefixJsProperty(this._vendor,e);var t;for(var n in this._vendors){t=this._prefixJsProperty(this._vendors[n],e);if(this.propertySupported(t))return this._vendor=this._vendors[n],t}return null},getCssValue:function(e,t){var r=n.createElement("div"),i=this.getJsProperty(e);if(this._valueSupported(i,t,r))return t;var s;if(this._vendor){s=this._prefixValue(this._vendor,t);if(this._valueSupported(i,s,r))return s}for(var o in this._vendors){s=this._prefixValue(this._vendors[o],t);if(this._valueSupported(i,s,r))return this._vendor=this._vendors[o],s}return null}};var o=new s,u=o.getJsProperty("transform"),a,l=o.getCssValue("position","sticky"),c=o.getCssValue("position","fixed"),h=navigator.appName==="Microsoft Internet Explorer",p;h&&(p=parseFloat(navigator.appVersion.split("MSIE")[1])),d.prototype={_mindtop:function(){var e=0;if(this._$mind){var t,n,i;for(var s=0,o=this._$mind.length;sthis._parentBottom||this._scrollTopthis._fullOffset("offsetTop",this.child)-this.options.top-this._mindtop())return this.options.mindViewport&&!this._isViewportAvailable()?!1:!0},_isViewportAvailable:function(){var e=r.getAll(this.child);return this._viewportHeight>this.child.offsetHeight+r.toFloat(e.marginTop)+r.toFloat(e.marginBottom)},_adjust:function(){var t=0,n=this._mindtop(),i=0,s=r.getAll(this.child),o=null;a&&(o=this._getContext(),o&&(t=Math.abs(o.getBoundingClientRect().top))),i=this._parentBottom-this._scrollTop-(this.child.offsetHeight+r.toFloat(s.marginBottom)+n+this.options.top),i>0&&(i=0),this.child.style.top=i+n+t+this.options.top-r.toFloat(s.marginTop)+"px"},_fullOffset:function(t,n,r){var i=n[t],s=n.offsetParent;while(s!==null&&s!==r)i+=s[t],s=s.offsetParent;return i},_getContext:function(){var e,t=this.child,i=null,s;while(!i){e=t.parentNode;if(e===n.documentElement)return null;s=r.getAll(e);if(s[u]!=="none"){i=e;break}t=e}return i},_fix:function(){var t=this.child,i=t.style,s=r.getAll(t),o=t.getBoundingClientRect().left,u=s.width;this._saveStyles(),n.documentElement.currentStyle&&(u=t.offsetWidth-(r.toFloat(s.paddingLeft)+r.toFloat(s.paddingRight)+r.toFloat(s.borderLeftWidth)+r.toFloat(s.borderRightWidth))+"px");if(a){var f=this._getContext();f&&(o=t.getBoundingClientRect().left-f.getBoundingClientRect().left)}this._replacer.replace(),i.left=o-r.toFloat(s.marginLeft)+"px",i.width=u,i.position="fixed",i.top=this._mindtop()+this.options.top-r.toFloat(s.marginTop)+"px",this._$child.addClass(this.options.className),this.fixed=!0},_unfix:function(){var t=this.child.style;this._replacer.hide(),t.position=this._childOriginalPosition,t.top=this._childOriginalTop,t.width=this._childOriginalWidth,t.left=this._childOriginalLeft,this._$child.removeClass(this.options.className),this.fixed=!1},_saveStyles:function(){var e=this.child.style;this._childOriginalPosition=e.position,this._childOriginalTop=e.top,this._childOriginalWidth=e.width,this._childOriginalLeft=e.left},_onresize:function(){this.refresh()},_saveViewportHeight:function(){this._viewportHeight=t.innerHeight||n.documentElement.clientHeight},_stop:function(){this._unfix(),e(t).unbind("scroll",this._proxied_onscroll),e(this._toresize).unbind("resize",this._proxied_onresize)},_start:function(){this._onscroll(),e(t).bind("scroll",this._proxied_onscroll),e(this._toresize).bind("resize",this._proxied_onresize)},_destroy:function(){this._replacer.destroy()},refresh:function(){this._saveViewportHeight(),this._unfix(),this._onscroll()}}),m.prototype=new d,e.extend(m.prototype,{_start:function(){var e=r.getAll(this.child);this._childOriginalPosition=e.position,this._childOriginalTop=e.top,this.child.style.position=l,this.refresh()},_stop:function(){this.child.style.position=this._childOriginalPosition,this.child.style.top=this._childOriginalTop},refresh:function(){this.child.style.top=this._mindtop()+this.options.top+"px"}});var g=function(t,n,r){return l&&!r||l&&r&&r.useNativeSticky!==!1?new m(t,n,r):c?(a===undefined&&(a=f()),new v(t,n,r)):"Neither fixed nor sticky positioning supported"};return p<8&&(g=function(){return"not supported"}),e.fn.fixTo=function(t,n){var r=e(t),i=0;return this.each(function(){var s=e(this).data("fixto-instance");if(!s)e(this).data("fixto-instance",g(this,r[i],n));else{var o=t;s[o].call(s,n)}i++})},{FixToContainer:v,fixTo:g,computedStyle:r,mimicNode:i}}(window.jQuery,window,document);