Index: other-projects/gs3-webservices-java-client/trunk/src/GS3DemoClient/org/greenstone/gs3client/BrowseDisplay.java
===================================================================
--- other-projects/gs3-webservices-java-client/trunk/src/GS3DemoClient/org/greenstone/gs3client/BrowseDisplay.java	(revision 26174)
+++ other-projects/gs3-webservices-java-client/trunk/src/GS3DemoClient/org/greenstone/gs3client/BrowseDisplay.java	(revision 26180)
@@ -452,6 +452,5 @@
         	if(docNode.hasNoText()) { //NoText field is 1, meaning it's an img
         		// now display the image
-        		this.htmlPane.setText(
-        				Displays.getImgUrlEnclosedInHtml(docNode.getImgURL()));
+        		this.htmlPane.setText(Displays.getImgUrlEnclosedInHtml(client.getBaseURL(), docNode.getImgURL()));
         	} else { // it has text 
 	        	// Java's htmlpane does not recognise justified alignment.
@@ -464,5 +463,6 @@
         		String docContent = docNode.getContent().replaceAll(
             			"ALIGN=\"JUSTIFY\"", "ALIGN=\"LEFT\"");
-        		String baseURL = client.getBaseURL();
+			String baseURL = client.getBaseURL();
+			        		
         		// TODO: make the docNode itself work out its URL by passing
         		// baseURL to the docNode?
@@ -477,4 +477,11 @@
         				= (HTMLDocument)this.htmlPane.getDocument();
         			try{
+				    
+				    switch(client.getActiveDL()) {
+				    
+				    case GS3JavaClient.GREENSTONE:
+					doc.setBase(new URL(baseURL));
+					break;
+				    case GS3JavaClient.FEDORA:				    
         				URL url = new URL(baseURL+docNode.getRoot().nodeID+"/");
         				//System.err.println("url: " + url.toString());
@@ -482,8 +489,13 @@
         				//docContent = docContent.replaceAll("_httpdocimg_/", "");
         				LOG.debug(docContent);
+					break;
+				    default:
+					break;
+				    }
+				    
         			}catch(MalformedURLException mex) {
         				; //nothing to be done, leave the base as it is
         			}
-        		}
+			}
 	            this.htmlPane.setText(docContent);
         	}
@@ -498,5 +510,5 @@
 		c.setCursor(Cursor.getDefaultCursor()); // set the cursor back to normal
 	}
-	
+
 	/** Inner class (not static, as it needs access to outerclass' this object.
 	 * This class represents a button that encapsulates a ClassifierData 
Index: other-projects/gs3-webservices-java-client/trunk/src/GS3DemoClient/org/greenstone/gs3client/Displays.java
===================================================================
--- other-projects/gs3-webservices-java-client/trunk/src/GS3DemoClient/org/greenstone/gs3client/Displays.java	(revision 26174)
+++ other-projects/gs3-webservices-java-client/trunk/src/GS3DemoClient/org/greenstone/gs3client/Displays.java	(revision 26180)
@@ -85,8 +85,24 @@
 	 * @param imgURL - src URL for a (web) image 
 	 * @return the imgURL parameter enclosed in complete html */ 
-	public static String getImgUrlEnclosedInHtml(String imgURL) 
+	public static String getImgUrlEnclosedInHtml(String baseURL, String imgURL) 
 	{
-		return "<html><head></head><body><img src=" 
-			+ imgURL + "></body></html>";
+	    //return "<html><head></head><body><img src=" + imgURL + "></body></html>"; // old Greenstone3
+
+	    String htmlStr = "<html><head></head><body>";
+	    int index = imgURL.indexOf("<img src=");
+	    if(index != -1) { // if it already contains an image tag
+		// check if it's a relative url
+		index = imgURL.indexOf("://", index + "<img src=".length()); 
+		if(index == -1) { // relative, so doesn't have a file:// or http(s):// prefix
+		    imgURL = imgURL.replace("<img src=\"", "<img src=\""+baseURL);
+		}
+		htmlStr += imgURL;
+	    } 
+	    else { // Old GS3: doesn't yet contain an image tag, embed url in img tag
+		htmlStr = htmlStr + "<img src=" + imgURL + ">";
+	    }
+	    htmlStr += "</body></html>";
+	    return htmlStr;
+	    
 	}
 	
