/*
FUNCTION: addToList
DESCRIPTION: adds an option to a select menu
*/

function addToList (listObj,uValue,uText){
	var totalInList = listObj.length;
	var newOpt = new Option(uText,uValue);
	newOpt.selected = true;
	listObj.options[totalInList] = newOpt;
}//end function

/*
FUNCTION: removeFromList
DESCRIPTION: removes an option from a select menu
*/

function removeFromList (listObj,idx){
	listObj.options[idx] = null;
}//end function

/*
FUNCTION: parseLists
DESCRIPTION: loops through the selected options in a list and performs an action
*/

function parseLists (listObj1,listObj2){
	var totalInList1 = listObj1.length;
	
	//add to new list
	for ( i = 0; i < totalInList1; i++ ){
		if ( listObj1.options[i].selected == true ){
			addToList(listObj2,listObj1.options[i].value,listObj1.options[i].text);
		}//end if
	}//end for

	//remove from current list
	var current = 0;
	for ( i = 0; i < totalInList1; i++ ){
		if ( listObj1.options[current].selected == true ){
			removeFromList(listObj1,current);
		} else {
			current++;
		}//end if
	}//end for

}//end function

/*
FUNCTION: setSelected
DESCRIPTION: loops through the given select menu list and sets them all to be
			 selected
*/

function setSelected(listObj1){
	var totalInList1 = listObj1.length;
	for ( i = 0; i < totalInList1; i++ ){
		listObj1.options[i].selected = true;
	}//end for
}//end function

