function jmDownloadResults()
{
	lvFroceOutOfEdit();

	var activeBranches = ds.Tree.ActiveBranches;
	if(!activeBranches || activeBranches.Count == 0 )
	{
		WBScript.Out(localString("ID_JSNoActiveSolutions"), true);
		return;
	}

	var numObjs = activeBranches.Count;

	// save the silent mode in effect when the menu item was selected	
	var silentMode = WBScript.Silent;
	if( ds.GUIState )
		ds.GUIState.MenusLocked = true;
	
	// if num active branches is > 1 then make script silent
	if( numObjs > 1 )
		WBScript.Silent = true;
	
	for( var i=1; i<=numObjs; i++ )
	{
		var ansObj = activeBranches.Item(i).AnswerSet;
		if(!ansObj)
			continue; // no error.  shouldn't happen

		var jobdesc = ansObj.RemoteJobDescriptor;
		if( !jobdesc || jobdesc == "" )
			continue;

		var state = ansObj.SolvingState;
		if( state == id_ReadyForDownload || state == id_SolveFailedNotLoaded )
		{
			disableTabs( true );
			ansObj.LoadRemoteResults( "" );
			disableTabs( false );
		}
	}
	
	// If I got here then no more results need to be loaded
	//
	WBScript.Silent = silentMode;
	if( ds.GUIState )
		ds.GUIState.MenusLocked = false;
}


function jmDisconnectRSMJob() {

    var ansObj = ds.Tree.FirstActiveObject;
    if (!ansObj) {
        WBScript.Out(localString("ID_JSNoActiveSolutions"), true);
        return;
    }
    var activeObjectCLSID = ansObj.Class;
    if (activeObjectCLSID != id_AnswerSet)
        return;

    var jobdesc = ansObj.RemoteJobDescriptor;
    if (!jobdesc || jobdesc == "")
        return;

    if (ds.GUIState)
        ds.GUIState.MenusLocked = true;
    var state = ansObj.SolvingState;
    if (state == id_ReadyForDownload || state == id_SolveFailedNotLoaded || state == id_Solving) {
        disableTabs(true);
        ansObj.DisconnectRSMJob();
        disableTabs(false);
    }

    if (ds.GUIState)
        ds.GUIState.MenusLocked = false;
}

