<!--
function addList(fromList, toList) {
	Listbox_addSelected(fromList, toList);
	Listbox_deleteSelected(fromList);
}

function selectList(theList) {
    Listbox_selectAll(theList);
}

function makeList(theList, theField) {
	Listbox_makeSeparatedString(theList, theField, ",");
}

function upList(theList) {
    var newIndex = 0;
    for (var j = 0; j < theList.options.length; j++) {
        if (theList.options[j].selected) {
            if (j > 0) {
                upText = theList.options[j].text;
                upValue = theList.options[j].value;
                downText = theList.options[j-1].text;
                downValue = theList.options[j-1].value;

                theList.options[j].text = downText;
                theList.options[j].value = downValue;
                theList.options[j-1].text = upText;
                theList.options[j-1].value = upValue;

                theList.options[j].selected = false;
                theList.options[j-1].selected = true;
            }
        }
    }
}

function downList(theList) {
    var newIndex = 0;
    for (var j = theList.options.length-1; j >= 0; j--) {
        if (theList.options[j].selected) {
            if (j < theList.options.length-1) {
                upText = theList.options[j+1].text;
                upValue = theList.options[j+1].value;
                downText = theList.options[j].text;
                downValue = theList.options[j].value;

                theList.options[j+1].text = downText;
                theList.options[j+1].value = downValue;
                theList.options[j].text = upText;
                theList.options[j].value = upValue;

                theList.options[j].selected = false;
                theList.options[j+1].selected = true;
            }
        }
    }
}

function Listbox_selectAll(theList) {
    for (var j = theList.options.length-1; j >= 0; j--) {
        theList.options[j].selected = true;
    }
}

function Listbox_deselectAll(theList) {
    for (var j = theList.options.length-1; j >= 0; j--) {
        theList.options[j].selected = false;
    }
}

function Listbox_addSelected(fromList, toList) {
	var newIndex = 0;
	for (var j = 0; j < fromList.options.length; j++) {
        if (fromList.options[j].selected) {
        	newText = fromList.options[j].text;
        	newValue = fromList.options[j].value;
        } else {
        	newValue = -1;
        	newText = "";
        }
        newIndex = -1;
        for (var i = toList.options.length-1; i >= 0; i--) {
        	if (toList.options[i].index > newIndex) {
				newIndex = toList.options[i].index;
			}
        }
        if ((newValue != -1) && (newText != "")) {
			// add at last position
        	newIndex=newIndex+1;
        	toList.options[newIndex] = new Option(newText, newValue)
        }
	}
}

function Listbox_deleteSelected(theList) {
	for (var j = theList.options.length-1; j >= 0; j--) {
       	if (theList.options[j].selected) {
       		Listbox_delete(theList, j);
       	}
	}
}

function Listbox_selectValue(theList, value) {
        for (var i = 0; i < theList.options.length; i++) {
                if (theList.options[i].value == value) {
                        theList.options[i].selected = true;
                }
	}
}

function Listbox_delete(theList, theIndex) {
	theList.options[theIndex].selected = false;
	theList.options[theIndex] = null;
}

function Listbox_makeSeparatedString(theList, theField, separator) {
	theField.value = "";
	for (var i = 0; i < theList.options.length; i++) {
        if ((theList.options[i] != null) && (theList.options[i].value != "")) {
        	if (theField.value == "") {
                theField.value = theList.options[i].value;
        	} else {
	            theField.value = theField.value + separator + theList.options[i].value;
  			}
		}
	}
}
//-->
