function optionexists(selectlst) {
	if (selectlst!=null && selectlst.options!=null) { return true; }
	return false;
	}

function switchValues(selectlst,first,second) {
	var obj = selectlst.options;
	var first_selected = obj[first].selected;
	var second_selected = obj[second].selected;
	var temp = new Option(obj[first].text, obj[first].value, obj[first].defaultSelected, obj[first].selected);
	var temp2= new Option(obj[second].text, obj[second].value, obj[second].defaultSelected, obj[second].selected);
	obj[first] = temp2;
	obj[second] = temp;
	obj[first].selected = second_selected;
	obj[second].selected = first_selected;
	}

function moveUp(selectlst) {
	if (!optionexists(selectlst)) { return; }
	for (i=0; i<selectlst.options.length; i++) {
		if (selectlst.options[i].selected) {
			if (i != 0 && !selectlst.options[i-1].selected) {
				switchValues(selectlst,i,i-1);
				selectlst.options[i-1].selected = true;
				}
			}
		}
	}


function moveDown(selectlst) {
	if (!optionexists(selectlst)) { return; }
	for (i=selectlst.options.length-1; i>=0; i--) {
		if (selectlst.options[i].selected) {
			if (i != (selectlst.options.length-1) && ! selectlst.options[i+1].selected) {
				switchValues(selectlst,i,i+1);
				selectlst.options[i+1].selected = true;
				}
			}
		}
	}