@@ -220,5 +236,5 @@
 	    	if(docNode.canBeImage())
 		    	htmlArea.setText(
-	    				getImgUrlEnclosedInHtml(docNode.getImgURL()));
+					 getImgUrlEnclosedInHtml(client.getBaseURL(), docNode.getImgURL()));
 	    		// JEditorPane does not understand <img />! So use only <img>
 	    	else {
@@ -227,5 +243,5 @@
 	    		// for the latest exported greenstone colllections
 	    		// into fedora, Greenstone prefixes FG in front of image name...
-	    		htmlArea.setText(getImgUrlEnclosedInHtml(filepath+filename));
+	    		htmlArea.setText(getImgUrlEnclosedInHtml(client.getBaseURL(), filepath+filename));
 	    	}
 				 
Index: other-projects/gs3-webservices-java-client/trunk/src/GS3DemoClient/org/greenstone/gs3client/GS3JavaClient.java
===================================================================
--- other-projects/gs3-webservices-java-client/trunk/src/GS3DemoClient/org/greenstone/gs3client/GS3JavaClient.java	(revision 26174)
+++ other-projects/gs3-webservices-java-client/trunk/src/GS3DemoClient/org/greenstone/gs3client/GS3JavaClient.java	(revision 26180)
@@ -145,7 +145,7 @@
 	protected JTabbedPane tabbedPane = null;	
 		
-	protected static final int SELECT = 0;
-	protected static final int GREENSTONE = 1;
-	protected static final int FEDORA = 2;
+	public static final int SELECT = 0;
+	public static final int GREENSTONE = 1;
+	public static final int FEDORA = 2;
 	protected static final String[] dlOptions = {"select", "greenstone", "fedora"};
 	
@@ -699,6 +699,4 @@
 				String response = dlAPIA.describeCollectionService(
 						colName, serviceName);
-				LOG.error("**** serviceResponse XML:" + response);
-				System.err.println("**** serviceResponse XML:" + response);
 
 				Element serviceResponseXML = getResponseAsDOM(
@@ -1056,4 +1054,9 @@
 		this.searchResultsDisplay.changeUIColour();
 	}
+
+
+    public int getActiveDL() {
+	return dlChooser.getSelectedIndex(); // SELECT, GREENSTONE, or FEDORA
+    }
 	
 	/** The main method of the GS3 java-client application. It instantiates
Index: other-projects/gs3-webservices-java-client/trunk/src/GS3DemoClient/org/greenstone/gs3client/SearchResultsDisplay.java
===================================================================
--- other-projects/gs3-webservices-java-client/trunk/src/GS3DemoClient/org/greenstone/gs3client/SearchResultsDisplay.java	(revision 26174)
+++ other-projects/gs3-webservices-java-client/trunk/src/GS3DemoClient/org/greenstone/gs3client/SearchResultsDisplay.java	(revision 26180)
@@ -345,5 +345,5 @@
         	if(docNode.hasNoText() && node.isLeaf() /*&& docNode.canBeImage()*/) {
         		this.docContentEditPane.setText(
-        				Displays.getImgUrlEnclosedInHtml(docNode.getImgURL()));
+        				Displays.getImgUrlEnclosedInHtml(client.getBaseURL(), docNode.getImgURL()));
         		this.docContentEditPane.setCaretPosition(0);
         	}
