Index: gs3-extensions/html-to-expeditee/trunk/src/INSTALL-FOR-GREENSTONE3.sh
===================================================================
--- gs3-extensions/html-to-expeditee/trunk/src/INSTALL-FOR-GREENSTONE3.sh	(revision 24919)
+++ gs3-extensions/html-to-expeditee/trunk/src/INSTALL-FOR-GREENSTONE3.sh	(revision 24920)
@@ -24,19 +24,19 @@
 
 if [ ! -d ../../web/WEB-INF/cgi/html-to-expeditee ] ; then
-  echo "Making supporting html-to-expeditee directory in cgi-bin folder"
+  echo "Making supporting html-to-expeditee directory in web/ext folder"
   mkdir ../../web/WEB-INF/cgi/html-to-expeditee
 fi
 
-if [ ! -d ../../web/WEB-INF/cgi/html-to-expeditee/jquery ] ; then
-  echo "Copying jquery into supporting html-to-expeditee cgi-bin folder"
-  /bin/cp -r packages/jquery ../../web/WEB-INF/cgi/html-to-expeditee/.
+if [ ! -d ../../web/ext/html-to-expeditee/jquery ] ; then
+  echo "Copying jquery into web/ext/html-to-expeditee folder"
+  /bin/cp -r packages/jquery ../../web/ext/html-to-expeditee/.
 fi
 
-if [ ! -d ../../web/WEB-INF/cgi/html-to-expeditee/js ] ; then
-  echo "Copying src/js into supporting html-to-expeditee cgi-bin folder"
-  /bin/cp -r src/js ../../web/WEB-INF/cgi/html-to-expeditee/.
-elif [ "src/js/html-to-expeditee.js" -nt "../../web/WEB-INF/cgi/html-to-expeditee/js/html-to-expeditee.js" ] ; then
-  echo "Updating src/js in the supporting html-to-expeditee cgi-bin folder"
-  /bin/cp -r src/js ../../web/WEB-INF/cgi/html-to-expeditee/.
+if [ ! -d ../../web/ext/html-to-expeditee/js ] ; then
+  echo "Copying src/js into web/ext/html-to-expeditee/js"
+  /bin/cp -r src/js ../../web/ext/html-to-expeditee/.
+elif [ "src/js/html-to-expeditee.js" -nt "../../web/ext/html-to-expeditee/js/html-to-expeditee.js" ] ; then
+  echo "Updating src/js to web/ext/html-to-expeditee/js"
+  /bin/cp -r src/js ../../web/ext/html-to-expeditee/.
 fi
 
Index: gs3-extensions/html-to-expeditee/trunk/src/src/cgi-bin/html-to-expeditee.pl.in
===================================================================
--- gs3-extensions/html-to-expeditee/trunk/src/src/cgi-bin/html-to-expeditee.pl.in	(revision 24919)
+++ gs3-extensions/html-to-expeditee/trunk/src/src/cgi-bin/html-to-expeditee.pl.in	(revision 24920)
@@ -56,4 +56,31 @@
     $gsdl_cgi->{'xml'} = 0;
 
+
+    my $collect = $gsdl_cgi->clean_param("c");   
+    my $cl = $gsdl_cgi->clean_param("cl");   
+
+    # Establish collect_dir using defining 'site' along the way if GS3
+
+    my $site = undef; 
+    my $isGSDL2 = undef;
+
+    if ($gsdl_cgi->greenstone_version() == 2) { 
+        $isGSDL2 = 1;
+    }
+    else {
+        $isGSDL2 = 0;
+
+	# GS3 (and possible future versions) make use of 'site'
+	$site = $gsdl_cgi->clean_param("site");   
+	if (!defined $site) {
+	    $gsdl_cgi->generate_error("No site specified.");
+	}
+	$gsdl_cgi->delete("site");
+    }
+
+    my $collect_dir = $gsdl_cgi->get_collection_dir($site);
+
+
+
     my $fn = $gsdl_cgi->clean_param("fn");     # frame number
 
