diff -ur topcoll/format.php /var/svn/moodle/trunk/course/format/topcoll//format.php
--- topcoll/format.php	2011-05-31 01:15:34.000000000 +0100
+++ /var/svn/moodle/trunk/course/format/topcoll//format.php	2011-06-03 10:30:08.623754001 +0100
@@ -18,6 +18,11 @@
 // courses that aren't so rigidly defined by time.
 // Included from "view.php"
 
+// CMDL-1358 - Wrapped each row in tbody tags and gave this the section-<n> id
+// Changed existing tr tag id from section-<n> to sectionbody-<n>
+// This then allowed the js code (modified functions in /lib/ajax/section_classes_coll_top.js)
+// to move the topic header with the topic body.
+
 require_once($CFG->libdir.'/ajax/ajaxlib.php');
     
 // For persistence of toggles.
@@ -34,6 +39,7 @@
 <![endif]-->
 
 <script type="text/javascript" src="<?php echo $CFG->wwwroot ?>/course/format/topcoll/lib_min.js"></script>
+<script type="text/javascript" src="<?php echo $CFG->wwwroot ?>/lib/ajax/section_classes_coll_top.js"></script>
 
 <script type="text/javascript">
 //<![CDATA[
@@ -158,12 +164,15 @@
         echo '</tr>';
     }
 
+
 /// Print Section 0
     $section = 0;
     $thissection = $sections[$section];
 
     if ($thissection->summary or $thissection->sequence or isediting($course->id)) {
-        echo '<tr id="section-0" class="section main">';
+        echo '<tbody id="section-0" class="cps">';
+        echo '<tr id="sectionhead-0" class="cps"></tr>';
+        echo '<tr id="sectionbody-0" class="section main">';
         echo '<td id="sectionblock-0" class="left side">&nbsp;</td>'; // MDL-18232
         echo '<td class="content">';
         
@@ -188,6 +197,7 @@
         echo '<td class="right side">&nbsp;</td>';
         echo '</tr>';
         echo '<tr class="section separator"><td colspan="3" class="spacer"></td></tr>';
+        echo '</tbody>';
     }
 
 
@@ -247,11 +257,15 @@
                 $sectionstyle = '';
             }
 
+            echo '<tbody id="section-'.$section.'" class="cps">';
             echo '<tr class="cps" id="sectionhead-'.$section.'">'; // The table row of the toggle.
             // Have a different look depending on if the section summary has been completed.
             if (empty($thissection->summary)) {
                 $thissection->summary='';
-                echo '<td colspan="3"><a id="sectionatag-'.$section.'" class="cps_nosumm" href="#" onclick="toggle_topic(this,'.$section.'); return false;">'.$topictext.' '.$currenttext.$section.' - '.$toggletext.'</a></td>';
+                // CMDL-1276 Remove word Toggle
+                //echo '<td colspan="3"><a id="sectionatag-'.$section.'" class="cps_nosumm" href="#" onclick="toggle_topic(this,'.$section.'); return false;">'.$topictext.' '.$currenttext.$section.' - '.$toggletext.'</a></td>';
+                echo '<td colspan="3"><a id="sectionatag-'.$section.'" class="cps_nosumm" href="#" onclick="toggle_topic(this,'.$section.'); return false;">'.$topictext.' '.$currenttext.$section.'</a></td>';
+
             } else {
                 //echo '<td colspan="2"><a id="sectionatag-'.$section.'" href="#" onclick="toggle_topic(this,'.$section.'); return false;"><span>'.html_to_text($thissection->summary).'</span> - '.$toggletext.'</a></td><td class="cps_centre">'.$topictext.'<br />'.$currenttext.$section.'</td>';
                 // Comment out the above line and uncomment the line below if you do not want 'Topic x' displayed on the right hand side of the toggle.
@@ -259,13 +273,14 @@
             }
             echo '</tr>';
 
+
             // Now the section itself.  The css class of 'hid' contains the display attribute that manipulated by the JavaScript to show and hide the section.  It is defined in js-override-topcoll.css which 
             // is loaded into the DOM by the JavaScript function topcoll_init.  Therefore having a logical separation between static and JavaScript manipulated css.  Nothing else here differs from 
             // the standard Topics format in the core distribution.  The next change is at the bottom.
-            echo '<tr id="section-'.$section.'" class="section main'.$sectionstyle.' hid">';
-            //echo '<td id="sectionblock-'.$section.'" class="left side">&nbsp;'.$currenttext.$section.'</td>'; // MDL-18232
+            echo '<tr id="sectionbody-'.$section.'" class="section main'.$sectionstyle.' hid">';
+            echo '<td id="sectionblock-'.$section.'" class="left side">&nbsp;'.$currenttext.$section.'</td>'; // MDL-18232
             // Comment out the above line and uncomment the line below if you do not want the section number displayed on the left hand side of the section.
-            echo '<td class="left side">&nbsp;</td>';
+            //echo '<td class="left side">&nbsp;</td>';
 
             echo '<td class="content">';
             if (!has_capability('moodle/course:viewhiddensections', $context) and !$thissection->visible) {   // Hidden for students
@@ -333,6 +348,7 @@
             }
 
             echo '</td></tr>';
