/* jQuery code - executes when document finishes loading */

$(document).ready(function() {
	var char_limit = 18;					   
	var top_nav = $('#nav > li > span');					// get top level nav items
	top_nav.each( function() {								// for each of them,
		var el = $(this);
		var txt = el[0].firstChild.nodeValue;				// get text
		if (txt != null && txt.length > char_limit) {		// if the text is longer than the limit,
			el.parent().addClass('stacked');				// assign the stacked class to the parent <li>
		}
	});
});