function OOBannerBlock(_obj) {
	this.obj = $(_obj);
	this.top = this.obj.offset().top;
	this.left = this.obj.offset().left;
	this.on = false;
}

function OOBanner(_block) {
	this.items = new Array();
	this.length = 0;

	$(window).bind('load', this.init(_block));
}

OOBanner.prototype.init = function(_block) {
	var ref = this;

	$(_block).each(function() {
		ref.items.push(new OOBannerBlock(this));
		ref.length++;
	});

	$(window).scroll(function(){
		ref.scroll();
	});
}

OOBanner.prototype.scroll = function() {
	var top = $(window).scrollTop() + 20;

	for (n = 0; n < this.length; n++) {
		if (top > this.items[n].top) {
			/*this.items[n].obj.css({'top': (top - this.items[n].top) + 'px'})*/

			if (!this.items[n].on) {
				this.items[n].on = true;
				this.items[n].obj.css({'top': 20 + 'px', 'left': this.items[n].left + 'px', 'position': 'fixed'});
			}

		} else {
			//this.items[n].obj.css({'top': '0px'})

			if (this.items[n].on) {
				this.items[n].on = false;
				this.items[n].obj.css({'top': '0px', 'left': '0px', 'position': 'static'});
			}
		}
	}
}
