function actionTabs() {
	var tabContainers = $('.actions .section');

	$('.actions .toc a').click(function() {
		tabContainers.hide().filter(this.hash).show();

		$('.actions .toc a').parent('li').removeClass('selected');
		$(this).parent('li').addClass('selected');

		return false;
	}).filter(':first').click();
}

Array.prototype.has = function(value) {
	var i;
	for (var i = 0, loopCnt = this.length; i < loopCnt; i++) {
		if (this[i] === value) {
			return true;
		}
	}
	return false;
};

var posused = new Array(); // make sure each logo is only shown once
$.fn.randomBGPos = function() {
	var y = 80, // height of each image in sprite
		num = 5; // number of positions in sprite
	return this.each(function() {
		var pos = 0;
		do {
			pos = Math.round(Math.random() * (num - 1) ) * -y;
		} while ( posused.has(pos) );
		posused.push(pos);
		$(this).css('background-position', '50% ' + pos + 'px');
	});
};

$(function() {
	actionTabs();
	$('#developerlist li:gt(2)').remove();
	$('#developerlist li').randomBGPos();
})
