commit 78e178e2537a627f4ecc532e6d373b8e2f473c37
Author: Andreas Kohlbecker <a.kohlbecker@bgbm.org>
Date:   Tue Dec 4 07:46:00 2012 +0000

    related to: javascript at the and of the page

diff --git a/7.x/modules/cdm_dataportal/cdm_dataportal.css b/7.x/modules/cdm_dataportal/cdm_dataportal.css
index 18cd8ad0..a54f0551 100644
--- a/7.x/modules/cdm_dataportal/cdm_dataportal.css
+++ b/7.x/modules/cdm_dataportal/cdm_dataportal.css
@@ -118,6 +118,8 @@ ul.typeDesignations {
 }
 ul.typeDesignations li {
   background-image: none;
+  list-style-type: none;
+  list-style-image: none;
 }
 
 .form-item fieldset {
diff --git a/7.x/modules/cdm_dataportal/cdm_dataportal.module b/7.x/modules/cdm_dataportal/cdm_dataportal.module
index 02904b0a..e45bc2b5 100644
--- a/7.x/modules/cdm_dataportal/cdm_dataportal.module
+++ b/7.x/modules/cdm_dataportal/cdm_dataportal.module
@@ -89,7 +89,12 @@ function _add_js_treeselector() {
           });
 
       });
-    ", array('type' => 'inline'));
+    ",
+    array(
+      'type' => 'inline',
+      'scope' => 'footer'
+    )
+  );
 }
 
 /**
@@ -1440,6 +1445,39 @@ function cdm_dataportal_view_search_results_taxon() {
 
   $taxonPager = cdm_dataportal_search_execute();
 
+  $showThumbnails = do_showThumbnails();
+
+  $setSessionUri = url('cdm_api/setvalue/session', array(
+      'query' => array('var' => '[pageoption][searchtaxa][showThumbnails]', 'val' => ''),
+  ));
+
+  drupal_add_js('jQuery(document).ready(function() {
+
+      // init
+      if(' . $showThumbnails . ' == 1){
+      jQuery(\'.media_gallery\').show(20);
+  } else {
+      jQuery(\'.media_gallery\').hide(20);
+  }
+      // add change hander
+      jQuery(\'#showThumbnails\').change(
+      function(event){
+      var state = 0;
+      if(jQuery(this).is(\':checked\')){
+      jQuery(\'.media_gallery\').show(20);
+      state = 1;
+  } else {
+      jQuery(\'.media_gallery\').hide(20);
+  }
+      // store state in session variable
+      var uri = \'' . $setSessionUri . '\' + state;
+      jQuery.get(uri);
+  });
+  });',
+  array('type' => "inline", 'scope' => JS_DEFAULT));
+
+  drupal_set_title(t('Search results'), PASS_THROUGH);
+
   return theme('cdm_search_results', array(
     'pager' => $taxonPager,
     'path' => 'cdm_dataportal/search/results/taxon',
@@ -1447,6 +1485,29 @@ function cdm_dataportal_view_search_results_taxon() {
     ));
 }
 
+/**
+ * Returns the state of the the showThumbnails flag set in the
+ * users session ($_SESSION['pageoption']['searchtaxa']['showThumbnails']).
+ *
+ * @return Ambigous <boolean, number>
+ *    returns 1 if the flag is set
+ */
+function do_showThumbnails() {
+  static $showThumbnails = null;
+
+  if($showThumbnails == null) {
+    $showThumbnails = FALSE;
+    if (isset($_SESSION['pageoption']['searchtaxa']['showThumbnails'])) {
+      $showThumbnails = $_SESSION['pageoption']['searchtaxa']['showThumbnails'];
+    }
+    if (!is_numeric($showThumbnails)) {
+      $showThumbnails = 1;
+    }
+  }
+
+  return $showThumbnails;
+}
+
 /**
  * View which transforms XML output from a given webservice endpoint into JSON.
  */
diff --git a/7.x/modules/cdm_dataportal/images/Protologue-media.png b/7.x/modules/cdm_dataportal/images/Protologue-media.png
index 61b0ad1f..fb7af537 100644
Binary files a/7.x/modules/cdm_dataportal/images/Protologue-media.png and b/7.x/modules/cdm_dataportal/images/Protologue-media.png differ
diff --git a/7.x/modules/cdm_dataportal/theme/cdm_dataportal.taxon.theme b/7.x/modules/cdm_dataportal/theme/cdm_dataportal.taxon.theme
index f089b681..3ef69664 100644
--- a/7.x/modules/cdm_dataportal/theme/cdm_dataportal.taxon.theme
+++ b/7.x/modules/cdm_dataportal/theme/cdm_dataportal.taxon.theme
@@ -52,44 +52,8 @@ function theme_cdm_search_results($variables) {
     }
     $pager->records = $taxa;
   }
-  $showThumbnails = FALSE;
-  if (isset($_SESSION['pageoption']['searchtaxa']['showThumbnails'])) {
-    $showThumbnails = $_SESSION['pageoption']['searchtaxa']['showThumbnails'];
-  }
-  if (!is_numeric($showThumbnails)) {
-    $showThumbnails = 1;
-  }
-  $setSessionUri = url('cdm_api/setvalue/session', array(
-    'query' => array('var' => '[pageoption][searchtaxa][showThumbnails]', 'val' => ''),
-  ));
-  drupal_add_js('jQuery(document).ready(function() {
-
-        // init
-        if(' . $showThumbnails . ' == 1){
-              jQuery(\'.media_gallery\').show(20);
-        } else {
-          jQuery(\'.media_gallery\').hide(20);
-        }
-        // add change hander
-        jQuery(\'#showThumbnails\').change(
-          function(event){
-            var state = 0;
-            if(jQuery(this).is(\':checked\')){
-              jQuery(\'.media_gallery\').show(20);
-              state = 1;
-            } else {
-              jQuery(\'.media_gallery\').hide(20);
-            }
-            // store state in session variable
-            var uri = \'' . $setSessionUri . '\' + state;
-            jQuery.get(uri);
-          });
-        });', array('type' => "inline", 'scope' => JS_DEFAULT));
-
-  drupal_set_title(t('Search results'), PASS_THROUGH);
 
   $out = '';
-
   // Add thumbnails checkbox and refine search link.
   $out = '<div class="page_options">';
   if (isset($_REQUEST['ws'])) {
@@ -97,7 +61,7 @@ function theme_cdm_search_results($variables) {
       $out .= '<div id="backButton">' . l(t('Modify search'), cdm_dataportal_search_form_path_for_ws($_REQUEST['ws'])) . '</div>';
     }
   }
-  $out .= '<form name="pageoptions"><input id="showThumbnails" type="checkbox" name="showThumbnails" ' . ($showThumbnails == 1 ? 'checked="checked"' : '') . '> ' . t('Show Thumbnails') . '</form>';
+  $out .= '<form name="pageoptions"><input id="showThumbnails" type="checkbox" name="showThumbnails" ' . (do_showThumbnails() == 1 ? 'checked="checked"' : '') . '> ' . t('Show Thumbnails') . '</form>';
   $out .= '</div>';
 
   // List results.
