function sticky(obj,params){var settings=params||{"topMargin":"0","stikyContainer":".footer"} if(jQuery(window).width()>480){if(!jQuery(obj).length)return;var stiky=jQuery(obj);var stickyTop=stiky.offset().top;var stikyContainer=jQuery(settings.stikyContainer);var maxStikyTop=(stikyContainer.offset().top+stikyContainer.outerHeight(true))-stiky.outerHeight(true)-50;var stickyHeight=stiky.outerHeight(true)+50;var windowTop;var didScroll;jQuery(window).scroll(function(event){didScroll=true;});setInterval(function(){if(didScroll){hasScrolled();didScroll=false;}},100);function hasScrolled(){windowTop=jQuery(window).scrollTop();if(maxStikyTop>stickyTop+stickyHeight){if(stickyTop<=windowTop){stiky.css({position:'fixed',marginTop:settings.topMargin,top:0});if(windowTop>=maxStikyTop){stiky.addClass('sticky_fixed_bottom')}else{stiky.removeClass('sticky_fixed_bottom')}}else{stiky.css({position:'static',marginTop:0,top:0});}}}jQuery(window).load(function(){layout();}) jQuery(window).resize(function(){layout();});}var layout=function(){maxStikyTop=(stikyContainer.offset().top+stikyContainer.outerHeight(true))-stiky.outerHeight(true)-50;stickyHeight=stiky.outerHeight(true)+50;}}