Index: trunk/gsdl/src/phind/client/Phind.java
===================================================================
--- trunk/gsdl/src/phind/client/Phind.java	(revision 1626)
+++ trunk/gsdl/src/phind/client/Phind.java	(revision 1627)
@@ -55,6 +55,5 @@
    words on the screen, and handles user input from the mouse.
 6. ResultItem represents a single result object (a phrase or document).
-
-7. PhindTitle is for drawing backdrops in empty Displays. (?)
+7. PhindTitle is for drawing backdrops in ResultDisplays.
 
 **********************************************************************/
@@ -104,4 +103,5 @@
 
     // Do we want a background image in the applet?
+    String backdrop_address;
     public boolean showImage;
     public Image backgroundImage;
@@ -109,5 +109,4 @@
     // Holders for the downloaded data
     Panel resultPanel;
-    PhindTitle title;
     ResultDisplay firstDisplay, lastDisplay;
 
@@ -198,4 +197,16 @@
 	System.out.println("Phind library: " + library_address);
 
+	// Should we display a background image?
+	showImage = false;
+	try { 
+	    backdrop_address = new String(getParameter("backdrop"));
+	    URL backdrop_url = new URL(backdrop_address);
+	    backgroundImage = getImage(backdrop_url);
+	    showImage = true;
+	    System.out.println("Phind backdrop: " + backdrop_address);
+	} catch (Exception e) { 
+	    System.out.println("Phind backdrop not set");
+	}
+
 	// Is there a search URL for this collection?
 	try {
@@ -238,16 +249,4 @@
 	System.out.println("Phind phrase block size: " + phraseBlockSize);
 
-	// Should we display a background image?
-	showImage = false;
-	try { 
-	    if (getParameter("background").toLowerCase().equals("on")) {
-		showImage = true;
-		System.out.println("Phind background: on");
-	    }
-	} catch (Exception e) { 
-	    System.out.println("Phind background: off");
-	}
-
-
 	// How large should the font be?
 	try { 
@@ -271,8 +270,4 @@
 	// The phind applet layout manager
 	setLayout(new BorderLayout());
-
-	// the Phind title window
-	if (showImage) backgroundImage = getImage(getCodeBase(), "sequitur.jpg");
-	title = new PhindTitle(this, true);
 
 	// initialise the user interface
@@ -495,33 +490,42 @@
 	throws IOException {
 
-	// Set up connections (streams)
-	//connection = new Socket(server, Integer.parseInt(port));
-	//OutputStream out = connection.getOutputStream();
-	//InputStream in = connection.getInputStream();
-
 	// Build the query
 	String query = phindcgi_address + "?x=1&c=" + collection;
 
 	if (keyKnown) {
-	    query = query + "&n=" + word;
+	  query = query + "&n=" + word;
 	} else {
-	    query = query + "&p=" + word;
-	}
-
-	// Specify the number of results to return and the first and last results.
+	  query = query + "&p=" + word;
+	}
+
+	
+	// Specify the set of results to return 
+	int first_e = 0;
+	int last_e = 0;
+	int first_d = 0;
+	int last_d = 0;
+
+	// the initial query
 	if (queryMode <= 2) {
-	    query = query + "&f=0&d=" + phraseBlockSize + "&g=0&e=" + phraseBlockSize;
-	} else if (queryMode == 3) {
-	    // Add phrases to an existing result set.
-	    query = query + "&f=0&d=" + phraseBlockSize + "&g=0&e=" + phraseBlockSize;
-	    // query = (word + " " + queryMode + " " + phraseBlockSize + " " + area.nextPhraseBlock);
-	    area.nextPhraseBlock++;
-	} else if (queryMode == 4) {
-	    // Add documents to existing result set.
-	    query = query + "&f=0&d=" + phraseBlockSize + "&g=0&e=" + phraseBlockSize;
-	    // query = (word + " " + queryMode + " " + phraseBlockSize + " " + area.nextDocumentBlock);
-	    area.nextDocumentBlock++;
-	}
-
+	  last_e = phraseBlockSize;
+	  last_d = phraseBlockSize;
+	}
+ 
+	// add phrases to an existing result set
+	else if (queryMode == 3) {
+	  first_e = area.nextPhraseBlock * phraseBlockSize;
+	  area.nextPhraseBlock++;
+	  last_e = area.nextPhraseBlock * phraseBlockSize;
+	} 
+	
+	// add documents to existing result set
+	else if (queryMode == 4) {
+	  first_d = area.nextDocumentBlock * phraseBlockSize;
+	  area.nextDocumentBlock++;
+	  last_d = area.nextDocumentBlock * phraseBlockSize;
+	}
+
+	query = query + "&f=" + first_d + "&d=" + last_d 
+	              + "&g=" + first_e + "&e=" + last_e;
 
 	// Send the query to the phindcgi program 