@@ -61,9 +88,11 @@
 	my $json_str = $gsdl_cgi->param("json");
 	
-	my $output_dir = &util::filename_cat("C:","cygwin","tmp");
-
-	# my $output_dir = &filename_cat($gsdlhome,"collect",$collect,"export");
-
+	my $output_dir = &util::filename_cat($collect_dir,$collect,"export");
+
+	if (!-d $output_dir) {
+	    &util::mk_dir($output_dir);
+	}
 	my $frame_filename = &util::filename_cat($output_dir,"$fn.exp");
+
 	if (open(FOUT,">$frame_filename")) {
 
@@ -86,17 +115,20 @@
   <head>
     <title>HTML to Expeditee Frames</title>
-    <link type="text/css" href="html-to-expeditee/jquery/css/le-frog/jquery-ui-1.8.16.custom.css" rel="stylesheet" />
-    <script type="text/javascript" src="html-to-expeditee/jquery/js/jquery-1.6.2.min.js"></script>
-    <script type="text/javascript" src="html-to-expeditee/jquery/js/jquery-ui-1.8.16.custom.min.js"></script>
-    <script type="text/javascript" src="html-to-expeditee/js/gsajax-min.js"></script>
-    <script type="text/javascript" src="html-to-expeditee/js/html-to-expeditee.js"></script>
+    <link type="text/css" href="../ext/html-to-expeditee/jquery/css/le-frog/jquery-ui-1.8.16.custom.css" rel="stylesheet" />
+    <script type="text/javascript" src="../ext/html-to-expeditee/jquery/js/jquery-1.6.2.min.js"></script>
+    <script type="text/javascript" src="../ext/html-to-expeditee/jquery/js/jquery-ui-1.8.16.custom.min.js"></script>
+    <script type="text/javascript" src="../ext/html-to-expeditee/js/gsajax-min.js"></script>
+    <script type="text/javascript" src="../ext/html-to-expeditee/js/html-to-expeditee.js"></script>
 
   </head>
   <body>
     <form>
-      Convert the collection <input type="text" name="collect" id="collect" />
-      to Expeditee frames by traversing the classifier <input type="text" name="cl" id="cl" />
-
-      <input value="Go" id="go" type="submit">
+      Convert the collection <input type="text" name="collect" value="$collect" id="collect" />
+      to Expeditee frames by traversing the classifier <input type="text" name="cl" value="$cl" id="cl" />
+
+      <input value="$site" id="site" type="hidden">
+      <input value="Go" id="go" 
+             class="ui-button ui-widget ui-state-default ui-corner-all" 
+             type="submit">
 
     </form>
@@ -121,10 +153,23 @@
 	      }
 	      if (cl.match(/^\\d+\$/)) {
-	      cl = "CL" + cl;
-	      }
-	      
-	      var url = "/greenstone/cgi-bin/library.cgi";
-	      url += "?c="+collect +"&a=d&cl=" + cl;
-	      
+	          cl = "CL" + cl;
+	      }
+	      
+	      var gs2=$isGSDL2;
+
+	      //var url = "/greenstone/cgi-bin/library.cgi";
+	      //url += "?c="+collect +"&a=d&cl=" + cl;
+	      
+	      var url;
+	      if (gs2) {
+	          url = "library.cgi";
+		  url += "?c="+collect +"&a=d&cl=" + cl;
+	      }
+	      else {
+	          url = "../dev";
+	          url += "?c="+collect +"&a=b&rt=s&s=ClassifierBrowse&cl=" + cl;
+	      }
+
+
 	      /* processing animation */
 		  
@@ -132,24 +177,22 @@
 	      var outstandingURLs = [];
 	      outstandingURLs.push(url);
