// Fire up jQuery
$(document).ready(function(){

	// Auto clear search form on focus
	$('#formSearchInput, #formStayConnected input[type="text"], #formStayConnected textarea').focus(function() {
		if (this.value == this.defaultValue) {
			this.value = "";
		}
	}).blur(function() {
		if (!this.value.length) {
			this.value = this.defaultValue;
		}
	});
	
	// New windows
	$("a[href*='http://']:not([href*='"+location.hostname+"']),[href*='https://']:not([href*='"+location.hostname+"'])").attr("target","_blank");
	
	// Set class on dropdowns
	$('#navMain ul > li').hover(function() {
		$(this).addClass('hover').find('ul').slideDown('fast');
	}, function() {
		$(this).removeClass('hover').find('ul').slideUp('fast');
	});
	$('#navMain li ul').hover(function() {
		$(this).parent().addClass('hover');
	}, function() {
		$(this).parent().removeClass('hover');
	});
	
	// Who We Are / Clients - Vertical Center
	$(window).load(
		function() {
			$('.clients #right img').each(function() {
				var imgMargin = (61 - $(this).height()) / 2;
				$(this).css({'margin-top' : imgMargin});
			}
		)
	});
	
	// Who We Are / People - Accordion
	$('.people h3:not(.active)').live('click', function() {
		$('.people h3').removeClass();
		$('.people dl').slideUp(200);
		$(this).addClass('active');
		$(this).next().slideDown(200);
	});
	
	// Homepage - Arrow bullet
	$('.home #right dt:first').addClass('first');
	
	// Who We Are / Clients - Arrow bullet
	$('.careers #openings li').prepend('&gt; ');
	
	// Affiliations first p
	$('.affiliations #left p:first').addClass('first');
	
	// Equal case study column height
	var high = $('.case #right').height();
	$('.case #left').height(high);
	
	// Remove random text bit
	$('.perspectives #left h3:eq(1)').detach();
	
	$('.pubs #right ul, .contracts #right div').jScrollPane();


});