Index: other-projects/gs3-webservices-java-client/trunk/src/GS3DemoClient/org/greenstone/gs3client/data/DocumentNodeData.java
===================================================================
--- other-projects/gs3-webservices-java-client/trunk/src/GS3DemoClient/org/greenstone/gs3client/data/DocumentNodeData.java	(revision 26174)
+++ other-projects/gs3-webservices-java-client/trunk/src/GS3DemoClient/org/greenstone/gs3client/data/DocumentNodeData.java	(revision 26180)
@@ -501,8 +501,30 @@
 			return ""; // deal with any odd cases
 		
-		if(!this.nodeMetadata.containsKey("srclink"))
+		String imgMetaFound = "";
+		String srclinkFile = nodeMetadata.containsKey("srclinkFile") ? (String)((Vector)nodeMetadata.get("srclinkFile")).get(0) : "";
+		String w = nodeMetadata.containsKey("ImageWidth") ? (String)((Vector)nodeMetadata.get("ImageWidth")).get(0) : "";
+		String h = nodeMetadata.containsKey("ImageHeight") ? (String)((Vector)nodeMetadata.get("ImageHeight")).get(0) : "";
+
+		if(this.nodeMetadata.containsKey("srcicon")) {
+		    imgMetaFound = "srcicon";
+		}
+		else if(this.nodeMetadata.containsKey("srclink")) { // old Greenstone 3
+		    imgMetaFound = "srclink";
+		} 
+		else {
 			return "";
-		Vector values = (Vector)this.nodeMetadata.get("srclink");
+		}
+		Vector values = (Vector)this.nodeMetadata.get(imgMetaFound);
 		String imgTag = (String)values.get(0);
+
+		if(imgMetaFound.equals("srcicon")) {
+		    imgTag = imgTag.replace("[srclinkFile]", srclinkFile);
+		    imgTag = imgTag.replace("[ImageWidth]", w);
+		    imgTag = imgTag.replace("[ImageHeight]", h);
+		    return imgTag;
+		}
+
+		// else deal with srclink in the old Greenstone 3 way:
+
 		// now we got <a href="somelink">; extract just the "somelink" portion
 		int startindex = imgTag.indexOf('\"');
Index: other-projects/gs3-webservices-java-client/trunk/src/GS3DemoClient/org/greenstone/gs3client/dlservices/GS3ServicesAPIA.java
===================================================================
--- other-projects/gs3-webservices-java-client/trunk/src/GS3DemoClient/org/greenstone/gs3client/dlservices/GS3ServicesAPIA.java	(revision 26174)
+++ other-projects/gs3-webservices-java-client/trunk/src/GS3DemoClient/org/greenstone/gs3client/dlservices/GS3ServicesAPIA.java	(revision 26180)
@@ -57,4 +57,7 @@
 	static Logger LOG = Logger.getLogger(GS3ServicesAPIA.class);
 	
+	/** Storing the baseURL, worked out from wsdlURL */
+	protected String baseURL;
+
 	/** Storing language settings for requests and responses*/
 	protected String language;
@@ -82,4 +85,13 @@
     	// this case, it is set to "" (which Greenstone takes as English).
     	this.language = ""; 
+
+	// work out the baseURL from the wsdlURL, which is just the domain prefix 
+	// (e.g. http://localhost:8383)
+	String url = wsdlURLName;
+	int index = url.indexOf("://") + "://".length();
+	index = url.indexOf('/', index);
+	url = url.substring(0, index); // everything upto the first / separator
+	this.baseURL = url;
+	
     }
 
@@ -164,5 +176,7 @@
 	 * do not contain relative paths, or otherwise deal with the resolution of
 	 * relative urls themselves, then return "" from here. */
-	public String getAssocFileBaseURL() { return ""; }
+	public String getAssocFileBaseURL() { 
+	    return baseURL; // return ""; // for old GS3
+	}
 	
 	/** Part of the GS3 Java-Client's DigitalLibraryServicesAPIA interface 
