function addValue(form, fieldname, selectname){
	var option = form.elements[fieldname];
	var select = form.elements[selectname];
	
	if(option.value == ""){
		alert("The field has no information in it!");
		return;
	}
	
	var length = select.length;
	if(length == 1 && select.options[0].value == ""){
		length = 0;
		select.options[0] = null;
	}
	
	select.options[length] = new Option(option.value, option.value);
	
	option.value = "";
	option.focus();
}

function removeValue(form, selectname){
	var select = form.elements[selectname];
	
	for(var i = 0; i < select.length; i++){
		if(select.options[i].selected){
			select.options[i] = null;
		}
	}
}

function buildList(form, selectname, hiddenname){
	var select = form.elements[selectname];
	var hiddenfield = form.elements[hiddenname];
	var list = new Array(select.length);
	
	for(var i = 0; i < select.length; i++){
		list[i] = select.options[i].value;
	}
	
	hiddenfield.value = list.join("|");
}