+            echo '</tbody>';
             echo '<tr class="section separator"><td colspan="3" class="spacer"></td></tr>';
         }
 diff -ur topcoll/lib.js /var/svn/moodle/trunk/course/format/topcoll//lib.js
--- topcoll/lib.js	2011-05-31 01:15:34.000000000 +0100
+++ /var/svn/moodle/trunk/course/format/topcoll//lib.js	2011-06-03 10:30:08.623754001 +0100
@@ -33,6 +33,7 @@
 
 // Initialise with the information supplied from the course format 'format.php' so we can operate.
 // Args - wwwroot is the URL of the Moodle site, moodleid is the site short name (courseid 0) and courseid is the id of the current course to allow for settings for each course.
+
 function topcoll_init(wwwroot, moodleid, courseid, cookielifetime)
 {
     // Init.
@@ -74,6 +75,9 @@
     }
 }
 
+
+
+
 // Toggle functions
 // Args - target is the table row element in the DOM to be toggled.
 //            image is the img tag element in the DOM to be changed.
@@ -224,7 +228,7 @@
     {
         if ((theToggle <= numToggles) && (toggleBinaryGlobal.charAt(theToggle) == "1")) // Array index 0 is never tested - MSB thing.
         {
-            toggleexacttopic(document.getElementById("section-"+theToggle),document.getElementById("sectionatag-" + theToggle),theToggle,true);
+            toggleexacttopic(document.getElementById("sectionbody-"+theToggle),document.getElementById("sectionatag-" + theToggle),theToggle,true);
         }
     }
 }
@@ -232,7 +236,7 @@
 // Show a specific topic - used when in 'Show topic x' mode.
 function show_topic(theTopic)
 {
-    toggleexacttopic(document.getElementById("section-"+theTopic),document.getElementById("sectionatag-" + theTopic),theTopic,true);
+    toggleexacttopic(document.getElementById("sectionbody-"+theTopic),document.getElementById("sectionatag-" + theTopic),theTopic,true);
 }
 
 // Save the toggles - called from togglebinary and an the unload event handler at the bottom of format.php which does not work for a refresh even though it should!
