// Copyright 2002, 2003 Macromedia, Inc. All rights reserved.

function canAcceptCommand()
{
	var dom = dw.getDocumentDOM();
	var wm = null;
	if (dom)
		wm = CCWorkspaceManager.getManager(dom);
	
	// charles - removed the test for "wm.getState() == 'browse'" because it was
	// failing for dialog browsers, like the link dialog's dialog browser
	// return (dom && wm && (wm.getState() == 'browse') && wm.getSiteHomePages().length > 0);
	return (dom && dw.isCCOnline() && wm && wm.getSiteHomePages().length > 0);
}

function run()
{
	var dom = dw.getDocumentDOM();
	if (dom)
	{
		var wm = CCWorkspaceManager.getManager(dom);
		if (wm)
		{
      var newURL = dw.popupRemoteFileBrowser ();
      if (newURL)
      {
        newURL = dw.doURLEncoding (newURL);
        wm.setURLAndState(newURL, "browse");
      }
		}
	}
	return null;
}
