String open(String nextPath) {
		ImagePlus imp2 = IJ.openImage(nextPath);
		if (imp2==null) return null;
		String newTitle = imp2.getTitle();
		if (imp0.changes) {
			String msg;
			String name = imp0.getTitle();
			if (name.length()>22)
				msg = "Save changes to\n" + "\"" + name + "\"?";
			else
				msg = "Save changes to \"" + name + "\"?";
			YesNoCancelDialog d = new YesNoCancelDialog(imp0.getWindow(), "ImageJ", msg);
			if (d.cancelPressed())
				return "Canceled";
			else if (d.yesPressed()) {
				FileSaver fs = new FileSaver(imp0);
				if (!fs.save())
					return "Canceled";
			}
			imp0.changes = false;
		}
		if (imp2.isComposite() || imp2.isHyperStack()) {
			imp2.show();
			imp0.close();
			imp0 = imp2;
		} else {
			imp0.setStack(newTitle, imp2.getStack());
			imp0.setCalibration(imp2.getCalibration());
			imp0.setFileInfo(imp2.getOriginalFileInfo());
			imp0.setProperty ("Info", imp2.getProperty ("Info"));
			ImageWindow win = imp0.getWindow();
			if (win!=null) win.repaint();
		}
		return "ok";
	}