scripts/menu.js
/**
 * Move a selected Recent Custom item to the top of its respective Drop-Down List optgroup
 * @param {String} ddl The value of a Drop-Down List's ID attribute
 * @param {Object} customOptions A jQuery encapsulated HTML optgroup tag
 */
Move a selected Recent Custom item to the top of its respective Drop-Down List optgroup
@param {String} ddl The value of a Drop-Down List's ID attribute
@param {Object} customOptions A jQuery encapsulated HTML optgroup tag
Move a selected Recent Custom item to the top of its respective Drop - Down List optgroup @param { String } ddl The value of a Drop - Down List ' s ID attribute @param { Object } customOptions A jQuery encapsulated HTML optgroup tag
function moveSelectedMenuItemToTop(ddl, customOptions) {
	var selectedOption = $("#" + ddl + " option:selected");
	if(selectedOption.parent().attr("id") == customOptions.attr("id"))
	{
		var optionPosition = selectedOption.prevAll().size();
		for(var i = 0; i < optionPosition; i++)
			selectedOption.prev().before(selectedOption);
	}
}
function moveSelectedMenuItemToTop ( ddl , customOptions ) { var selectedOption = $ ( "#" + ddl + " option:selected" ) ; if ( selectedOption . parent ( ) . attr ( "id" ) == customOptions . attr ( "id" ) ) { var optionPosition = selectedOption . prevAll ( ) . size ( ) ; for ( var i = 0 ; i < optionPosition ; i ++ ) selectedOption . prev ( ) . before ( selectedOption ) ; } }
Move a selected Recent Custom item to the top of its respective Drop-Down List optgroup
 @param {String} ddl The value of a Drop-Down List's ID attribute
 @param {Object} customOptions A jQuery encapsulated HTML optgroup tag
Move a selected Recent Custom item to the top of its respective Drop - Down List optgroup @param { String } ddl The value of a Drop - Down List ' s ID attribute @param { Object } customOptions A jQuery encapsulated HTML optgroup tag
//Check that an item from a Recent Custom optgroup was chosen /* Count the number of elements that precede the selected option. As indexes start at 0, 
		 * the index of the selected option is equal to the number of elements behind it. (Its position
		 * would be the number of elements + 1 if indexes started at 1) */ /* Get the previous Option and set it to be before the selectedOption. Repeat this for
		 * all elements that precede the selectedOption such that the selectedOption ends up at
		 * the top of the Drop-Down List */