anchor.diff:  	return false;
   }
   
  -// insert sort
  -function sort(list, comparator) {
  -    for (var i=0; i<list.length; i++) {
  -   		for (var j=i; j>0 && comparator(list[j-1], list[j])>0; j--) {
  -    	    swap(list, j, j-1);
  -		}
  -	}
  -    return;
  -}
  -
  -function swap(list, a, b) {
  -	var t = list[a];
  -	list[a] = list[b];
  -	list[b] = t;
  +function topoSort(list) {
  +    var retList = new Array();
  +	var finished = false;
  +	while(!finished) {
  +	    finished = true;
  +        for (var i=0; i<list.length; i++) {   
  +		    if (list[i]=="_visited_") {
  +				continue;
  +			}
  +			if (moduleDependencies[getPackageNameIndex(list[i])].length==0) {
  +			   retList.push(list[i]);
  +			   removeDependencies(list[i]);
  +			   finished = false;
  +			   list[i]="_visited_";
  +			}
  +		}
  +	}
  +	var cycle = new Array();
  +    for (var i=0; i<list.length; i++) {   
  +	    if (list[i]!="_visited_") {
  +			cycle.push(list[i]);
  +		}
  +	}
  +	if (cycle.length>0) {
  +	   alert("One or more dependency cycles has been detected.\n\nInvolved modules are:\n"+cycle.join("\n"));
  +	   retList = retList.concat(cycle);
  +	}
  +	retList.reverse();
  +	return retList;
  +}
  +
  +function removeDependencies(module) {
  +    for (var i=0; i<moduleDependencies.length; i++) {
  +		var newDeps = new Array();
  +		var deps = moduleDependencies[i];
  +		for (var j=0; j<deps.length; j++) {
  +		   if (deps[j]==module) {
  +			   continue;
  +		   }
  +		   newDeps.push(deps[j]);
  +		}
  +		moduleDependencies[i] = newDeps;
  +    }
   }
   
   //-->
  
positive.code: 			}
  		}
  	
  		sort(installModules, compareModules);
  
  		var moduleList = "";
  		for (var j=0;j<installModules.length;j++) {
  			moduleList += installModules[j];
  		
  			if (j<installModules.length-1) {
  				moduleList += "|";
  			}
  		}
  	
  		form.installModules.value = moduleList;
  	} else {
  		if (form.availableModules != null) {
  			form.installModules.value = form.availableModules.value;
  
negative.code: 	}
  }
  
  function sortAvailableModules() {
  	var form = document.modules;	
  	var installModules = new Array();
  