$('.menu.tabs').each(function(index) {
	var target_selectors = [];
	var $triggers = $('a', $(this)).each(function(index) {
		target_selectors.push(this.hash);
	})
	.click(function() {
		$triggers.removeClass("active");
		if((/show_all$/).test(this.hash))
		{
			$targets.fadeIn();
			$(this).text("Hide All Staff").attr("href", "#hide_all");
		}
		else if((/hide_all$/).test(this.hash))
		{
			$targets.hide();
			$(this).text("Show All Staff").attr("href", "#show_all");
		}
		else
		{
			$(this).addClass("active");
			$targets.not(this.hash).hide();
			$targets.filter(this.hash).fadeIn();
		}
		return false;
	});
	var $targets = $(target_selectors.join(", ")).hide();
	if(window.location.hash) {
		if ($triggers.filter("[href='"+window.location.hash+"']").size()) {
			$triggers.filter("[href='"+window.location.hash+"']").click();
		} else {
			$triggers.eq(0).click();
		}
	} else {
		if ($triggers.eq(0).attr("href") == "#office-corporate") {
			$targets.hide();
		} else {
			$triggers.eq(0).click();
		}
	}
});
