// menu animation

$(function() {
	$('#nav > ul li').hover(
		function() {
			$(this).find('ul:first').show();
		},
		function() {
			$(this).find('ul:first').hide();
		});
});

// horizontal rule replacement
$(function(){
	$("hr").wrap("<div class='hr'></div>");
	$("div.hr > hr").hide();
});

// leadership accordion
$(function() {
	var details = $('dl#leaders dd');
	var titles = $('#leaders dt');
	details.hide();
	titles.click(function() {
		details.slideUp();
		$(this).next().slideDown('slow');
	});
});

// external links
$(function() {
  $('a').filter(function() {
	return this.hostname && this.hostname !== location.hostname;
  }).click(function() {
    window.open(this.href);
    return false;
  });
});
 
// style title tooltips
$(function(){
	$("*[title]").hover(function(elem) {
		var xOffset = 10;
		var yOffset = 10;
		this.temp = this.title;
		this.title = "";
		$("body").append("<div id='tooltip'>"+ this.temp +"</div>");
		$("#tooltip").css ("top", (elem.pageY - xOffset) + "px").css("left",(elem.pageX + yOffset) + "px").animate({opacity:.7}, 600).fadeIn('slow');
		$(this).mousemove(function(elem){
		$("#tooltip")
			.css("top",(elem.pageY - xOffset) + "px")
			.css("left",(elem.pageX + yOffset) + "px");
	});	
	}, function() {
		this.title = this.temp;
		$("#tooltip").fadeOut().remove();
	});
});							
