function select_multi(id, form) {
  var el = document.getElementById(id);
  for (i = 0; i < el.length; i++) {
    el[i].selected = true;
  }
  document.getElementById(form).submit();
}

function compareText(a, b) {
  if (a.text < b.text) return -1;
  if (a.text > b.text) return 1;
  return 0;
}

function moveMulti(fromList, toList, blnSort, maxItems) {
  var newCount = 0;
  if (fromList.selectedIndex == -1) return;
  if (maxItems != null) {
	  if (toList.options.length >= maxItems) {
		  alert("You have exceeded the maximum allowable selections");
		  return;
	  }
  }
  for (var i = 0; i < fromList.options.length; i++) {
	  if (fromList.options[i] != null && fromList.options[i].selected == true) {
		  if (toList.options.length + newCount++ > maxItems && maxItems != null) {
			  fromList.options[i].selected = false;
		  } else {
			  toList.options[toList.options.length] = new Option(fromList.options[i].text, fromList.options[i].value, fromList.options[i].defaultSelected, fromList.options[i].selected);
		  }
	  }
  }
  if (blnSort) {
	  tmpList = new Array(toList.options.length);
	  for (var i = 0; i < toList.options.length; i++) {
		  tmpList[i] = new Option(toList.options[i].text, toList.options[i].value, toList.options[i].defaultSelected, toList.options[i].selected);
	  }
	  tmpList.sort(compareText);
	  for (var i = 0; i < tmpList.length; i++) {
		  toList.options[i].text = tmpList[i].text;
		  toList.options[i].value = tmpList[i].value;
		  toList.options[i].defaultSelected = tmpList[i].defaultSelected;
		  toList.options[i].selected = tmpList[i].selected;
	  }
  }
  for (var i = fromList.options.length - 1; i >= 0; i--) {
	  if (fromList.options[i] != null && fromList.options[i].selected == true) {
		  fromList.options[i] = null;
	  }
  }
  if (maxItems != null) {
	  if (newCount + toList.options.length > maxItems + 2) {
		  alert("You have exceeded the maximum allowable selections");
	  }
  }
}