            // Add a new ListItem to the ListBosID_ADDED HiddenField
            function AddListItem(listName, text, value)
            { 
                var hiddenField = GetHiddenField(listName.id + '_ADDED');

                if (hiddenField != null)
                {
		            // Add a separator
		            var tmp = hiddenField.value;
		            if (tmp != '')
		               hiddenField.value += ',';

		            // Add the item to the hidden field
		            hiddenField.value += text + '|' + value; 
            		
		            // if present in the REMOVED hidden field, remove it
		            var removeHiddenField = GetHiddenField(listName.id + '_REMOVED');
		            if (removeHiddenField != null)
		            {
			            var removedItems = removeHiddenField.value.split(',');
			            removeHiddenField.value = '';
			            for (var i=0;i<removedItems.length;i++)
			            {
				            if (value != removedItems[i])
				            {
					            // Add a separator
					            var tmp1 = removeHiddenField.value;
					            if (tmp1 != '')
						            removeHiddenField.value += ',';

					            removeHiddenField.value += removedItems[i]; 
				            }
			            }			
		            }
	            }
            }

            // Removes an item from the ListBoxID_REMOVED HiddenField
            function RemoveListItem(listName, value)
            {   
                var hiddenField = GetHiddenField(listName.id + '_REMOVED');

                if (hiddenField != null)
                {
		            // Add a separator
		            var tmp = hiddenField.value;
		            if (tmp != '')
		               hiddenField.value += ',';

		            hiddenField.value += value; 
            		
		            // if present in the ADDED hidden field, remove it
		            var addHiddenField = GetHiddenField(listName.id + '_ADDED');
		            if (addHiddenField != null)
		            {
			            var addedItems = addHiddenField.value.split(',');
			            addHiddenField.value = '';
			            for (var i=0;i<addedItems.length;i++)
			            {
				            if (addedItems[i].match(value) == null)
				            {
					            // Add a separator
					            var tmp1 = addHiddenField.value;
					            if (tmp1 != '')
						            addHiddenField.value += ',';

					            addHiddenField.value += addedItems[i]; 
				            }
			            }			
		            }
                }
            }

            // Finds a hidden field on the page
            function GetHiddenField(fieldName)
            {
                var hiddenField;
                hiddenField = document.getElementById(fieldName);
                
                if (hiddenField != null)
                    return hiddenField;
                    
                return null;
            }          
