function calculateOffset(curElement, event) {
    var element = curElement,
      offsetX = 0,
      offsetY = 0;

    p.pmouseX = p.mouseX;
    p.pmouseY = p.mouseY;

    // Find element offset
    if (element.offsetParent) {
      do {
        offsetX += element.offsetLeft;
        offsetY += element.offsetTop;
      } while (!!(element = element.offsetParent));
    }

    // Find Scroll offset
    element = curElement;
    do {
      offsetX -= element.scrollLeft || 0;
      offsetY -= element.scrollTop || 0;
    } while (!!(element = element.parentNode));

    // Get padding and border style widths for mouse offsets
    var stylePaddingLeft, stylePaddingTop, styleBorderLeft, styleBorderTop;
    if (document.defaultView && document.defaultView.getComputedStyle) {
      stylePaddingLeft = parseInt(document.defaultView.getComputedStyle(curElement, null).paddingLeft, 10)      || 0;
      stylePaddingTop  = parseInt(document.defaultView.getComputedStyle(curElement, null).paddingTop, 10)       || 0;
      styleBorderLeft  = parseInt(document.defaultView.getComputedStyle(curElement, null).borderLeftWidth, 10)  || 0;
      styleBorderTop   = parseInt(document.defaultView.getComputedStyle(curElement, null).borderTopWidth, 10)   || 0;
    }

    // Add padding and border style widths to offset
    offsetX += stylePaddingLeft;
    offsetY += stylePaddingTop;

    offsetX += styleBorderLeft;
    offsetY += styleBorderTop;

    // Take into account any scrolling done
    offsetX += window.pageXOffset;
    offsetY += window.pageYOffset;

    return {'X':offsetX,'Y':offsetY};
  }
/**
   * Determine the location of the (mouse) pointer.
   */
Determine the location of the (mouse) pointer.
Determine the location of the ( mouse ) pointer .
function calculateOffset(curElement, event) {
    var element = curElement,
      offsetX = 0,
      offsetY = 0;
    p.pmouseX = p.mouseX;
    p.pmouseY = p.mouseY;
    if (element.offsetParent) {
      do {
        offsetX += element.offsetLeft;
        offsetY += element.offsetTop;
      } while (!!(element = element.offsetParent));
    }
    element = curElement;
    do {
      offsetX -= element.scrollLeft || 0;
      offsetY -= element.scrollTop || 0;
    } while (!!(element = element.parentNode));
    var stylePaddingLeft, stylePaddingTop, styleBorderLeft, styleBorderTop;
    if (document.defaultView && document.defaultView.getComputedStyle) {
      stylePaddingLeft = parseInt(document.defaultView.getComputedStyle(curElement, null).paddingLeft, 10)      || 0;
      stylePaddingTop  = parseInt(document.defaultView.getComputedStyle(curElement, null).paddingTop, 10)       || 0;
      styleBorderLeft  = parseInt(document.defaultView.getComputedStyle(curElement, null).borderLeftWidth, 10)  || 0;
      styleBorderTop   = parseInt(document.defaultView.getComputedStyle(curElement, null).borderTopWidth, 10)   || 0;
    }
    offsetX += stylePaddingLeft;
    offsetY += stylePaddingTop;
    offsetX += styleBorderLeft;
    offsetY += styleBorderTop;
    offsetX += window.pageXOffset;
    offsetY += window.pageYOffset;
    return {'X':offsetX,'Y':offsetY};
  }
function calculateOffset ( curElement , event ) { var element = curElement , offsetX = 0 , offsetY = 0 ; p . pmouseX = p . mouseX ; p . pmouseY = p . mouseY ; if ( element . offsetParent ) { do { offsetX += element . offsetLeft ; offsetY += element . offsetTop ; } while ( ! ! ( element = element . offsetParent ) ) ; } element = curElement ; do { offsetX -= element . scrollLeft || 0 ; offsetY -= element . scrollTop || 0 ; } while ( ! ! ( element = element . parentNode ) ) ; var stylePaddingLeft , stylePaddingTop , styleBorderLeft , styleBorderTop ; if ( document . defaultView && document . defaultView . getComputedStyle ) { stylePaddingLeft = parseInt ( document . defaultView . getComputedStyle ( curElement , null ) . paddingLeft , 10 ) || 0 ; stylePaddingTop = parseInt ( document . defaultView . getComputedStyle ( curElement , null ) . paddingTop , 10 ) || 0 ; styleBorderLeft = parseInt ( document . defaultView . getComputedStyle ( curElement , null ) . borderLeftWidth , 10 ) || 0 ; styleBorderTop = parseInt ( document . defaultView . getComputedStyle ( curElement , null ) . borderTopWidth , 10 ) || 0 ; } offsetX += stylePaddingLeft ; offsetY += stylePaddingTop ; offsetX += styleBorderLeft ; offsetY += styleBorderTop ; offsetX += window . pageXOffset ; offsetY += window . pageYOffset ; return { 'X' : offsetX , 'Y' : offsetY } ; }
Determine the location of the (mouse) pointer.
Determine the location of the ( mouse ) pointer .
// Find element offset // Find Scroll offset // Get padding and border style widths for mouse offsets // Add padding and border style widths to offset // Take into account any scrolling done