/*

function refreshTree() {
  $$('.node').each(function(e){ 
    e.onmouseover = function() { this.style.backgroundColor = "#dce7fa"; };
    e.onmouseout = function() { this.style.backgroundColor = "transparent"; };
  });
  
  $$('.move-nubbin').each(function(e){
    e.onclick = function() { switchMoveNubbin(this.id); };
  });
  
}

function switchMoveNubbin(id) {
  if($(id).src.indexOf('up') != -1) {
    $(id).src = '/images/back_end/icons/list-movedown.png';
  } else {
    $(id).src = '/images/back_end/icons/list-moveup.png';
  }
  
  id = id.substring(id.indexOf('-')+1);
  Element.toggle('movenubbinup-'+id);
  Element.toggle('movenubbindown-'+id);
  
}

function initTree() {
    //ie 7 fix
    if($('page-content')) {
        new Ajax.Updater('page-content', '/pages/update_tree', {asynchronous:true, evalScripts:true, onComplete:function(request){refreshTree();}});
    }
}

Event.observe(window, "load", initTree);

*/


function refreshTree() {
  $$('.node').each(function(e){ 
    e.onmouseover = function() { this.style.backgroundColor = "#dce7fa"; };
    e.onmouseout = function() { this.style.backgroundColor = "transparent"; };
  });
  
  $$('.move-nubbin').each(function(e){
    e.onclick = function() { switchMoveNubbin(this.id); };
  });
  
}

function switchMoveNubbin(id) {
  if($(id).src.indexOf('up') != -1) {
    $(id).src = '/images/back_end/icons/list-movedown.png';
  } else {
    $(id).src = '/images/back_end/icons/list-moveup.png';
  }
  
  id = id.substring(id.indexOf('-')+1);
  Element.toggle('movenubbinup-'+id);
  Element.toggle('movenubbindown-'+id);
  
}

Event.observe(window, "load", refreshTree);
