includes/clientside/static/toolbar.js
author Dan
Tue, 03 Jul 2007 14:07:35 -0400
changeset 40 723bb7acf914
parent 1 fe660c52c48f
child 86 c162ca39db8f
permissions -rw-r--r--
Fixed a lot of bugs with Safari and Konqueror; improved Opera compatibility

// Page toolbar - selecting buttons

function unselectAllButtonsMajor()
{
  if ( !document.getElementById('pagebar_main') )
    return false;
  obj = document.getElementById('pagebar_main').firstChild;
  while(obj)
  {
    if(obj.id == 'mdgToolbar_article' || obj.id == 'mdgToolbar_discussion')
    {
      obj.className = '';
    }
    obj = obj.nextSibling;
  }
}

function unselectAllButtonsMinor()
{
  if ( !document.getElementById('pagebar_main') )
    return false;
  obj = document.getElementById('pagebar_main').firstChild.nextSibling;
  while(obj)
  {
    if ( obj.className != 'selected' )
    {
      obj = obj.nextSibling;
      continue;
    }
    if(obj.id != 'mdgToolbar_article' && obj.id != 'mdgToolbar_discussion')
    {
      if ( obj.className )
        obj.className = '';
    }
    obj = obj.nextSibling;
  }
}

function selectButtonMajor(which)
{
  if ( !document.getElementById('pagebar_main') )
    return false;
  if(typeof(document.getElementById('mdgToolbar_'+which)) == 'object')
  {
    unselectAllButtonsMajor();
    document.getElementById('mdgToolbar_'+which).className = 'selected';
  }
}

function selectButtonMinor(which)
{
  if ( !document.getElementById('pagebar_main') )
    return false;
  if(typeof(document.getElementById('mdgToolbar_'+which)) == 'object')
  {
    unselectAllButtonsMinor();
    document.getElementById('mdgToolbar_'+which).className = 'selected';
  }
}