﻿$(function() {
	nav();
	newWindowLinks();
});

function nav() {

	// For each <li>...
	$('#primaryNav > li').each(function() {

		// Grab jQuery objects for <li> and drop-down.
		var li = $(this);
		var dropdown = $('div', li);

		// If this <li> doesn't have a drop-down, continue to the next <li>.
		if (!dropdown.length) return;

		// When <li> is hovered upon, show the drop-down. When the <li> is hovered off of, hide it.
		li.hover(
			function() { dropdown.show() },
			function() { dropdown.hide() }
		);
	});
}

function newWindowLinks() {

	// Add target="_blank" to all <a>s with a class of 'newWindowLink'.
	$('a.newWindowLink').attr('target', '_blank');
}