rem: var tree = document.getElementById("engineList") var selectedItems = tree.selectedItems; if (!selectedItems && selectedItems.length != 1) return false; var ref = tree.getAttribute("ref"); var categoryResource = RDF.GetResource(ref); var elementResource = RDF.GetResource(selectedItems[0].id); RDFC.Init(catDS, categoryResource); var nodeIndex = RDFC.IndexOf(elementResource); 
add: var engineList = document.getElementById("engineList") var selectedItems = engineList.selectedItems; var nodeIndex = -1; if (selectedItems && selectedItems.length == 1) { var ref = engineList.getAttribute("ref"); var categoryResource = RDF.GetResource(ref); var elementResource = RDF.GetResource(selectedItems[0].id); RDFC.Init(catDS, categoryResource); nodeIndex = RDFC.IndexOf(elementResource); }  
context: function doMoveDirectionEnabling(){  var tree = document.getElementById("engineList")  var selectedItems = tree.selectedItems;  if (!selectedItems && selectedItems.length != 1)    return false;  var ref = tree.getAttribute("ref");  var categoryResource = RDF.GetResource(ref);  var elementResource = RDF.GetResource(selectedItems[0].id);  RDFC.Init(catDS, categoryResource);  var nodeIndex = RDFC.IndexOf(elementResource);  var moveUpButton = document.getElementById("up");  var moveDownButton = document.getElementById("down");  moveUpButton.removeAttribute("disabled");  moveDownButton.removeAttribute("disabled");  if (nodeIndex <= 1)    moveUpButton.setAttribute("disabled", "true");  if (nodeIndex >= RDFC.GetCount())    moveDownButton.setAttribute("disabled", "true");}
meta: 5872	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/5872/d38a0937d9c93a0a9d913e2ac781e4328bb8cc73/search-editor.js/buggy/xpfe/components/search/resources/search-editor.js