-	      
+
 	      while (outstandingURLs.length>0) {
 		  url = outstandingURLs.shift();
 	      
 		  var clHtml = urlGetSync(url);
-		  
-		  var gs2=1;
-		  
+		  		  
 		  var aElems;
-		  if (gs2) {
+		  //if (gs2) {
 		      var workingTrav = document.getElementById("workingTraverse");
 		      workingTrav.innerHTML = clHtml;
 		      aElems = workingTrav.getElementsByTagName("a");
-		  }
-		  else {
+		  //}
+		  //else {
 		      /* gs3 */
-		      var parser = new DOMParser();
-		      cl_doc = parser.parseFromString(clHtml,"text/html");
-		      var aElems = cl_doc.getElementsByTagName("a");
-		  }
+		    //  var parser = new DOMParser();
+		     // cl_doc = parser.parseFromString(clHtml,"text/html");
+		     // var aElems = cl_doc.getElementsByTagName("a");
+		  //}
 		  
 		  
@@ -157,7 +200,7 @@
 		  /* any links with a=d ... d=???  => docOIDS */
 	      
-		  var actionRE = new RegExp("(\\\\?|&)a=d(&|\$)");
+		  var actionRE = new RegExp("(\\\\?|&)a=(?:d|b)(&|\$)");
 		  var clRE     = new RegExp("(\\\\?|&)cl=" + cl + "\\\\.");
-		  var docRE    = new RegExp("(?:|&)d=(.*?)(?:&|\$)");
+		  var docRE    = new RegExp("(?:\\\\?|&)d=(.*?)(?:&|\$)");
 
 		  for (var i=0; i<aElems.length; i++) {
@@ -169,6 +212,8 @@
 			  }
 			  else if (href.match(docRE)) {
+
 			      var docMatch = docRE.exec(href);
 			      var docOID = docMatch[1];
+
 			      docOIDs.push(docOID);
 			  }
@@ -184,6 +229,14 @@
 	      console.log("doc oid = " + docOID);
 	      
-	      var url = "/greenstone/cgi-bin/library.cgi";
-	      url += "?c="+collect +"&a=d&d=" + docOID;
+	      var url;
+	      if (gs2) {
+	          url = "library.cgi";
+	          url += "?c="+collect +"&a=d&d=" + docOID;
+	     }
+	     else {
+	          url = "../dev";
+	          url += "?c="+collect +"&a=d&d=" + docOID;
+	          url += "&ed=1";
+	     }
 	      
 	      iframe.src = url;
@@ -227,7 +280,12 @@
 
 	      var collect = document.getElementById("collect").value;
-
-	      var url = "/greenstone/cgi-bin/html-to-expeditee.pl";
-	      var params = "c=" + collect + "&fn=" + frameID;
+	      var site    = document.getElementById("site").value;
+
+	      var url = "html-to-expeditee.pl";
+	      var params = "c=" + collect;
+	      if (site.match(/\\w/)) {
+		params += "&site=" + site;
+   	      }
+	      params += "&fn=" + frameID;
 	      params += "&json=" + escape(expFrame);
 	      //params += "&json=" + "testing123";
@@ -246,7 +304,23 @@
 		  var cl = document.getElementById("cl").value;
 		  
-		  var url = "/greenstone/cgi-bin/library.cgi";
-		  url += "?c="+collect +"&a=d&d=" + docOID;
-		  
+
+		  //var url = "/greenstone/cgi-bin/library.cgi";
+		  //url += "?c="+collect +"&a=d&d=" + docOID;
+		  
+		  var gs2 = $isGSDL2;
+ 	      	  var url;
+
+	      	  if (gs2) {
+	              url = "library.cgi";
+	              url += "?c="+collect +"&a=d&d=" + docOID;
+	     	  }
+	     	  else {
+	              url = "../dev";
+	              url += "?c="+collect +"&a=d&d=" + docOID;
+	              url += "&ed=1";
+	     	  }
+
+
+
 		  iframe.src = url;
 	      }
