themes/admin/js/menu.js
changeset 80 cb7dde69c301
parent 79 5faff33a6580
child 81 d7fc25acd3f3
--- a/themes/admin/js/menu.js	Mon Jul 30 10:46:17 2007 -0400
+++ b/themes/admin/js/menu.js	Wed Aug 01 13:39:27 2007 -0400
@@ -1,71 +1,18 @@
-/*
-var menuClicked = false;
-var menuID = false;
-var menuParent = false;
-function adminOpenMenu(menu, parent)
-{
-  menuParent = parent;
-  if ( typeof(menu) == 'string' )
-  {
-    menu = document.getElementById(menu);
-  }
-  if(!menu)
-  {
-    alert('Menu object is invalid');
-    return false;
-  }
-  var off = fetch_offset(parent);
-  var dim = fetch_dimensions(parent);
-  var w = 200;
-  var top = off['top'] + dim['h'];
-  var left = off['left'] + dim['w'] - w;
-  menu.style.top = top + 'px';
-  menu.style.left = left + 'px';
-  menu.style.display = 'block';
-  menuID = menu.id;
-  setTimeout('setMenuoffEvents();', 500);
-  //if(!IE)
-  //  parent.onclick = eval('(function() { this.onclick = function() { adminOpenMenu(\'' + menu.id + '\', this); return false; }; return false; } )');
-}
-
-function adminMenuOff()
-{
-  if ( menuID )
-  {
-    menu = document.getElementById(menuID);
-    menu.style.display = 'none';
-    menu.onmousedown = false;
-    menu.onmouseup = false;
-    menuID = false;
-    document.onclick = false;
-    //menuParent.onclick();
-    //menuParent = false;
-  }
-}
-
-function setMenuoffEvents()
-{
-  menu = document.getElementById(menuID);
-  menu.onmousedown = function() { menuClicked = true; }
-  menu.onmouseup   = function() { setTimeout('menuClicked = false;', 100); }
-  document.onclick = function() { if ( menuClicked ) return false; adminMenuOff(); }
-}
-*/
-
+var TBL_SHOW = ( IE ) ? 'block' : 'table';
 function admin_expand()
 {
   var expander = document.getElementById('sidebar-hide');
   var content  = document.getElementById('sidebar-show');
   var holder  = document.getElementById('td-sidebar');
-  if ( content.style.display == 'table' )
+  if ( content.style.display == TBL_SHOW )
   {
+    admin_collapse_real(expander, content, holder);
     createCookie('theme_admin_sidebar', 'collapsed', 3650);
-    admin_collapse_real(expander, content, holder);
   }
   else
   {
+    admin_expand_real(expander, content, holder);
     createCookie('theme_admin_sidebar', 'expanded', 3650);
-    admin_expand_real(expander, content, holder);
   }
 }
 
@@ -81,7 +28,7 @@
 function admin_expand_real(expander, content, holder)
 {
   expander.className = 'expanded';
-  content.style.display = 'table';
+  content.style.display = TBL_SHOW;
   holder.style.width = '230px';
   holder.style.paddingLeft = '12px';
   holder.style.paddingRight = '0px';