Index: /main/trunk/greenstone3/web/interfaces/oran/js/gui_div.js
===================================================================
--- /main/trunk/greenstone3/web/interfaces/oran/js/gui_div.js	(revision 23134)
+++ /main/trunk/greenstone3/web/interfaces/oran/js/gui_div.js	(revision 23135)
@@ -5,4 +5,6 @@
 
     console.log("Document ready function\n");
+
+    var CURRENT_SELECT_VALUE = "";
 
     /******************************************/
@@ -53,5 +55,5 @@
 
     //$(".element_type_gsf_metadata").draggable({
-    $(".gsf_metadata").draggable({
+    $(".draggable_gsf_metadata").draggable({
             cursor: 'crosshair',
             connectToSortable: '.gsf_choose_metadata, .gsf_when, .gsf_otherwise, .td-div',
@@ -60,5 +62,5 @@
     });
 
-    $(".element_type_gsf_link").draggable({
+    $(".draggable_gsf_link").draggable({
             cursor: 'crosshair',
             connectToSortable: '.td-div',
@@ -215,6 +217,35 @@
 function replace_with(item, me)
 {
+    // Search me for select
+    if(me.search("select") != -1)
+    {
+    // If select exists, then find CURRENT_SELECT_VALUE
+        var index = me.search(CURRENT_SELECT_VALUE);
+        if(index == -1)
+            console.log("Did not find " + CURRENT_SELECT_VALUE);
+        else
+            console.log("Found " + CURRENT_SELECT_VALUE + " at index " + index);    
+            index = index + CURRENT_SELECT_VALUE.length + 1;
+            console.log("Attempt inserting select at new index "+index);
+            a = me.substring(0,index);
+            b = me.substring(index);
+            me = a.concat("selected",b);
+    }
+
     //console.log('function replace_with(item, me)');
     item.replaceWith(me); //'<div class="element element-txt">This text box has been added!</div>');
+    //item.find('select').attr("value", CURRENT_SELECT_VALUE);
+
+
+    //if(select != null){
+    //    console.log("Attempting to select " + CURRENT_SELECT_VALUE);
+    //    console.log("length = "+select.length);
+    //    for(index = 0; index < select.length; index++) {
+    //          console.log(select[index].value);  
+    //       if(select[index].value == CURRENT_SELECT_VALUE)
+    //          console.log("Found "+CURRENT_SELECT_VALUE+" at index " + index);
+    //          select.selectedIndex = index;
+    //    }
+    // }
 
     resize_tables(item);
@@ -337,5 +368,13 @@
             stop: function(event, ui) {
                 //alert("STOP");
-                //if (ui.item.hasClass("ui-draggable") && ui.item.hasClass('element_type_gsf_metadata')) { replace_with(ui.item, gsf_metadata_element); }
+                if (ui.item.hasClass("ui-draggable") && ui.item.hasClass('draggable_gsf_metadata')) { 
+                    console.log("Current select value = "+CURRENT_SELECT_VALUE);
+                    var select = $(ui.item).find('select');
+                    var value = select.attr("value");
+                    console.log("We want this:"+value);
+
+                    replace_with(ui.item, gsf_metadata_element); 
+                    
+                }
                 bind_all_sortables();
             }
Index: /main/trunk/greenstone3/web/interfaces/oran/transform/layouts/main.xsl
===================================================================
--- /main/trunk/greenstone3/web/interfaces/oran/transform/layouts/main.xsl	(revision 23134)
+++ /main/trunk/greenstone3/web/interfaces/oran/transform/layouts/main.xsl	(revision 23135)
@@ -37,4 +37,5 @@
                 <!-- <script type="text/javascript" src="interfaces/oran/js/jquery-ui-1.8.2.custom.min.js"><xsl:text> </xsl:text></script> -->
                 <script type="text/javascript" src="interfaces/oran/js/jquery-ui-1.8rc1/ui/jquery-ui.js"><xsl:text> </xsl:text></script>
+                <script type="text/javascript" src="interfaces/oran/js/jquery.selectboxes.js"><xsl:text> </xsl:text></script>
                 <!-- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.js"><xsl:text> </xsl:text></script> -->
                 <!-- <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"><xsl:text> </xsl:text></script> -->
@@ -121,4 +122,9 @@
 
 <!-- *************************************************************************************** -->
+
+    <!-- <xsl:variable name="foo"> -->
+    <!-- <xsl:value-of select="/page/pageRequest/paramList[@name='formatedit']"/> -->
+
+    <xsl:if test="/page/pageRequest/paramList/param[(@name='formatedit') and (@value='1')]">
 
 <!-- Sam2's div code -->
@@ -192,10 +198,16 @@
         </script> -->
         <div class="header element_type_gsf_choose_metadata css_gsf_choose_metadata" title="gsf:choose-metadata">CHOOSE-METADATA</div>
-        <div class="gsf_metadata css_gsf_metadata block leaf" title="gsf:metadata"><table class="header"><tbody><tr><td class="header"><xsl:call-template name="meta-to-combo">
+        <div class="draggable_gsf_metadata gsf_metadata css_gsf_metadata block leaf" title="gsf:metadata"><table class="header"><tbody><tr><td class="header"><xsl:call-template name="meta-to-combo">
                         <xsl:with-param name="metadataSets" select="//metadataSetList"/>
                         <xsl:with-param name="current" select="ex.Title"/>
                      </xsl:call-template></td><td class="header"><a href="#" class="remove ui-icon ui-icon-closethick" title="Click me to remove"/></td></tr></tbody></table></div>
         <!-- <div class="header element_type_gsf_metadata css_gsf_metadata" title="gsf:metadata">METADATA</div> -->
-        <div class="header element_type_gsf_link css_gsf_link" title="gsf:link">LINK</div>
+        <!-- <div class="header element_type_gsf_link css_gsf_link" title="gsf:link">LINK</div> -->
+        <div class="draggable_gsf_link css_gsf_link block" title="gsf:link"><table class="header"><tbody><tr><td class="header">LINK<select>
+                            <option value = "document" selected = "document">Document</option>
+                            <option value = "classifier">Classifier</option>
+                            <option value = "source">Source</option>
+                            <option value = "horizontal">Horizontal</option>
+                </select></td><td><a href="#" class="minmax ui-icon ui-icon-minusthick">[-]</a></td><td><a href="#" class="remove ui-icon ui-icon-closethick">[x]</a></td></tr></tbody></table></div>
         <div class="header element_type_gsf_switch css_gsf_switch" title="gsf:switch">SWITCH</div>
         <div class="header element_type_gsf_when css_gsf_when" title="gsf:when">WHEN</div>
@@ -213,5 +225,5 @@
     <!-- <xsl:variable name="tok" select="fn:tokenize($fmt,'/s+')"/> -->
 
-    <!--  <div id="format">
+    <div id="format">
         <p>
           <b>Format string here</b>
@@ -220,5 +232,6 @@
           </i>
         </p>
-        <p>
+    </div>
+    <!--    <p>
           <i>
               <xsl:value-of select="$meta"/>
@@ -226,4 +239,5 @@
         </p>
       </div> -->
+      </xsl:if>
 
 <!-- *************************************************************************************** -->
Index: /main/trunk/greenstone3/web/interfaces/oran/transform/layouts/xml-to-gui.xsl
===================================================================
--- /main/trunk/greenstone3/web/interfaces/oran/transform/layouts/xml-to-gui.xsl	(revision 23134)
+++ /main/trunk/greenstone3/web/interfaces/oran/transform/layouts/xml-to-gui.xsl	(revision 23135)
@@ -90,5 +90,6 @@
         <xsl:choose>
             <xsl:when test="$current = $meta">
-                <option value ="{$meta}" selected="{$meta}"><xsl:value-of select="$meta"/></option>
+                <xsl:text disable-output-escaping="yes">&lt;option value="</xsl:text><xsl:value-of select="$meta"/><xsl:text disable-output-escaping="yes">" selected&gt;</xsl:text><xsl:value-of select="$meta"/><xsl:text disable-output-escaping="yes">&lt;/option&gt;</xsl:text>
+                <!-- <option value ="{$meta}" selected="selected"><xsl:value-of select="$meta"/></option> -->
             </xsl:when>
             <xsl:otherwise>
