  function findPosition(oElement) {
      function getNextAncestor(oElement) {
          var actualStyle;
          if (window.getComputedStyle) {
              actualStyle = getComputedStyle(oElement,null).position;
          } else 
              if (oElement.currentStyle) {
                  actualStyle = oElement.currentStyle.position;
              } else {
                  // fallback for browsers with low 
                  // support - only reliable for inline
                  // styles
                  actualStyle = oElement.style.position;
              }
          if (actualStyle=='absolute' || actualStyle == 'fixed') {
              // the offsetParent of a fixed position
              // element is null so it will stop
              return oElement.offsetParent;
          }
          return oElement.parentNode;
      }
      
      if (typeof(oElement.offsetParent)!='undefined') {
          var originalElement = oElement;
          for (var posX=0, posY=0; oElement; oElement=oElement.offsetParent ) {
              posX += oElement.offsetLeft;
              posY += oElement.offsetTop;
          }
          
          if (!originalElement.parentNode || !originalElement.style || typeof(originalElement.scrollTop)=='undefined') {
              // older browsers cannot check element scrolling
              return [posX,posY];
          }
          opx = posX;
          opy = posY;
          scrolldings = 0;
          oElement = getNextAncestor(originalElement);
          while (oElement && oElement!=document.body && oElement!=document.documentElement) {
                  posX -= oElement.scrollLeft;
                  posY -= oElement.scrollTop;
                  if (oElement.scrollTop>0) {
                      scrolldings = 1;
                  }
                  oElement = getNextAncestor(oElement);
          }
          if (navigator.appName.indexOf("Microsoft Internet Explorer")!=-1) {
              if (scrolldings) {
                  posY = opy-50;
              } else {
                  posY = opy-50;
              }
          }
          if (posY<0) {
              posY = 0;
          }

          return [posX, posY];
      } else {
          return [oElement.x, oElement.y];
      }
  }



  var sSHObj;
  var sSHtimeout;
  
  function showSourceHeader(eid) {
      obj = document.getElementById(eid);
      obj.isOn = 1;
      if (sSHObj) {
          sSHObj.style.visibility = 'hidden';
          sSHObj.isOn = 0;
          sSHObj = 0;
      }
      if (obj.isOn) {
            sSHObj = obj;
            // po = obj.parentNode;
            // p = findPosition(po);
            // obj.style.position = "absolute";
            // obj.style.top = p[1];
            // obj.style.left = p[0]+po.offsetWidth-5;
            obj.style.visibility = 'visible';
      } else {
            obj.style.visibility = 'hidden';
            sSHObj = 0;
      }
    }
    
    function showDropMenu(eid, pid) {
      obj = document.getElementById(eid);
      obj.isOn = 1;
      if (sSHtimeout) {
          window.clearTimeout(sSHtimeout);
          sSHtimeout = 0;
      }
      if (sSHObj && sSHObj!=obj) {
          sSHObj.style.visibility = 'hidden';
          sSHObj.isOn = 0;
          sSHObj = 0;
      }
      if (sSHObj==obj) {
          return;
      }
      sSHObj = obj;
      po = document.getElementById(pid);
      p = findPosition(po);
      obj.style.position = "absolute";
      obj.style.top = p[1]+5;
      obj.style.left = p[0]+po.offsetWidth-5;
      obj.style.visibility = 'visible';
    }
    
    function hideSourceHeaderDelayed(eid) {
        if (!sSHtimeout) {
            sSHtimeout = window.setTimeout("hideSourceHeader('"+eid+"')",5000);
        }
    }
    
    function hideSourceHeader(eid) {
        sSHtimeout = 0;
        obj = document.getElementById(eid);
        obj.isOn = 0;
        sSHObj = 0;
        obj.style.visibility = 'hidden';
    }
    


