
function prepareNavigator(root, element, offset) {
  element.onmouseover = function(e) {
    var currEffect;
    var currTopNavigator = Builder.node('div', {className:'floatnav'});
    currTopNavigator.style.position = 'absolute';
    currTopNavigator.style.zIndex = 9;
    if(offset > 0) {
      Position.clone(element, currTopNavigator, {setWidth: false, setHeight: false, offsetTop: 0, offsetLeft: element.offsetWidth - 20 });
    } 
    else {
      Position.clone(element, currTopNavigator, {setWidth: false, setHeight: false, offsetTop: element.offsetHeight, offsetLeft: 0 });
    }
    element.onmouseout = function(e) {
      currEffect = Effect.Fade(currTopNavigator,{duration:0.50, afterFinish: function() { Element.remove(currTopNavigator); } });
    }
    currTopNavigator.onmouseover = function(e) {
      if(currEffect) {
        currEffect.cancel();
        Effect.Appear(currTopNavigator, {duration:0.20} );
        currEffect = null;
      }
    }
    currTopNavigator.onmouseout = function(e) {
      if(currEffect) {
        currEffect.cancel();
        Effect.Appear(currTopNavigator, {duration:0.20} );
        currEffect = null;
      }
      if (!e) e = window.event;
      var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;
      while (reltg != currTopNavigator && reltg.parentNode)
        reltg = reltg.parentNode;
      if (reltg == currTopNavigator) return;
      Effect.Fade(currTopNavigator,{duration:0.50, afterFinish: function() { Element.remove(currTopNavigator); } });
    }
    $('pagebody').appendChild(currTopNavigator);

    var href = element.getAttribute('href').substring(root.length);
  	var url = root + '/xpaction/context';
    var pars = 'context=' + href + '&action=navigator';
    var myAjax = new Ajax.Updater( currTopNavigator, url, { method: 'get', parameters: pars });
  }
};
