$(document).ready(function()
{
	$('.who-we-are .profile-box').hide();
	$('.who-we-are a').click(function()
	{
		$('.who-we-are .profile-box').hide();
		var the_id = str_replace('#', '#box-', $(this).attr('href'));
		$(the_id).center().show();
		return false;
	});
	$('.close-box').click(function(){$('.profile-box').hide();});
	$(document).click(function(e){if (!$(e.target).hasClass('profile-box') && !$(e.target).parents().hasClass('profile-box')){$('.profile-box').hide();}});
	$('form').validate();
});

function str_replace(search, replace, subject)
{
	// http://kevin.vanzonneveld.net
	var f = search, r = replace, s = subject;
	var ra = r instanceof Array, sa = s instanceof Array, f = [].concat(f), r = [].concat(r), i = (s = [].concat(s)).length;
	while (j = 0, i--) { if (s[i]) { while (s[i] = (s[i]+'').split(f[j]).join(ra ? r[j] || "" : r[0]), ++j in f){} } }
	return sa ? s : s[0];
}

jQuery.fn.center = function()
{
	this.css('position','fixed');
	this.css('z-index','2000');
	this.css('top', ($(window).height() - this.height()) / 2 + 'px');
	//this.css('left', ($(window).width() - this.width()) / 2 + 'px');
	this.css('left', (800 - this.width()) / 2 + 'px');
	return this;
}