diff -ur topcoll/lib_min.js /var/svn/moodle/trunk/course/format/topcoll//lib_min.js
--- topcoll/lib_min.js	2011-03-17 00:16:32.000000000 +0000
+++ /var/svn/moodle/trunk/course/format/topcoll//lib_min.js	2011-06-03 10:30:08.623754001 +0100
@@ -1 +1 @@
-var toggleBinaryGlobal="10000000000000000000000000000000000000000000000000000";var thesparezeros="00000000000000000000000000";var thewwwroot;var thecookiesubid;var yuicookie=YAHOO.util.Cookie;var numToggles;var cookieExpires;var aSecond=1000;var aMinute=60000;var anHour=3600000;var aDay=86400000;var aWeek=604800000;var aMonth=2419200000;var aYear=31536000000;function topcoll_init(e,b,d,a){thewwwroot=e;thecookiesubid=b+d;cookieExpires=a;var c=document.createElement("link");c.setAttribute("rel","stylesheet");c.setAttribute("type","text/css");c.setAttribute("href",""+thewwwroot+"/course/format/topcoll/js-override-topcoll.css");document.getElementsByTagName("head")[0].appendChild(c)}function set_number_of_toggles(a){numToggles=a}function togglebinary(c,b){if((c>=1)&&(c<=52)){var e=toggleBinaryGlobal.substring(0,c);var a=toggleBinaryGlobal.substring(c+1);var d=e+b+a;toggleBinaryGlobal=d;save_toggles()}}function toggleexacttopic(e,d,c,b){if((document.getElementById)&&((e!=null)&&(d!=null))){if(navigator.userAgent.indexOf("IE")!=-1){var a="block"}else{var a="table-row"}if(e.style.display==a){e.style.display="none";d.style.backgroundImage="url("+thewwwroot+"/course/format/topcoll/arrow_down.png)";if(b==false){togglebinary(c,"0")}}else{e.style.display=a;d.style.backgroundImage="url("+thewwwroot+"/course/format/topcoll/arrow_up.png)";if(b==false){togglebinary(c,"1")}}}}function toggle_topic(b,a){if(document.getElementById){imageSwitch=b;targetElement=b.parentNode.parentNode.nextSibling;if(targetElement.className==undefined){targetElement=b.parentNode.parentNode.nextSibling.nextSibling}toggleexacttopic(targetElement,imageSwitch,a,false)}}function to2baseString(c){var e=parseInt(c.substring(0,6),36);var b=parseInt(c.substring(6,12),36);var d=e.toString(2);var a=b.toString(2);if(d.length<26){d=thesparezeros.substring(0,(26-d.length))+d}if(a.length<27){a=thesparezeros.substring(0,(27-a.length))+a}return d+a}function to36baseString(b){var e=parseInt(b.substring(0,26),2);var c=parseInt(b.substring(26,53),2);var d=e.toString(36);var a=c.toString(36);if(d.length<6){d=thesparezeros.substring(0,(6-d.length))+d}if(a.length<6){a=thesparezeros.substring(0,(6-a.length))+a}return d+a}function savetopcollcookie(b){if(cookieExpires==null){yuicookie.setSub("mdl_cf_topcoll",thecookiesubid,b)}else{var a=new Date();a.setTime(a.getTime()+cookieExpires);yuicookie.setSub("mdl_cf_topcoll",thecookiesubid,b,{expires:a})}}function restoretopcollcookie(){return yuicookie.getSub("mdl_cf_topcoll",thecookiesubid)}function reload_toggles(){var b=restoretopcollcookie();if(b!=null){toggleBinaryGlobal=to2baseString(b)}for(var a=1;a<=numToggles;a++){if((a<=numToggles)&&(toggleBinaryGlobal.charAt(a)=="1")){toggleexacttopic(document.getElementById("section-"+a),document.getElementById("sectionatag-"+a),a,true)}}}function show_topic(a){toggleexacttopic(document.getElementById("section-"+a),document.getElementById("sectionatag-"+a),a,true)}function save_toggles(){savetopcollcookie(to36baseString(toggleBinaryGlobal))};
\ No newline at end of file
+var toggleBinaryGlobal="10000000000000000000000000000000000000000000000000000";var thesparezeros="00000000000000000000000000";var thewwwroot;var thecookiesubid;var yuicookie=YAHOO.util.Cookie;var numToggles;var cookieExpires;var aSecond=1000;var aMinute=60000;var anHour=3600000;var aDay=86400000;var aWeek=604800000;var aMonth=2419200000;var aYear=31536000000;function topcoll_init(e,b,d,a){thewwwroot=e;thecookiesubid=b+d;cookieExpires=a;var c=document.createElement("link");c.setAttribute("rel","stylesheet");c.setAttribute("type","text/css");c.setAttribute("href",""+thewwwroot+"/course/format/topcoll/js-override-topcoll.css");document.getElementsByTagName("head")[0].appendChild(c)}function set_number_of_toggles(a){numToggles=a}function togglebinary(c,b){if((c>=1)&&(c<=52)){var e=toggleBinaryGlobal.substring(0,c);var a=toggleBinaryGlobal.substring(c+1);var d=e+b+a;toggleBinaryGlobal=d;save_toggles()}}function toggleexacttopic(e,d,c,b){if((document.getElementById)&&((e!=null)&&(d!=null))){if(navigator.userAgent.indexOf("IE")!=-1){var a="block"}else{var a="table-row"}if(e.style.display==a){e.style.display="none";d.style.backgroundImage="url("+thewwwroot+"/course/format/topcoll/arrow_down.png)";if(b==false){togglebinary(c,"0")}}else{e.style.display=a;d.style.backgroundImage="url("+thewwwroot+"/course/format/topcoll/arrow_up.png)";if(b==false){togglebinary(c,"1")}}}}function toggle_topic(b,a){if(document.getElementById){imageSwitch=b;targetElement=b.parentNode.parentNode.nextSibling;if(targetElement.className==undefined){targetElement=b.parentNode.parentNode.nextSibling.nextSibling}toggleexacttopic(targetElement,imageSwitch,a,false)}}function to2baseString(c){var e=parseInt(c.substring(0,6),36);var b=parseInt(c.substring(6,12),36);var d=e.toString(2);var a=b.toString(2);if(d.length<26){d=thesparezeros.substring(0,(26-d.length))+d}if(a.length<27){a=thesparezeros.substring(0,(27-a.length))+a}return d+a}function to36baseString(b){var e=parseInt(b.substring(0,26),2);var c=parseInt(b.substring(26,53),2);var d=e.toString(36);var a=c.toString(36);if(d.length<6){d=thesparezeros.substring(0,(6-d.length))+d}if(a.length<6){a=thesparezeros.substring(0,(6-a.length))+a}return d+a}function savetopcollcookie(b){if(cookieExpires==null){yuicookie.setSub("mdl_cf_topcoll",thecookiesubid,b)}else{var a=new Date();a.setTime(a.getTime()+cookieExpires);yuicookie.setSub("mdl_cf_topcoll",thecookiesubid,b,{expires:a})}}function restoretopcollcookie(){return yuicookie.getSub("mdl_cf_topcoll",thecookiesubid)}function reload_toggles(){var b=restoretopcollcookie();if(b!=null){toggleBinaryGlobal=to2baseString(b)}for(var a=1;a<=numToggles;a++){if((a<=numToggles)&&(toggleBinaryGlobal.charAt(a)=="1")){toggleexacttopic(document.getElementById("sectionbody-"+a),document.getElementById("sectionatag-"+a),a,true)}}}function show_topic(a){toggleexacttopic(document.getElementById("sectionbody-"+a),document.getElementById("sectionatag-"+a),a,true)}function save_toggles(){savetopcollcookie(to36baseString(toggleBinaryGlobal))};
\ No newline at end of file

