$(function() {
  /* position of sub menu (script turns div order upside down */
	if ($('#menu').hasClass('lower'))
	{
		var $children = null;
		
		$('#sub-menu').each(function() {
		$children = $(this).children('div.sub-menu-item').get();
		$(this).empty();
		$children.reverse();
		
			$(this).append($children);
			
			$($children).each(function() {
			$(this).val($children.length - $($children).index(this));
			});
		
		});
		
		// change menu content above the main menu button
		$('#menu').prepend($('#menu-content'));
		}	
});		
