StickyMenu = function(config){
	var o = {
		el: config.el,
		pad: config.pad || 5,
		delay_ms: config.delay_ms || 50,
		animate_ms: config.animate_ms || 300,
		init: function(){
			var that = this;
			this.min = this.el.offset().top;
			jQuery(window).scroll(function(){
				var f = function(){
					var st = 0;
					jQuery('body,html').each(function(){ st = Math.max(st, this.scrollTop)});
					var top = st + that.pad > that.min ? st + that.pad : that.min;
					that.el.css('position','absolute')
					if(that.animate_ms){
						that.el.animate({top: top}, that.animate_ms, 'linear');
					} else {	
						that.el.css({top: top});
					}
					if(that.timeout) window.clearTimeout(that.timeout);
				}
				if(that.delay_ms){
					if(that.timeout) window.clearTimeout(that.timeout);
					that.timeout = window.setTimeout(f, that.delay_ms);
				} else {
					f();
				}
				
			});
		}
	};
	o.init();
	return o;
}
