var Neighborhoods = Class.create({
	initialize: function(container) {
		this.container = $(container);
		this.column    = this.container.select("div.cols")[0];
		this.images    = this.container.select("div.gallery img");
		this.togglers  = this.column.select('ul a');
		this.count     = this.togglers.length;
		this.setup();
	},
	setup: function() {
		this.configure(this.column);
		this.togglers.each(function(el, i) {
			el.observe("click", this.show.bindAsEventListener(this, i)) }.bind(this));
	},
	configure: function(col) {
		var content = col.down("div.scroll-content");
		var track   = col.down("div.track");
		var handle  = col.down("div.knob");
		
		this.scroller = new Control.Scroller(content, handle, track, {
			up:   col.down("div.up"),
			down: col.down("div.down"),
			axis: "vertical"
		});
	},
	show: function(event, sel) {
		for (var i = 0; i < this.count; i++) {
			this.deactivate(i);
		}
		this.activate(sel);
		// NOTE SEVENWIRE below was removed as per defined functionality
		// event.stop();
	},
	deactivate: function(pos) {
		this.images[pos].removeClassName("active");
	},
	activate: function(pos) {
		this.images[pos].addClassName("active");
	}
});

/* ---------------------------------------------------------------- */
document.observe("dom:loaded", function(){
	new Tabs("tl-favorites");
	new Neighborhoods("neighborhoods");
	new Accordion("accordion");
});
