jQuery.fn.extend({
	addScrollControl: function () {
		//core
		$adsControl = function (jEl, options) {
			var self = this;
			this.el = jEl;
			var isIE6 = (/MSIE 6\.0/).test(navigator.userAgent) && !(/MSIE 7\.0/).test(navigator.userAgent);
			if ( isIE6 ) {
                this.applyPosition = "absolute";
            }
            else {
                this.applyPosition = "fixed";
            }

			this.options = {
				initTop: typeof(options) != "undefined" && typeof(options.initTop) != "undefined" ? options.initTop : "5px",
				offsetTop: typeof(options) != "undefined" && typeof(options.offsetTop) != "undefined" ? options.offsetTop : "5px"
			}
			//init
			this.el.css({
				position: this.applyPosition,
				top: self.options.initTop
			});
			//binding events
			$(window).bind("scroll", function () {
				if ( $(document).scrollTop() != 0 ) {
					if ( isIE6 ) {
						self.el.css({
							top: parseInt(self.options.offsetTop) + $(document).scrollTop()
						});
					}
					else {
						self.el.css({
							top: parseInt(self.options.offsetTop)
						});
					}
				}
				else {
					self.el.css({
						top: parseInt(self.options.initTop)
					});
				}
			});
		}
		//setup
		var options = arguments[0];
		this.each(function () {
			new $adsControl($(this), options);
		});
	}
});