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