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