/**
	This is the main Javascript for NoblePeak
*/
$(document).ready(function() {
	wrapInlineList($('ul#people li'), 4);
	if(!$("#belowthefold").hasClass("notmatched")) {
		matchHeights($('#belowthefold').children());	
	}
});

/**
	Matches the heights of the bottom "below the fold" items, or 
	really will match the height of any set of list items like for
	when the titles in about us get too tall... Might do the same to it as well.
*/
function matchHeights(targets)
{
	// could check to make sure there are more then one item to compare, i guess...
	var targetHeight, maxHeight = 0;
	
	targets.each(function(i){
		targetHeight = $(this).height();
		maxHeight = (maxHeight < targetHeight)? targetHeight:maxHeight;
	});
	
	targets.height(maxHeight);
}

/**
	Removes margin-right for every Nth item in people section.
*/
function wrapInlineList(targets, n)
{
	if(targets.size() > n){
		targets.each(function(i) {
			if((i+1)%n == 0) $(this).addClass("last"); //.next().css("clear", "left")
		});
	}
}