function positionInfo(object) { var p_elm = object; this.getElementLeft = getElementLeft; function getElementLeft() { var x = 0; var elm; if(typeof(p_elm) == "object"){ elm = p_elm; } else { elm = document.getElementById(p_elm); } while (elm != null) { x+= elm.offsetLeft; elm = elm.offsetParent; } return parseInt(x); } this.getElementWidth = getElementWidth; function getElementWidth(){ var elm; if(typeof(p_elm) == "object"){ elm = p_elm; } else { elm = document.getElementById(p_elm); } return parseInt(elm.offsetWidth); } this.getElementRight = getElementRight; function getElementRight(){ return getElementLeft(p_elm) + getElementWidth(p_elm); } this.getElementTop = getElementTop; function getElementTop() { var y = 0; var elm; if(typeof(p_elm) == "object"){ elm = p_elm; } else { elm = document.getElementById(p_elm); } while (elm != null) { y+= elm.offsetTop; elm = elm.offsetParent; } return parseInt(y); } this.getElementHeight = getElementHeight; function getElementHeight(){ var elm; if(typeof(p_elm) == "object"){ elm = p_elm; } else { elm = document.getElementById(p_elm); } return parseInt(elm.offsetHeight); } this.getElementBottom = getElementBottom; function getElementBottom(){ return getElementTop(p_elm) + getElementHeight(p_elm); } }