jQuery(document).ready(function() {
	var navContainer = jQuery('.top-nav-container ul.top-nav');
	
	if (navContainer.length > 0) {
	
		navContainer.each(function() {
			var listItems = jQuery(this).find('li');
			
			var width	  = jQuery(this).width();
			
			// set a extreme width for the overflow=hidden feature
			jQuery(this).css('width', 2000);
			
			
			var tempCount = 0;
			
			listItems.each(function(i) {
				tempCount += jQuery(this).width();
			});
			
			
			var freePixel = width - tempCount;
			var pixelPerItem = freePixel / (listItems.length - 1);
			
			listItems.find('a').each(function(i) {
			
				if (i == 0) {
					// CONTINUE if the home button is here
					return true;
				}
				
				var newWidth = jQuery(this).width() + pixelPerItem;
				jQuery(this).css('width', newWidth);
				
 			});
			
		});
	}
});
