function JSUtil() {
}

/**
 * Get the top position of a Node relative to the document.
 * @param node the Node to get the position of
 * @type integer
 * @returns the top of the node
 */
JSUtil.getTop = function (node) {
  if (node.y !== undefined) {
    return node.y;
  } else if (node.offsetTop !== undefined) {
    if (node.offsetParent) {
      return node.offsetTop + JSUtil.getTop(node.offsetParent);
    }
    else {
      return node.offsetTop;
    }
	} else {
	  //wfLogger.error("JSUtil.getTop", "Can't figure out how to work with this browser.");
	}
}

/**
 * Get the left position of a Node relative to the document.
 * @param node the Node to get the position of
 * @type integer
 * @returns the left of the node
 */
JSUtil.getLeft = function (node) {
  if (node.x !== undefined) {
    return node.x;
  } else if (node.offsetLeft !== undefined) {
    if (node.offsetParent) {
      return node.offsetLeft + JSUtil.getLeft(node.offsetParent);
    }
    else {
      return node.offsetLeft;
    }
	}
}

/**
 * Get the right position of a Node relative to the document.
 * @param node the Node to get the position of
 * @type integer
 * @returns the right of the node
 */
JSUtil.getRight = function (node) {
  return JSUtil.getLeft(node) + JSUtil.getWidth(node);
}

/**
 * Get the bottom position of a Node relative to the document.
 * @param node the Node to get the position of
 * @type integer
 * @returns the bottom of the node
 */
JSUtil.getBottom = function (node) {
  return JSUtil.getTop(node) + JSUtil.getHeight(node);
}

/**
 * Get the width of a Node.
 * @param node the Node to get the width of
 * @type integer
 * @returns the width of the node
 */
JSUtil.getWidth = function (node) {
  if (node.offsetWidth) {
    return node.offsetWidth;
  } else if (node.clientWidth) {
    return node.clientWidth;
  } else if (node.width) {
    return node.width;
  }
}

/**
 * Get the height of a Node.
 * @param node the Node to get the height of
 * @type integer
 * @returns the height of the node
 */
JSUtil.getHeight = function (node) {
  if (node.offsetHeight) {
    return node.offsetHeight;
  } else if (node.clientHeight) {
    return node.clientHeight;
  } else if (node.height) {
    return node.height;
  }
}
