Chris@909: var NS4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) < 5); Chris@909: Chris@909: function addOption(theSel, theText, theValue) Chris@909: { Chris@909: var newOpt = new Option(theText, theValue); Chris@909: var selLength = theSel.length; Chris@909: theSel.options[selLength] = newOpt; Chris@909: } Chris@909: Chris@909: function swapOptions(theSel, index1, index2) Chris@909: { Chris@909: var text, value; Chris@909: text = theSel.options[index1].text; Chris@909: value = theSel.options[index1].value; Chris@909: theSel.options[index1].text = theSel.options[index2].text; Chris@909: theSel.options[index1].value = theSel.options[index2].value; Chris@909: theSel.options[index2].text = text; Chris@909: theSel.options[index2].value = value; Chris@909: } Chris@909: Chris@909: function deleteOption(theSel, theIndex) Chris@909: { Chris@909: var selLength = theSel.length; Chris@909: if(selLength>0) Chris@909: { Chris@909: theSel.options[theIndex] = null; Chris@909: } Chris@909: } Chris@909: Chris@909: function moveOptions(theSelFrom, theSelTo) Chris@909: { Chris@909: Chris@909: var selLength = theSelFrom.length; Chris@909: var selectedText = new Array(); Chris@909: var selectedValues = new Array(); Chris@909: var selectedCount = 0; Chris@909: Chris@909: var i; Chris@909: Chris@909: for(i=selLength-1; i>=0; i--) Chris@909: { Chris@909: if(theSelFrom.options[i].selected) Chris@909: { Chris@909: selectedText[selectedCount] = theSelFrom.options[i].text; Chris@909: selectedValues[selectedCount] = theSelFrom.options[i].value; Chris@909: deleteOption(theSelFrom, i); Chris@909: selectedCount++; Chris@909: } Chris@909: } Chris@909: Chris@909: for(i=selectedCount-1; i>=0; i--) Chris@909: { Chris@909: addOption(theSelTo, selectedText[i], selectedValues[i]); Chris@909: } Chris@909: Chris@909: if(NS4) history.go(0); Chris@909: } Chris@909: Chris@909: function moveOptionUp(theSel) { Chris@909: var index = theSel.selectedIndex; Chris@909: if (index > 0) { Chris@909: swapOptions(theSel, index-1, index); Chris@909: theSel.selectedIndex = index-1; Chris@909: } Chris@909: } Chris@909: Chris@909: function moveOptionDown(theSel) { Chris@909: var index = theSel.selectedIndex; Chris@909: if (index < theSel.length - 1) { Chris@909: swapOptions(theSel, index, index+1); Chris@909: theSel.selectedIndex = index+1; Chris@909: } Chris@909: } Chris@909: Chris@909: function selectAllOptions(id) Chris@909: { Chris@909: var select = $(id); Chris@909: for (var i=0; i