(function(a){a.fn.sticky=function(b){var c={topSpacing:0};var b=a.extend(c,b);return this.each(function(){var c=b.topSpacing,d=a(this),e=d.outerHeight(),f=d.outerWidth(),g=d.offset().top-a(window).scrollTop(),h=d.offset().top,i=d.attr("id");d.wrapAll('<div id="'+i+'StickyWrapper"></div>');d.parent().css("height",e).css("width",f);a(window).scroll(function(){g=d.offset().top-a(window).scrollTop();if(g<=c){d.css("position","fixed").css("top",c)}if(a(window).scrollTop()<=h-c){d.css("position","static").css("top",a(window).scrollTop())}})})}})(jQuery)
