public String resolvePath(String s) {
		if (FileUtilities.isRemote(s))
			return s;
		String lc = s.toLowerCase();
		if (lc.startsWith("mailto:"))
			return s;
		if (lc.startsWith("script:"))
			return s;
		if (lc.indexOf("client=mw") != -1) {
			// this means that when refering to a web service, you should use an address relative to its
			// context root, regardless of where the current directory is.
			return Modeler.getContextRoot() + s;
		}
		// link to concord search engine
		if (lc.startsWith("/cgi-bin/"))
			return "http://www.concord.org" + s;
		if (isRemote() && FileUtilities.isRelative(s) && pageURI != null) { // resolving network paths
			String s2 = s.replace('\\', '/');
			s2 = FileUtilities.httpEncode(s2);
			return pageURI.resolve(s2).toString();
		}
		// resolving local paths
		if (OS.startsWith("Windows")) {
			if (s.charAt(1) == ':')
				return s;
		} else {
			if (s.charAt(0) == '/')
				return s;
		}
		int fromIndex = 0, count = 0;
		while (fromIndex > -1) {
			fromIndex = s.indexOf("..", fromIndex);
			if (fromIndex >= 0) {
				fromIndex += 2;
				count++;
			}
		}
		String s2 = s.replace('\\', '/');
		String[] s3 = s2.split("/");
		ArrayList<String> list = new ArrayList<String>();
		for (int k = 0; k < s3.length; k++) {
			if (!s3[k].trim().equals("") && !s3[k].equals("."))
				list.add(s3[k]);
		}
		String[] s1 = new String[list.size()];
		for (int k = 0; k < s1.length; k++) {
			s1[k] = list.get(k);
		}
		String b = getPathBase(pageAddress);
		if (b == null || b.equals("")) {
			return s;
		}
		if (FileUtilities.isRemote(b)) {
			String[] b1 = b.substring(7).split("/");
			String path = "http://";
			int i;
			for (i = 0; i < b1.length - count; i++)
				path += b1[i] + "/";
			for (i = count; i < s1.length - 1; i++)
				path += s1[i] + "/";
			path += s1[s1.length - 1];
			return path;
		}
		String b2 = b.replace('\\', '/');
		String[] b1 = b2.split("/");
		String path = "";
		int i;
		String fs = System.getProperty("file.separator");
		for (i = 0; i < b1.length - count; i++)
			path += b1[i] + fs;
		for (i = count; i < s1.length - 1; i++)
			path += s1[i] + fs;
		path += s1[s1.length - 1];
		return path;
	}